/* ==========================================================================
   Variables de couleur (palette officielle Yzendra, partagée avec la vitrine)
   ========================================================================== */
:root {
    --navy: #084A62;
    --teal: #177C8B;
    --red: #DC3C35;
    --yellow: #FFCA5A;
    --text-main: #1a1a1a;
    --text-muted: #5c6b70;
    --bg-alt: #F0F6F7;
    --border-color: #e2e8ea;
    --radius: 10px;
}

/* ==========================================================================
   Reset de base et typographie
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    line-height: 1.6;
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
}

a {
    color: var(--teal);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   Header / navigation (mobile-first : overlay plein écran par défaut,
   barre horizontale à partir de 641px)
   ========================================================================== */
.site-header {
    border-bottom: 1px solid var(--border-color);
    padding: 16px 0;
    background: #fff;
}

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

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 20px;
    font-weight: 700;
    color: var(--navy);
}

.nav-toggle {
    position: relative;
    z-index: 101;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background: var(--navy);
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease, background 0.25s ease;
}

.nav-toggle[aria-expanded="true"] span {
    background: #fff;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.main-nav {
    display: none;
}

.main-nav.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 100;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 28px;
    background: var(--navy);
    animation: nav-overlay-in 0.25s ease both;
}

.main-nav.is-open a:not(.btn) {
    opacity: 0;
    color: #fff;
    font-size: 24px;
    font-weight: 600;
    text-decoration: none;
    animation: nav-link-in 0.4s ease both;
}

.main-nav.is-open a:not(.btn):nth-child(1) { animation-delay: 0.05s; }
.main-nav.is-open a:not(.btn):nth-child(2) { animation-delay: 0.1s; }
.main-nav.is-open a:not(.btn):nth-child(3) { animation-delay: 0.15s; }
.main-nav.is-open a:not(.btn):nth-child(4) { animation-delay: 0.2s; }
.main-nav.is-open a:not(.btn):nth-child(5) { animation-delay: 0.25s; }

.main-nav.is-open a:not(.btn):hover {
    color: var(--yellow);
}

.main-nav.is-open .btn-outline {
    border-color: #fff;
    color: #fff;
}

.main-nav.is-open .btn-outline:hover {
    background: #fff;
    color: var(--navy);
}

.main-nav a:not(.btn) {
    color: var(--navy);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
}

.account-menu,
.account-panel {
    display: contents;
}

.account-trigger {
    display: none;
}

body.nav-open {
    overflow: hidden;
}

@keyframes nav-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes nav-link-in {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (min-width: 641px) {
    .nav-toggle {
        display: none;
    }

    .main-nav {
        display: flex;
        position: static;
        flex-direction: row;
        align-items: center;
        gap: 24px;
        background: none;
        animation: none;
    }

    .main-nav a:not(.btn) {
        opacity: 1;
        animation: none;
    }

    .account-menu {
        display: block;
        position: relative;
    }

    .account-panel {
        display: none;
        position: absolute;
        top: calc(100% + 12px);
        right: 0;
        min-width: 200px;
        flex-direction: column;
        gap: 4px;
        background: #fff;
        border-radius: var(--radius);
        box-shadow: 0 4px 24px rgba(8, 74, 98, 0.12);
        padding: 8px;
        z-index: 50;
    }

    .account-panel.is-open {
        display: flex;
    }

    .account-panel a:not(.btn) {
        padding: 10px 12px;
        border-radius: 6px;
    }

    .account-panel a:not(.btn):hover {
        background: var(--bg-alt);
        color: var(--teal);
    }

    .account-trigger {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 6px 10px 6px 6px;
        border: 1px solid var(--border-color);
        border-radius: 999px;
        background: #fff;
        cursor: pointer;
        font-family: inherit;
    }

    .account-trigger:hover {
        border-color: var(--teal);
    }

    .account-avatar {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: var(--teal);
        color: #fff;
        font-size: 13px;
        font-weight: 700;
    }

    .account-name {
        color: var(--navy);
        font-size: 14px;
        font-weight: 500;
    }
}

/* ==========================================================================
   Boutons
   ========================================================================== */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--red);
    color: #fff;
}
.btn-primary:hover {
    background: #c22f29;
}

.btn-outline {
    background: transparent;
    color: var(--navy);
    border: 1px solid var(--navy);
}
.btn-outline:hover {
    background: var(--navy);
    color: #fff;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
    background: var(--navy);
    padding: 32px 0;
    text-align: center;
    color: #cfe3e8;
    font-size: 14px;
}

.site-footer a {
    color: #cfe3e8;
    text-decoration: underline;
}

