/* 
   DSFR-inspired CSS for Académie Klaus von Stauffenberg 
   Focus: Institutional, clean, high-contrast, professional.
*/

:root {
    --blue-france: #000091;
    --blue-france-hover: #1212ff;
    --blue-sun: #00004a;
    --red-marianne: #e1000f;
    --text-main: #161616;
    --text-sec: #666666;
    --bg-light: #f6f6f6;
    --white: #ffffff;
    --border-gray: #e5e5e5;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    --top-bar-h: 2.5rem;
}

[data-theme='dark'] {
    --blue-france: #6a6af4;
    --blue-france-hover: #b1b1f9;
    --blue-sun: #21213f;
    --red-marianne: #ff4b5c;
    --text-main: #e5e5e5;
    --text-sec: #9a9a9a;
    --bg-light: #1e1e1e;
    --white: #161616;
    --border-gray: #3a3a3a;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    line-height: 1.6;
    background-color: var(--white);
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.serif {
    font-family: 'Spectral', serif;
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* --- Header --- */
header {
    background: var(--white);
    border-bottom: 1px solid var(--border-gray);
    padding: 1.5rem 0;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.marianne-block {
    display: flex;
    flex-direction: column;
    border-right: 2px solid var(--text-main);
    padding-right: 1.5rem;
    margin-right: 1.5rem;
}

.marianne-logo {
    font-weight: 900;
    font-size: 1.2rem;
    line-height: 1;
    letter-spacing: -0.5px;
    text-transform: uppercase;
}

.marianne-sep {
    height: 1rem;
    width: 2.5rem;
    background: linear-gradient(to right, var(--blue-france) 33%, var(--white) 33%, var(--white) 66%, var(--red-marianne) 66%);
    margin: 0.5rem 0;
}

.marianne-sub {
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.academy-branding {
    display: flex;
    flex-direction: column;
}

.academy-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.header-logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    mix-blend-mode: multiply;
}

.header-search {
    flex-grow: 1;
    max-width: 400px;
    position: relative;
}

.search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: var(--text-sec);
    pointer-events: none;
    flex-shrink: 0;
}

.header-search input {
    width: 100%;
    padding: 0.55rem 1rem 0.55rem 2.5rem;
    border: 1px solid var(--border-gray);
    background: var(--bg-light);
    border-radius: 4px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.header-search input:focus {
    outline: none;
    border-color: var(--blue-france);
    box-shadow: 0 0 0 3px rgba(0, 0, 145, 0.12);
    background: var(--white);
}

/* --- Search Results Dropdown --- */
.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 1000;
    overflow: hidden;
    animation: sr-fade-in 0.15s ease;
}

@keyframes sr-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.sr-card {
    padding: 1.25rem 1.5rem;
}

.sr-badge {
    display: inline-block;
    background: rgba(0, 0, 145, 0.08);
    color: var(--blue-france);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
    margin-bottom: 0.5rem;
}

.sr-nom {
    font-size: 1.2rem;
    font-family: 'Spectral', serif;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.sr-meta {
    font-size: 0.85rem;
    color: var(--text-sec);
    margin-bottom: 0.15rem;
}

.sr-uai {
    font-size: 0.8rem;
    color: var(--text-sec);
    margin-bottom: 1rem;
}

.sr-uai code {
    background: var(--bg-light);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.78rem;
    letter-spacing: 0.5px;
}

.sr-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    background: var(--bg-light);
    border-radius: 4px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.sr-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.2rem;
}

.sr-stat-icon {
    font-size: 1.3rem;
}

.sr-stat-value {
    font-size: 1.1rem;
    font-weight: 900;
    color: var(--blue-france);
    font-family: 'Spectral', serif;
}

.sr-stat-label {
    font-size: 0.75rem;
    color: var(--text-sec);
    line-height: 1.2;
}

.sr-link {
    font-size: 0.88rem;
    padding: 0.5rem 1rem;
}

.sr-empty {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    color: var(--text-sec);
    font-size: 0.9rem;
}

.sr-empty svg {
    flex-shrink: 0;
    opacity: 0.4;
}

/* --- Navigation --- */
nav {
    background: var(--white);
    border-bottom: 2px solid var(--blue-france);
}

.nav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-links {
    display: flex;
    list-style: none;
}

.nav-links li a {
    display: block;
    padding: 1rem 1.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    border-bottom: 2px solid transparent;
}

.nav-links li a:hover,
.nav-links li a.active {
    background: var(--bg-light);
    border-bottom: 2px solid var(--blue-france);
    color: var(--blue-france);
}

/* --- Hero --- */
.hero {
    position: relative;
    height: 400px;
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to right, rgba(0, 0, 145, 0.8), rgba(0, 0, 145, 0.1));
}

.hero-content {
    position: relative;
    z-index: 1;
    color: var(--white);
    max-width: 600px;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    line-height: 1.1;
}

.hero p {
    font-size: 1.2rem;
    font-weight: 400;
}

/* --- Quick Access (ENT/PRONOTE) --- */
.quick-access {
    background: var(--bg-light);
    padding: 3rem 0;
}

.access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.access-card {
    background: var(--white);
    padding: 2rem;
    border-bottom: 4px solid var(--blue-france);
    box-shadow: var(--shadow);
    transition: transform 0.2s ease;
}

.access-card:hover {
    transform: translateY(-5px);
}

.access-card h3 {
    color: var(--blue-france);
    margin-bottom: 0.5rem;
}

.access-card p {
    font-size: 0.9rem;
    color: var(--text-sec);
    margin-bottom: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background: var(--blue-france);
    color: var(--white);
    font-weight: 600;
    border-radius: 4px;
}

.btn:hover {
    background: var(--blue-france-hover);
}

/* --- News Section --- */
.news-section {
    padding: 4rem 0;
}

.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    border-left: 4px solid var(--blue-france);
    padding-left: 1rem;
}

