/* ============================================================
   app.css — Styles personnalisés e-État Civil v2.0
   Commune de Cocody — Couleurs officielles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Fraunces:wght@600;700;900&display=swap');

/* ============================================================
   VARIABLES CSS — COULEURS OFFICIELLES MAIRIE DE COCODY
   ============================================================ */
:root {
    /* Bleu officiel Cocody */
    --color-primary:        #1e4fa3;
    --color-primary-dark:   #163d82;
    --color-primary-light:  #dce8f8;
    --color-primary-xlight: #eef4fc;

    /* Vert officiel Cocody */
    --color-green:          #2e7d32;
    --color-green-dark:     #1b5e20;
    --color-green-light:    #c8e6c9;

    /* Noir texte Cocody */
    --color-dark:           #1a1a1a;

    /* États */
    --color-success:        #2e7d32;
    --color-warning:        #f59e0b;
    --color-danger:         #dc2626;
    --color-info:           #1e4fa3;

    /* Neutres */
    --color-bg:             #f5f7fb;
    --color-surface:        #ffffff;
    --color-border:         #e2e8f0;
    --color-text:           #1a1a1a;
    --color-text-muted:     #64748b;

    /* Typographie */
    --font-body:    'Plus Jakarta Sans', sans-serif;
    --font-display: 'Fraunces', serif;

    /* Ombres */
    --shadow-sm:   0 1px 3px rgba(30,79,163,0.08);
    --shadow-md:   0 4px 16px rgba(30,79,163,0.10);
    --shadow-lg:   0 8px 32px rgba(30,79,163,0.12);
    --shadow-card: 0 2px 8px rgba(30,79,163,0.08);

    /* Rayons */
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --radius-xl:  24px;

    /* Transitions */
    --transition: all 0.2s ease;
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ============================================================
   TYPOGRAPHIE
   ============================================================ */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-dark);
}

h4, h5, h6 {
    font-family: var(--font-body);
    font-weight: 600;
    line-height: 1.3;
}

/* ============================================================
   BOUTONS
   ============================================================ */

/* Bouton principal — Bleu Cocody */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    color: #fff;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 15px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(30,79,163,0.35);
    width: 100%;
    min-height: 52px;
    letter-spacing: 0.2px;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-dark), #0f2d61);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(30,79,163,0.45);
}

.btn-primary:active  { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Bouton secondaire — Contour bleu */
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 24px;
    background: transparent;
    color: var(--color-primary);
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 15px;
    border-radius: var(--radius-md);
    border: 2px solid var(--color-primary);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    width: 100%;
    min-height: 52px;
}

.btn-secondary:hover { background: var(--color-primary-xlight); }

/* Bouton vert (succès / validation) */
.btn-success {
    background: linear-gradient(135deg, var(--color-green), var(--color-green-dark));
    box-shadow: 0 4px 14px rgba(46,125,50,0.30);
}
.btn-success:hover {
    background: linear-gradient(135deg, var(--color-green-dark), #1b5e20);
}

/* Bouton danger */
.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 14px rgba(220,38,38,0.28);
}
.btn-danger:hover { background: linear-gradient(135deg, #b91c1c, #991b1b); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-primary-xlight);
}

.card-body { padding: 24px; }

/* Stat card dashboard */
.stat-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-green));
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 32px;
    font-weight: 900;
    color: var(--color-primary);
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ============================================================
   FORMULAIRES
   ============================================================ */
.input-field {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--color-text);
    background: #f8fafc;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: var(--transition);
    outline: none;
    min-height: 52px;
}

.input-field:focus {
    border-color: var(--color-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(30,79,163,0.10);
}

.input-field::placeholder { color: #94a3b8; }
.input-field.error {
    border-color: var(--color-danger);
    box-shadow: 0 0 0 4px rgba(220,38,38,0.08);
}

.input-label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
    margin-bottom: 8px;
}

.input-label .required { color: var(--color-danger); margin-left: 3px; }

/* ============================================================
   BADGES ÉTAT
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.badge-attente  { background: #fef9c3; color: #92400e; }
.badge-traite   { background: var(--color-green-light); color: var(--color-green-dark); }
.badge-rejete   { background: #fee2e2; color: #991b1b; }
.badge-en-cours { background: var(--color-primary-light); color: var(--color-primary-dark); }

/* ============================================================
   ALERTES
   ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.alert-success { background: var(--color-green-light); color: var(--color-green-dark); border: 1px solid #a5d6a7; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef9c3; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--color-primary-light); color: var(--color-primary-dark); border: 1px solid #bfdbfe; }

/* ============================================================
   OTP INPUT
   ============================================================ */
.otp-container {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 24px 0;
}

.otp-input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    font-family: var(--font-body);
    color: var(--color-text);
    background: #f8fafc;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    outline: none;
    transition: var(--transition);
    caret-color: var(--color-primary);
}