.site-footer a:hover {
    color: #fff;
}

/* ==========================================================================
   Pages Register / Login / Compte (formulaires d'authentification)
   ========================================================================== */
.main-alt-bg {
    background: var(--bg-alt);
}

.auth-wrapper {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 24px;
}

.auth-card {
    background: #fff;
    border-radius: var(--radius);
    border-top: 4px solid var(--teal);
    box-shadow: 0 4px 24px rgba(8, 74, 98, 0.08);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.auth-card h1 {
    font-size: 24px;
    color: var(--navy);
    margin-bottom: 24px;
    text-align: center;
}

.auth-card form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-card input[type="email"]:focus,
.auth-card input[type="password"]:focus,
.auth-card input[type="text"]:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(23, 124, 139, 0.15);
}

.auth-card .btn {
    width: 100%;
    margin-top: 8px;
}

.auth-card ul {
    list-style: none;
    color: var(--red);
    font-size: 13px;
    margin-top: 4px;
}

.auth-card .form-help {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 20px;
}

.auth-card .form-help a {
    color: var(--teal);
    text-decoration: none;
    font-weight: 600;
}

/* ==========================================================================
   Messages flash
   ========================================================================== */
.flash {
    margin: 24px auto;
    padding: 14px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    max-width: 800px;
}

.flash-success {
    background: #e6f4ea;
    color: #1e7a3d;
    border: 1px solid #b7e0c3;
}

.flash-error {
    background: #fbe9e8;
    color: var(--red);
    border: 1px solid #f2c2bf;
}

/* ==========================================================================
   Grille de champs de formulaire (2 colonnes à partir de 480px)
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

@media (min-width: 480px) {
    .form-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.form-grid > div {
    margin: 0;
}

/* ==========================================================================
   Paramètres du compte (/compte et /compte/modifier)
   ========================================================================== */
.settings-page {
    max-width: 640px;
    margin: 0 auto;
    padding: 48px 20px 80px;
}

.settings-identity {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
}

.settings-identity-avatar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    font-size: 20px;
    font-weight: 700;
}

.settings-identity-info {
    flex: 1;
    min-width: 0;
}

.settings-identity h1 {
    font-size: 20px;
    color: var(--navy);
    margin-bottom: 2px;
}

.settings-identity p {
    color: var(--text-muted);
    font-size: 14px;
    word-break: break-word;
}

.settings-identity .btn {
    flex-shrink: 0;
}

.settings-back {
    display: inline-block;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--teal);
    text-decoration: none;
}

.settings-back:hover {
    text-decoration: underline;
}

.overview-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

@media (min-width: 560px) {
    .overview-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.overview-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.overview-card h2 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.overview-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--navy);
}

.settings-footer {
    margin-top: 28px;
    text-align: center;
}

/* Onglets en CSS pur : un radio caché (accessible au clavier) par onglet,
   ciblé via ~ pour afficher le bon panneau et surligner le bon label. */
.settings-tab-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.settings-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
}

.settings-tab-label {
    flex: 1;
    text-align: center;
    padding: 18px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.settings-tab-label:hover {
    color: var(--navy);
}

.settings-tab-input:focus-visible ~ .settings-tabs label {
    outline: 2px solid var(--teal);
}

#tab-profile:checked ~ .settings-tabs label[for="tab-profile"],
#tab-security:checked ~ .settings-tabs label[for="tab-security"] {
    color: var(--navy);
    border-color: var(--red);
}

.settings-tab-panel {
    display: none;
    padding: 28px 24px 32px;
}

#tab-profile:checked ~ #panel-profile,
#tab-security:checked ~ #panel-security {
    display: block;
}

.settings-card {
    background: #fff;
    border-radius: var(--radius);
    border-top: 4px solid var(--teal);
    box-shadow: 0 4px 24px rgba(8, 74, 98, 0.08);
    overflow: hidden;
}

.settings-card form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-card label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 6px;
}

.settings-card input[type="email"],
.settings-card input[type="password"],
.settings-card input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.settings-card input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(23, 124, 139, 0.15);
}

.settings-card .help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.settings-card ul {
    list-style: none;
    color: var(--red);
    font-size: 13px;
    margin-top: 4px;
}

.settings-card .btn {
    align-self: flex-start;
}

@media (max-width: 640px) {
    .settings-identity .btn {
        width: 100%;
        order: 1;
        text-align: center;
    }
    .settings-tab-label {
        padding: 14px 8px;
        font-size: 13px;
    }
    .settings-tab-panel {
        padding: 24px 20px 28px;
    }
}
