/* --- Variables CSS --- */
:root {
    --bg-main: #f8fafc;       
    --bg-secondary: #ffffff;  
    --accent: #0f172a;        
    --text-primary: #1e293b;  
    --text-secondary: #64748b; 
    --border-color: #e2e8f0;  
    --nav-bg: rgba(255, 255, 255, 0.85);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.05);
}

[data-theme="dark"] {
    --bg-main: #0f172a;       
    --bg-secondary: #1e293b;  
    --accent: #f8fafc;        
    --text-primary: #f1f5f9;  
    --text-secondary: #94a3b8; 
    --border-color: #334155;  
    --nav-bg: rgba(15, 23, 42, 0.85);
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}
a { text-decoration: none; color: inherit; transition: all 0.3s ease; }
ul { list-style: none; }

h1 { font-family: 'Playfair Display', serif; font-style: italic; font-size: 3.5rem; font-weight: 700; margin-bottom: 2rem; color: var(--accent); text-align: center; }
h2 { font-size: 1.5rem; margin: 2rem 0 1rem; color: var(--accent); border-bottom: 2px solid var(--accent); padding-bottom: 0.5rem; display: inline-block; }
p { margin-bottom: 15px; }

/* --- BARRE DE NAVIGATION (OVALE FLOTTANT) --- */
.navbar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0.6rem 1.5rem;
    background-color: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1000px;
    z-index: 100;
    border: 1px solid var(--border-color);
    border-radius: 50px;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.nav-brand { justify-self: start; }
.nav-center { display: flex; gap: 2.5rem; justify-self: center; align-items: center; }
.theme-btn { justify-self: end; }

.nav-brand { font-weight: 800; font-size: 1.3rem; letter-spacing: -0.5px; color: var(--accent); position: relative; padding-bottom: 2px;}
.nav-link, .dropbtn { font-weight: 600; color: var(--text-secondary); cursor: pointer; border: none; background: none; font-family: inherit; font-size: 0.95rem; position: relative; padding-bottom: 2px; transition: color 0.3s ease;}

.nav-brand::after, .nav-link::after, .dropbtn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s ease-in-out;
}
.nav-brand:hover::after, .nav-link:hover::after, .nav-link.active::after, .dropdown:hover .dropbtn::after { width: 100%; }
.nav-brand:hover, .nav-link:hover, .nav-link.active, .dropdown:hover .dropbtn { color: var(--accent); }

.theme-btn { background: transparent; border: 1px solid var(--border-color); border-radius: 50%; width: 40px; height: 40px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; color: var(--accent); transition: all 0.3s ease; }
.theme-btn:hover { background-color: var(--bg-secondary); transform: scale(1.05); box-shadow: var(--shadow-md); }

/* --- CORRECTIF MENU DÉROULANT --- */
.dropdown { position: relative; display: inline-block; }
.dropdown-content { 
    display: none; 
    position: absolute; 
    background-color: var(--bg-secondary); 
    min-width: 160px; 
    box-shadow: var(--shadow-lg); 
    border-radius: 12px; 
    padding: 0.5rem; 
    z-index: 1; 
    top: 100%; 
    margin-top: 15px; 
    left: 50%; 
    transform: translateX(-50%); 
    border: 1px solid var(--border-color); 
}

.dropdown-content::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 0;
    width: 100%;
    height: 15px;
    background: transparent;
}

.dropdown:hover .dropdown-content { display: block; }
.dropdown-content a { color: var(--text-primary); padding: 12px 16px; border-radius: 8px; font-weight: 500; display: block;}
.dropdown-content a:hover { background-color: var(--bg-main); color: var(--accent); transform: translateY(-2px); }

/* --- Contenu Principal (Licences) --- */
main { flex: 1; padding: 150px 20px 40px; max-width: 1200px; margin: 0 auto; width: 100%; }

.card { background-color: var(--bg-secondary); padding: 25px; border-radius: 12px; margin-bottom: 25px; border: 1px solid var(--border-color); box-shadow: var(--shadow-sm); transition: transform 0.2s ease, box-shadow 0.2s ease; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.card h3 { font-family: 'Inter', sans-serif; font-style: normal; font-size: 1.25rem; margin-bottom: 15px; color: var(--accent); }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 15px; }
.subject-item { background-color: var(--bg-main); padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.subject-name { font-weight: 500; }
.subject-hours { color: var(--text-secondary); font-size: 0.85rem; font-family: monospace; background: var(--border-color); padding: 2px 6px; border-radius: 4px; }

/* --- Bouton Remonter en haut --- */
#backToTopBtn {
    display: none; 
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99;
    border: none;
    outline: none;
    background-color: var(--accent);
    color: var(--bg-secondary);
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    transition: background-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
#backToTopBtn:hover {
    background-color: var(--text-secondary); 
    transform: translateY(-4px); 
    box-shadow: var(--shadow-lg); 
}

@media (max-width: 768px) { 
    .navbar { grid-template-columns: 1fr auto; }
    .nav-center { display: none; } 
}

footer { text-align: center; padding: 2rem; color: var(--text-secondary); font-size: 0.9rem; margin-top: auto; border-top: 1px solid var(--border-color); }