:root {
    --primary: #0A58A8;
    --primary-dark: #073E77;
    --cyan: #06B6D4;
    --cyan-light: #38BDF8;
    --dark: #0F172A;
    --dark-navy: #091322;
    --light-bg: #F8FAFC;
    --card-bg: #FFFFFF;
    --border: #E2E8F0;
    --text: #334155;
    --success: #16A34A;
    --warning: #F59E0B;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Plus Jakarta Sans', sans-serif; background-color: var(--light-bg); color: var(--text); line-height: 1.5; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* Header Sombre & Mascotte Transparente */
.navbar { background: var(--dark-navy); color: white; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25); }
.nav-container { display: flex; justify-content: space-between; align-items: center; }

.brand { display: flex; align-items: center; gap: 14px; }
.nav-mascot-img { height: 44px; width: auto; object-fit: contain; filter: drop-shadow(0 2px 8px rgba(6, 182, 212, 0.4)); }
.brand-text-nav { display: flex; flex-direction: column; }
.brand-title-nav { font-family: 'Outfit', sans-serif; font-size: 1.35rem; font-weight: 800; color: #FFFFFF; line-height: 1.1; letter-spacing: -0.3px; }
.brand-title-nav span { background: linear-gradient(135deg, var(--cyan-light), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.brand-tagline-nav { font-size: 0.68rem; color: #94A3B8; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; margin-top: 1px; }

.portal-badge { background: rgba(56, 189, 248, 0.12); color: #38BDF8; font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 0.82rem; letter-spacing: 1.5px; border: 1px solid rgba(56, 189, 248, 0.35); border-radius: 6px; padding: 3px 10px; margin-left: 6px; }

.nav-right { display: flex; align-items: center; gap: 10px; }
.user-chip { background: rgba(255, 255, 255, 0.1); color: white; padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 8px; }
.user-chip-admin { background: #F59E0B; color: #78350F; font-weight: 700; }
.btn-outline-ninja { background: rgba(255, 255, 255, 0.1); color: #38BDF8; border: 1px solid rgba(56, 189, 248, 0.4); }
.btn-outline-ninja:hover { background: #38BDF8; color: #0F172A; }
.btn-logout { background: rgba(239, 68, 68, 0.15); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-logout:hover { background: #EF4444; color: white; }

/* Login Overlay - Sombre Haut de Gamme */
.login-overlay { position: fixed; inset: 0; background: radial-gradient(circle at center, #0F1C34 0%, #060B16 100%); backdrop-filter: blur(12px); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { background: #0F172A; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 18px; width: 100%; max-width: 420px; padding: 40px 32px; box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 45px rgba(6, 182, 212, 0.18); color: #F1F5F9; }

.login-brand { text-align: center; margin-bottom: 28px; }
.brand-header-flex { display: flex; align-items: center; justify-content: center; gap: 14px; }
.brand-mascot-img-login { height: 60px; width: auto; object-fit: contain; filter: drop-shadow(0 4px 14px rgba(6, 182, 212, 0.45)); }
.brand-text-login { text-align: left; }
.brand-title-login { font-family: 'Outfit', sans-serif; font-size: 1.6rem; font-weight: 800; color: #FFFFFF; line-height: 1.1; }
.brand-title-login span { background: linear-gradient(135deg, var(--cyan-light), var(--cyan)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.brand-tagline-login { font-size: 0.72rem; color: #94A3B8; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; margin-top: 2px; }

.portal-badge-login { background: rgba(56, 189, 248, 0.12); color: #38BDF8; font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 0.92rem; letter-spacing: 2px; text-transform: uppercase; border: 1px solid rgba(56, 189, 248, 0.35); border-radius: 8px; padding: 5px 20px; margin-top: 16px; display: inline-block; }

.login-box .form-label { color: #CBD5E1; font-weight: 600; margin-bottom: 8px; font-size: 0.88rem; display: block; }
.login-box .form-control { background: #182746; border: 1px solid #2A3C61; color: #FFFFFF; padding: 12px 14px; border-radius: 8px; width: 100%; font-size: 0.95rem; }
.login-box .form-control:focus { outline: none; border-color: #38BDF8; box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25); }
.login-error { background: rgba(239, 68, 68, 0.2); color: #FCA5A5; border: 1px solid rgba(239, 68, 68, 0.4); padding: 10px 14px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; margin-bottom: 14px; text-align: center; }

/* Tabs */
.tabs { display: flex; gap: 12px; margin: 26px 0 20px; }
.tab-btn { background: #E2E8F0; border: none; padding: 12px 22px; border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--text); font-family: 'Outfit', sans-serif; font-size: 0.95rem; transition: 0.2s; display: flex; align-items: center; gap: 8px; }
.tab-btn:hover { background: #CBD5E1; }
.tab-btn.active { background: var(--primary); color: white; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Cards & Layout */
.card { background: var(--card-bg); border-radius: 12px; border: 1px solid var(--border); padding: 30px; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); margin-bottom: 30px; }
.card-header { margin-bottom: 24px; }
.card-header h2 { font-family: 'Outfit', sans-serif; font-size: 1.35rem; color: var(--dark); display: flex; align-items: center; gap: 10px; }
.text-muted { color: #64748B; font-size: 0.9rem; margin-top: 4px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 2fr 1fr 1fr; }
@media(max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.form-group { margin-bottom: 18px; }
.form-label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 0.9rem; color: var(--dark); }
.form-control { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; font-family: inherit; transition: 0.2s; background: white; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(10, 88, 168, 0.15); }

/* Checkbox Cards */
.checkbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-top: 6px; }
.checkbox-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border: 2px solid var(--border); border-radius: 8px; cursor: pointer; transition: 0.2s; background: #FAFAFA; }
.checkbox-card:hover { border-color: #CBD5E1; background: white; }
.checkbox-card.checked { border-color: var(--primary); background: #EFF6FF; }
.checkbox-card input { width: 18px; height: 18px; accent-color: var(--primary); }
.cb-icon { font-size: 1.4rem; color: var(--primary); width: 32px; text-align: center; }
.checkbox-card strong { display: block; font-size: 0.95rem; color: var(--dark); }
.checkbox-card p { font-size: 0.78rem; color: #64748B; margin-top: 2px; }

/* Dropzone */
.dropzone { border: 2px dashed #94A3B8; border-radius: 10px; padding: 30px 20px; text-align: center; background: #F8FAFC; cursor: pointer; transition: 0.2s; }
.dropzone:hover { border-color: var(--primary); background: #F0F7FF; }
.drop-icon { font-size: 2.2rem; color: #64748B; margin-bottom: 8px; }
.file-tags { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.file-tag { background: #E0F2FE; color: var(--primary); padding: 4px 10px; border-radius: 4px; font-size: 0.8rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }

/* Buttons */
.btn { padding: 11px 22px; border-radius: 8px; font-weight: 700; cursor: pointer; border: none; font-family: 'Outfit', sans-serif; font-size: 0.95rem; transition: 0.2s; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* Admin Validation Buttons */
.btn-validate { background: #16A34A; color: white; padding: 6px 12px; font-size: 0.82rem; border-radius: 6px; }
.btn-validate:hover { background: #15803D; }
.btn-edit-ninja { background: #0284C7; color: white; padding: 6px 12px; font-size: 0.82rem; border-radius: 6px; }
.btn-edit-ninja:hover { background: #0369A1; }

/* Table */
.table-responsive { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th { background: #F1F5F9; padding: 12px 14px; text-align: left; font-weight: 700; color: #475569; border-bottom: 2px solid var(--border); }
.table td { padding: 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.badge { display: inline-block; padding: 4px 10px; border-radius: 20px; font-size: 0.78rem; font-weight: 700; }
.badge-pending { background: #FEF3C7; color: #B45309; }
.badge-success { background: #DCFCE7; color: #15803D; }

/* Modal */
.modal { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.7); backdrop-filter: blur(4px); z-index: 999; align-items: center; justify-content: center; }
.modal-content { background: white; border-radius: 12px; width: 90%; max-width: 800px; max-height: 85vh; overflow-y: auto; padding: 26px; }
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 16px; }
.close { font-size: 1.8rem; cursor: pointer; color: #64748B; }
pre { background: #F1F5F9; padding: 14px; border-radius: 8px; font-size: 0.85rem; overflow-x: auto; white-space: pre-wrap; font-family: monospace; }

.btn-plan-view { background: #0284C7; color: white !important; font-weight: 700; border-radius: 6px; padding: 6px 12px; font-size: 0.82rem; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn-plan-view:hover { background: #0369A1; }


/* =======================================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS (TABLETS & SMARTPHONES)
   ======================================================= */
@media (max-width: 860px) {
    .container { padding: 0 14px; }
    .navbar { padding: 10px 0; }
    .nav-container { flex-direction: column; gap: 10px; align-items: stretch; }
    .brand { justify-content: space-between; width: 100%; }
    .nav-right { justify-content: flex-end; width: 100%; gap: 6px; flex-wrap: wrap; }
    .brand-title-nav { font-size: 1.15rem; }
    .nav-mascot-img { height: 36px; }
    .btn-outline-ninja, .btn-logout { font-size: 0.75rem; padding: 5px 10px; }
    .user-chip { font-size: 0.75rem; padding: 4px 10px; }

    .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 16px 0 14px; }
    .tab-btn { justify-content: center; padding: 10px 8px; font-size: 0.85rem; }

    .card { padding: 18px 14px; margin-bottom: 20px; border-radius: 10px; }
    .card-header h2 { font-size: 1.15rem; }
    
    .grid-2, .grid-3 { grid-template-columns: 1fr !important; gap: 12px; }
    .checkbox-grid { grid-template-columns: 1fr !important; }
    .dropzone { padding: 20px 10px; }

    /* Modal Mobile */
    .modal-content { width: 95%; max-height: 90vh; padding: 18px 14px; border-radius: 10px; }
    .login-box { padding: 26px 18px; max-width: 95%; }
    .brand-mascot-img-login { height: 48px; }
    .brand-title-login { font-size: 1.35rem; }

    /* Conversion Tableau -> Cartes Mobiles */
    .table-responsive { overflow-x: visible; }
    .table-responsive table, 
    .table-responsive thead, 
    .table-responsive tbody, 
    .table-responsive th, 
    .table-responsive td, 
    .table-responsive tr { 
        display: block; 
    }
    .table-responsive thead tr { 
        position: absolute; 
        top: -9999px; 
        left: -9999px; 
    }
    .table-responsive tr { 
        border: 1px solid #E2E8F0; 
        border-radius: 12px; 
        margin-bottom: 14px; 
        padding: 14px; 
        background: #FFFFFF; 
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04); 
    }
    .table-responsive td { 
        border: none; 
        padding: 6px 0; 
        display: flex; 
        justify-content: space-between; 
        align-items: center; 
        font-size: 0.88rem; 
        text-align: right; 
    }
    .table-responsive td:before { 
        content: attr(data-label); 
        font-weight: 700; 
        color: #64748B; 
        font-size: 0.8rem; 
        text-transform: uppercase; 
        margin-right: 12px; 
        text-align: left; 
    }
    .table-responsive td:last-child { 
        margin-top: 10px; 
        padding-top: 10px; 
        border-top: 1px dashed #E2E8F0; 
        justify-content: flex-end; 
    }
    .table-responsive td:last-child:before { 
        display: none; 
    }
    .table-responsive td:last-child > div { 
        width: 100%; 
        display: grid !important; 
        grid-template-columns: 1fr 1fr; 
        gap: 6px; 
    }
    .table-responsive td:last-child .btn { 
        justify-content: center; 
        padding: 8px 10px; 
        font-size: 0.8rem; 
    }
}