.otp-input:focus {
    border-color: var(--color-primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(30,79,163,0.10);
    transform: scale(1.05);
}

.otp-input.filled {
    border-color: var(--color-primary);
    background: var(--color-primary-xlight);
    color: var(--color-primary);
}

/* ============================================================
   LOADER
   ============================================================ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   TIMER OTP
   ============================================================ */
.otp-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--color-text-muted);
    font-size: 14px;
    margin: 12px 0;
}

.otp-timer .time {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: center;
}

.otp-timer .time.urgent {
    color: var(--color-danger);
    animation: pulse-text 1s ease-in-out infinite;
}

@keyframes pulse-text {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ============================================================
   LOGO MAIRIE
   ============================================================ */
.logo-mairie {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-mairie img {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.logo-mairie-sm img { height: 36px; }
.logo-mairie-lg img { height: 64px; }

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-text-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 900;
    color: var(--color-primary);
    line-height: 1;
    letter-spacing: -0.3px;
}

.logo-text-sub {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Version blanche (sidebar admin sombre) */
.logo-mairie.white .logo-text-title { color: #fff; }
.logo-mairie.white .logo-text-sub   { color: rgba(255,255,255,0.5); }

/* ============================================================
   PAGE AUTH (login, otp, inscription)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    background:
        linear-gradient(145deg,
            #1e4fa3 0%,
            #163d82 25%,
            #0d2d6b 50%,
            #1a5c2a 75%,
            #1e4fa3 100%);
    background-size: 400% 400%;
    animation: gradientShift 12s ease infinite;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
}

@keyframes gradientShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Motif de points */
.auth-dots {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(rgba(255,255,255,0.08) 1.5px, transparent 1.5px);
    background-size: 28px 28px;
    pointer-events: none;
    z-index: 0;
}

/* Cercle décoratif haut droite — bleu clair */
.auth-circle-1 {
    position: absolute;
    top: -100px; right: -80px;
    width: 350px; height: 350px;
    background: radial-gradient(circle,
        rgba(255,255,255,0.07) 0%,
        transparent 65%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatCircle 9s ease-in-out infinite;
    z-index: 0;
}

/* Cercle décoratif bas gauche — vert */
.auth-circle-2 {
    position: absolute;
    bottom: -80px; left: -60px;
    width: 300px; height: 300px;
    background: radial-gradient(circle,
        rgba(46,125,50,0.18) 0%,
        transparent 65%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatCircle 11s ease-in-out infinite reverse;
    z-index: 0;
}

/* Cercle décoratif milieu */
.auth-circle-3 {
    position: absolute;
    top: 40%; left: -100px;
    width: 250px; height: 250px;
    background: radial-gradient(circle,
        rgba(255,255,255,0.04) 0%,
        transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: floatCircle 14s ease-in-out infinite;
    z-index: 0;
}

@keyframes floatCircle {
    0%, 100% { transform: translateY(0) scale(1); }
    50%       { transform: translateY(-25px) scale(1.06); }
}

/* Vague bas */
.auth-wave {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 150px;
    background: linear-gradient(to top,
        rgba(46,125,50,0.15),
        transparent);
    pointer-events: none;
    z-index: 0;
}

/* Ligne décorative diagonale */
.auth-line {
    position: absolute;
    top: 0; right: 80px;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom,
        transparent,
        rgba(255,255,255,0.06) 30%,
        rgba(255,255,255,0.06) 70%,
        transparent);
    pointer-events: none;
    z-index: 0;
}
.auth-line-2 {
    position: absolute;
    top: 0; left: 120px;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom,
        transparent,
        rgba(46,125,50,0.10) 40%,
        rgba(46,125,50,0.10) 60%,
        transparent);
    pointer-events: none;
    z-index: 0;
}

.auth-card {
    background: rgba(255,255,255,0.97);
    border-radius: var(--radius-xl);
    box-shadow:
        0 24px 80px rgba(0,0,0,0.3),
        0 4px 16px rgba(0,0,0,0.15);
    padding: 32px 28px;
    width: 100%;
    max-width: 420px;
    margin: auto;
    border: 1px solid rgba(255,255,255,0.9);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

/* Bande couleur en haut de la card auth */
.auth-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-green));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* ============================================================
   STEPPER DEMANDE
   ============================================================ */
.stepper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}

.stepper::before {
    content: '';
    position: absolute;
    top: 20px; left: 30px; right: 30px;
    height: 2px;
    background: var(--color-border);
    z-index: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    position: relative;
    z-index: 1;
}

.step-circle {
    width: 40px; height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    background: #fff;
    border: 2px solid var(--color-border);
    color: var(--color-text-muted);
    transition: var(--transition);
}

.step.active .step-circle {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
    box-shadow: 0 0 0 4px rgba(30,79,163,0.15);
}

.step.done .step-circle {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.step-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-align: center;
    max-width: 70px;
}

.step.active .step-label { color: var(--color-primary); }

/* ============================================================
   TIMELINE SUIVI DEMANDE
   ============================================================ */
.timeline {
    position: relative;
    padding-left: 32px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px; top: 8px; bottom: 8px;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -32px; top: 4px;
    width: 24px; height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    border: 2px solid #fff;
    box-shadow: var(--shadow-sm);
}

.timeline-dot.attente  { background: #fef9c3; }
.timeline-dot.traite   { background: var(--color-green-light); }
.timeline-dot.rejete   { background: #fee2e2; }
.timeline-dot.en-cours { background: var(--color-primary-light); }

.timeline-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.timeline-date {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

/* ============================================================
   NAVIGATION MOBILE (BOTTOM NAV)
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 max(8px, env(safe-area-inset-bottom));
    z-index: 50;
    box-shadow: 0 -4px 20px rgba(30,79,163,0.08);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 6px 16px;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: var(--transition);
    border-radius: var(--radius-sm);
    min-width: 60px;
}

.bottom-nav-item.active,
.bottom-nav-item:hover { color: var(--color-primary); }

.bottom-nav-item svg { width: 22px; height: 22px; }

.bottom-nav-label {
    font-size: 11px;
    font-weight: 600;
}

/* Bouton central demande */
.bottom-nav-center {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(30,79,163,0.35);
    margin-top: -8px;
    transition: var(--transition);
}

.bottom-nav-center:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30,79,163,0.45);
}

/* Badge notification */
.nav-badge {
    position: absolute;
    top: -4px; right: -4px;
    background: var(--color-danger);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

/* ============================================================
   HEADER PUBLIC
   ============================================================ */
.public-header {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 2px 8px rgba(30,79,163,0.06);
    position: sticky;
    top: 0;
    z-index: 40;
}

/* ============================================================
   SIDEBAR ADMIN
   ============================================================ */
.admin-sidebar {
    background: linear-gradient(180deg, #0d1f45 0%, #0a1628 100%);
    width: 260px;
    min-height: 100vh;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 40;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.admin-sidebar::-webkit-scrollbar { width: 4px; }
.admin-sidebar::-webkit-scrollbar-thumb {
    background: rgba(30,79,163,0.4);
    border-radius: 2px;
}

.admin-content {
    margin-left: 260px;
    min-height: 100vh;
    background: #f5f7fb;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 20px;
    color: rgba(255,255,255,0.55);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    margin: 2px 12px;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: rgba(255,255,255,0.9);
}

.nav-item.active {
    background: linear-gradient(135deg,
        rgba(30,79,163,0.25),
        rgba(30,79,163,0.15));
    color: #93c5fd;
    border-left: 3px solid var(--color-primary);
    padding-left: 17px;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
    padding: 16px 20px 6px;
}

/* Topbar admin */
.admin-topbar {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 2px 8px rgba(30,79,163,0.06);
}

/* Mobile sidebar */
@media (max-width: 1024px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 40px rgba(0,0,0,0.5);
    }
    .admin-content { margin-left: 0; }
}

/* ============================================================
   DIVIDER
   ============================================================ */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}

.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

.divider-text {
    font-size: 12px;
    color: var(--color-text-muted);
    white-space: nowrap;
    font-weight: 500;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-fade-up { animation: fadeInUp 0.4s ease both; }
.animate-delay-1 { animation-delay: 0.1s; }
.animate-delay-2 { animation-delay: 0.2s; }
.animate-delay-3 { animation-delay: 0.3s; }
.animate-delay-4 { animation-delay: 0.4s; }

/* ============================================================
   UTILITAIRES
   ============================================================ */
.text-primary  { color: var(--color-primary) !important; }
.text-green    { color: var(--color-green) !important; }
.text-muted    { color: var(--color-text-muted) !important; }
.bg-primary    { background-color: var(--color-primary) !important; }
.pb-nav        { padding-bottom: 80px; }

/* ============================================================
   RESPONSIVE DESKTOP
   ============================================================ */
@media (min-width: 768px) {
    body { font-size: 16px; }
    .auth-card { padding: 48px 40px; }
    .otp-input { width: 60px; height: 70px; font-size: 28px; }
    .btn-primary, .btn-secondary { width: auto; min-width: 180px; }
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    .bottom-nav, .btn-primary, .btn-secondary,
    .admin-sidebar, .admin-topbar { display: none !important; }
    .admin-content { margin-left: 0 !important; }
}
