/* ══════════════════════════════════════════════════════════════════
   COCKPIT NATIONAL, VISAS CSC/CA & BAILLEURS INTERNATIONAUX
   Theme-aware: Supports both Dark (default) and Light mode
   ══════════════════════════════════════════════════════════════════ */

.national-cockpit-container {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Cockpit Header & Actions ─────────────────────────────────── */
.national-cockpit-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.national-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Filter Toolbar ────────────────────────────────────────────── */
.national-filter-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    flex-wrap: wrap;
    box-shadow: var(--card-shadow);
}

.national-filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.national-filter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.national-filter-item label {
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.national-filter-item select {
    background: var(--surface-1);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    min-width: 180px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.national-filter-item select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px var(--focus-ring);
}

:root[data-theme="light"] .national-filter-item select {
    background: #ffffff;
    border-color: #cbd5e1;
    color: #0f172a;
}

/* ── KPI Grid ─────────────────────────────────────────────────── */
.national-kpis-grid,
.national-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.national-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.national-kpi-card:hover {
    border-color: var(--line-strong);
    transform: translateY(-1px);
}

.national-kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--kpi-accent, var(--primary, #10b981));
}

.national-kpi-card.kpi-accent-blue::before { background: #3b82f6; }
.national-kpi-card.kpi-accent-amber::before { background: #f59e0b; }
.national-kpi-card.kpi-accent-purple::before { background: #8b5cf6; }
.national-kpi-card.kpi-accent-teal::before { background: #14b8a6; }
.national-kpi-card.kpi-accent-rose::before { background: #f43f5e; }

:root[data-theme="light"] .national-kpi-card.kpi-accent-blue::before { background: #2563eb; }
:root[data-theme="light"] .national-kpi-card.kpi-accent-amber::before { background: #d97706; }
:root[data-theme="light"] .national-kpi-card.kpi-accent-purple::before { background: #7c3aed; }
:root[data-theme="light"] .national-kpi-card.kpi-accent-teal::before { background: #059669; }
:root[data-theme="light"] .national-kpi-card.kpi-accent-rose::before { background: #e11d48; }

.national-kpi-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.national-kpi-label {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.national-kpi-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

:root[data-theme="light"] .national-kpi-card {
    background: #ffffff;
    border-color: #e2e8f0;
}

/* ── National Pipeline Stepper ────────────────────────────────── */
.national-pipeline-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--card-shadow);
}

.national-pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.national-pipeline-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pipeline-stepper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
}

.pipeline-stage-card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

:root[data-theme="light"] .pipeline-stage-card {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.pipeline-stage-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

:root[data-theme="light"] .pipeline-stage-card:hover {
    background: #ffffff;
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.pipeline-stage-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pipeline-stage-order {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.pipeline-stage-badge {
    background: var(--accent-weak);
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 12px;
}

:root[data-theme="light"] .pipeline-stage-badge {
    background: #e0f2fe;
    color: #0369a1;
}

.pipeline-stage-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pipeline-stage-samples {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--border-color);
    padding-top: 0.45rem;
}

.pipeline-sample-item {
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    cursor: pointer;
    padding: 0.15rem 0;
    transition: color 0.15s ease;
}

.pipeline-sample-item:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* ── Section Card & Panels Layout ─────────────────────────────── */
.national-section-card,
.national-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: var(--card-shadow);
}

:root[data-theme="light"] .national-section-card,
:root[data-theme="light"] .national-panel {
    background: #ffffff;
    border-color: #e2e8f0;
}

.national-section-header,
.national-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.national-section-header h3,
.national-panel-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Review Drawer (Tiroir d'Instruction CNMP) ────────────────── */
.national-drawer-backdrop,
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.national-drawer-backdrop.open,
.national-drawer-backdrop.active,
.drawer-backdrop.open,
.drawer-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.national-review-drawer,
.national-drawer {
    position: fixed;
    top: 0;
    right: -660px;
    width: 600px;
    max-width: 95vw;
    height: 100vh;
    background: var(--bg-card);
    border-left: 1px solid var(--border-color);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    transition: right 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

:root[data-theme="light"] .national-review-drawer,
:root[data-theme="light"] .national-drawer {
    background: #ffffff;
    border-left-color: #cbd5e1;
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.15);
}

.national-review-drawer.open,
.national-review-drawer.active,
.national-drawer.open,
.national-drawer.active {
    right: 0;
}

.drawer-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: var(--surface-1);
}

:root[data-theme="light"] .drawer-header {
    background: #f8fafc;
    border-bottom-color: #e2e8f0;
}

.drawer-header-info {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.drawer-header-ref {
    font-family: monospace;
    font-weight: 700;
    color: var(--accent);
    font-size: 0.95rem;
}

:root[data-theme="light"] .drawer-header-ref {
    color: #0369a1;
}

.drawer-header-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.drawer-header-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.drawer-close-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    user-select: none;
}

.drawer-close-btn:hover {
    color: var(--text-primary);
    background: var(--line);
    border-color: var(--border-color);
}

:root[data-theme="light"] .drawer-close-btn {
    color: #64748b;
}

:root[data-theme="light"] .drawer-close-btn:hover {
    color: #0f172a;
    background: #e2e8f0;
    border-color: #cbd5e1;
}

.drawer-close-btn:active {
    transform: scale(0.92);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    background: var(--bg-card);
}

:root[data-theme="light"] .drawer-body {
    background: #ffffff;
}

.drawer-card {
    background: var(--surface-1);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

:root[data-theme="light"] .drawer-card {
    background: #f8fafc;
    border-color: #e2e8f0;
}

.drawer-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.45rem;
}

:root[data-theme="light"] .drawer-card-title {
    color: #475569;
    border-bottom-color: #e2e8f0;
}

.compliance-checklist {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.compliance-item {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    line-height: 1.35;
}

:root[data-theme="light"] .compliance-item {
    color: #1e293b;
}

.compliance-item input[type="checkbox"] {
    margin-top: 0.15rem;
    cursor: pointer;
}

.drawer-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-1);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

:root[data-theme="light"] .drawer-footer {
    background: #f8fafc;
    border-top-color: #e2e8f0;
}

/* ── Light Mode Form Inputs & Selects inside Drawers/Cards ─────── */
:root[data-theme="light"] .drawer-card select,
:root[data-theme="light"] .drawer-card textarea,
:root[data-theme="light"] .drawer-card input[type="text"] {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

:root[data-theme="light"] .drawer-card select:focus,
:root[data-theme="light"] .drawer-card textarea:focus,
:root[data-theme="light"] .drawer-card input[type="text"]:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px var(--focus-ring);
}

/* ── Institution Chart Legend / Description ──────────────────── */
.national-institution-legend {
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

:root[data-theme="light"] .national-institution-legend {
    border-top-color: #e2e8f0;
}

.national-institution-legend-header {
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

:root[data-theme="light"] .national-institution-legend-header {
    color: #64748b;
}

.national-institution-legend-grid {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.institution-legend-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.84rem;
    line-height: 1.4;
    padding: 0.25rem 0.4rem;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.institution-legend-item:hover {
    background: var(--line);
}

:root[data-theme="light"] .institution-legend-item:hover {
    background: #f1f5f9;
}

.institution-legend-sigle {
    font-family: monospace;
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--accent);
    background: var(--surface-1);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    min-width: 65px;
    text-align: center;
    flex-shrink: 0;
}

:root[data-theme="light"] .institution-legend-sigle {
    background: #f1f5f9;
    color: #0369a1;
    border-color: #cbd5e1;
}

.institution-legend-sep {
    color: var(--text-secondary);
    flex-shrink: 0;
}

.institution-legend-name {
    color: var(--text-primary);
    flex: 1;
}

:root[data-theme="light"] .institution-legend-name {
    color: #1e293b;
}

.institution-legend-count {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    margin-left: auto;
}

:root[data-theme="light"] .institution-legend-count {
    color: #64748b;
}