.news-body {
    padding: 1.5rem;
}

.news-tag {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--blue-france);
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
}

.news-card h4 {
    font-size: 1.15rem;
    margin-bottom: 0.5rem;
    font-family: 'Spectral', serif;
    line-height: 1.35;
}

.news-card p {
    font-size: 0.9rem;
    color: var(--text-sec);
    line-height: 1.5;
}

/* --- Key Figures --- */
.figures-section {
    background: var(--blue-france);
    color: var(--white);
    padding: 4rem 0;
    text-align: center;
}

.figures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.figure-item h2 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.figure-item p {
    opacity: 0.8;
    font-weight: 600;
}

/* --- Footer --- */
footer {
    background: var(--bg-light);
    border-top: 1px solid var(--border-gray);
    padding: 4rem 0 2rem;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 3rem;
}

.footer-marianne {
    display: flex;
    flex-direction: column;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.footer-links h5 {
    font-weight: 700;
    margin-bottom: 1rem;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-sec);
}

.footer-bottom {
    border-top: 1px solid var(--border-gray);
    padding-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-sec);
    display: flex;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .header-top {
        flex-direction: column;
        gap: 1.5rem;
    }

    .nav-links {
        flex-wrap: wrap;
    }

    .hero h1 {
        font-size: 2rem;
    }

    .news-layout {
        grid-template-columns: 1fr;
    }

    .recteur-inner {
        grid-template-columns: 1fr;
    }

    .recteur-image {
        display: none;
    }

    .footer-top {
        flex-direction: column;
        gap: 2rem;
    }
}

/* --- Top Alert Bar --- */
.top-bar {
    background: var(--blue-france);
    color: var(--white);
    font-size: 0.88rem;
    padding: 0.6rem 2rem;
    font-weight: 500;
}

/* --- Skip Link (Accessibility) --- */
.skip-link {
    position: absolute;
    top: -999px;
    left: 0;
    padding: 0.5rem 1rem;
    background: var(--blue-france);
    color: var(--white);
    z-index: 9999;
    border-radius: 0 0 4px 0;
}

.skip-link:focus {
    top: 0;
}

/* --- Mot du Recteur --- */
.recteur-section {
    background: var(--white);
    padding: 4rem 0;
    border-top: 1px solid var(--border-gray);
    border-bottom: 1px solid var(--border-gray);
}

.recteur-inner {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 3rem;
    align-items: center;
}

.recteur-quote {
    position: relative;
    padding-left: 2rem;
    border-left: 4px solid var(--red-marianne);
}

.quote-mark {
    font-size: 5rem;
    line-height: 1;
    color: var(--blue-france);
    font-family: 'Spectral', serif;
    font-weight: 700;
    position: absolute;
    top: -1.5rem;
    left: -0.5rem;
    opacity: 0.15;
}

.recteur-quote p {
    font-size: 1.1rem;
    font-style: italic;
    color: var(--text-main);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    font-family: 'Spectral', serif;
}

.recteur-signature {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.recteur-signature strong {
    color: var(--blue-france);
    font-size: 1rem;
}

.recteur-signature span {
    color: var(--text-sec);
    font-size: 0.9rem;
}

.recteur-image {
    height: 300px;
    background: var(--bg-light);
    border: 1px solid var(--border-gray);
    background-image: url('https://images.unsplash.com/photo-1560250097-0b93528c311a?q=80&w=987&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
    background-size: cover;
    background-position: top center;
}

/* --- News Layout with Sidebar --- */
.news-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3rem;
    align-items: start;
}

.news-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.news-card {
    display: grid;
    grid-template-columns: 200px 1fr;
    border: 1px solid var(--border-gray);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}

.news-card:hover {
    box-shadow: var(--shadow);
}

.news-image {
    min-height: 160px;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-light);
}

.news-link {
    display: inline-block;
    margin-top: 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--blue-france);
    border-bottom: 1px solid var(--blue-france);
    padding-bottom: 1px;
}

.news-link:hover {
    color: var(--blue-france-hover);
    border-color: var(--blue-france-hover);
}

/* --- Agenda Sidebar --- */
.agenda-sidebar {
    border: 1px solid var(--border-gray);
    padding: 1.5rem;
    background: var(--bg-light);
}

.agenda-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.agenda-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-gray);
}

.agenda-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.agenda-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--blue-france);
    color: var(--white);
    padding: 0.4rem 0.6rem;
    min-width: 48px;
    border-radius: 2px;
    flex-shrink: 0;
}

.agenda-date .day {
    font-size: 1.4rem;
    font-weight: 900;
    line-height: 1;
}

.agenda-date .month {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.agenda-body {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.9rem;
}

.agenda-body strong {
    color: var(--text-main);
    line-height: 1.3;
}

.agenda-body span {
    color: var(--text-sec);
    font-size: 0.8rem;
}

/* --- Theme Toggle --- */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: 1px solid var(--border-gray);
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: var(--bg-light);
    border-color: var(--blue-france);
}

.theme-toggle svg {
    color: var(--blue-france);
}

/* --- Toast Notification System --- */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--white);
    color: var(--text-main);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border-left: 4px solid var(--blue-france);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.show {
    transform: translateX(0);
}

.toast-error {
    border-left-color: var(--red-marianne);
    background: #fffafa; /* Light red wash */
}

.toast svg {
    flex-shrink: 0;
    color: var(--red-marianne);
}