/* ============================================
   COURS REACT — STYLE GLOBAL
   ============================================ */

:root {
    --primary: #61dafb;
    --primary-dark: #21a1c9;
    --bg-dark: #282c34;
    --bg-card: #1e1e2e;
    --bg-code: #1a1a2e;
    --text: #e0e0e0;
    --text-muted: #8892b0;
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
    --border: #3a3a5c;
    --radius: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    line-height: 1.7;
    padding: 2rem;
    max-width: 960px;
    margin: 0 auto;
}

h1 {
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

h2 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-top: 2rem;
    margin-bottom: 0.8rem;
}

h3 {
    color: var(--primary-dark);
    font-size: 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
}

p, li {
    margin-bottom: 0.5rem;
    color: var(--text);
}

ul, ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

code {
    background: var(--bg-code);
    color: var(--primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
}

pre {
    background: var(--bg-code);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.88em;
    line-height: 1.6;
    color: var(--text);
}

pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.note {
    background: rgba(97, 218, 251, 0.08);
    border-left: 4px solid var(--primary);
    padding: 1rem 1.2rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1rem 0;
}

.warning {
    background: rgba(255, 152, 0, 0.08);
    border-left: 4px solid var(--warning);
    padding: 1rem 1.2rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin: 1rem 0;
}

.nav-lessons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.nav-lessons a {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    transition: all 0.2s;
}

.nav-lessons a:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(97, 218, 251, 0.15);
}

.nav-lessons a span {
    display: block;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 0.3rem;
}

.lesson-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.lesson-nav a {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.lesson-nav a:hover {
    border-color: var(--primary);
    text-decoration: none;
}

/* ---- Zone de démo React ---- */
#root, .demo {
    background: var(--bg-card);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1.5rem 0;
    min-height: 60px;
}

.demo-label {
    color: var(--text-muted);
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

/* ---- Boutons ---- */
button {
    background: var(--primary);
    color: var(--bg-dark);
    border: none;
    padding: 0.5rem 1.2rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    margin: 0.3rem;
}

button:hover {
    background: var(--primary-dark);
}

button:active {
    transform: scale(0.97);
}

button.danger {
    background: var(--danger);
    color: white;
}

button.success {
    background: var(--success);
    color: white;
}

/* ---- Inputs ---- */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
textarea,
select {
    background: var(--bg-code);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    width: 100%;
    max-width: 400px;
    margin: 0.3rem 0;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(97, 218, 251, 0.2);
}

label {
    display: block;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ---- Table ---- */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    border: 1px solid var(--border);
    padding: 0.6rem 1rem;
    text-align: left;
}

th {
    background: var(--bg-code);
    color: var(--primary);
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    background: var(--primary);
    color: var(--bg-dark);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
    body {
        padding: 1rem;
    }
    h1 {
        font-size: 1.5rem;
    }
    .nav-lessons {
        grid-template-columns: 1fr;
    }
}
