/* ============================================================
   ECB FLT DASHBOARD — SHARED THEME
   Link this in every HTML page:
   <link rel="stylesheet" href="/css/ecb-theme.css">
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Serif+Display&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
    --blue-dark:    #002d5a;
    --blue-mid:     #004a99;
    --blue-light:   #e8f0fb;
    --accent:       #1a6fc4;
    --surface:      #ffffff;
    --bg:           #f0f4f9;
    --border:       #e2e8f0;
    --text-primary: #0f1c2e;
    --text-muted:   #64748b;
    --text-light:   rgba(255,255,255,0.75);
    --success:      #16a34a;
    --warning:      #d97706;
    --danger:       #dc2626;
    --sidebar-w:    260px;
    --radius-sm:    8px;
    --radius-md:    12px;
    --radius-lg:    16px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md:    0 4px 16px rgba(0,45,90,0.08);
    --shadow-lg:    0 10px 30px rgba(0,45,90,0.12);
    --font:         'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--bg);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
    height: 100vh;
    background: var(--blue-dark);
    color: white;
    position: fixed;
    width: var(--sidebar-w);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

.sidebar-brand {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-text {
    font-size: 0.95rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.01em;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    color: var(--text-light);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.sidebar nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
    padding: 12px 10px 6px;
    margin-top: 8px;
}

.sidebar .nav-link {
    color: var(--text-light);
    padding: 10px 12px;
    margin-bottom: 2px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.sidebar .nav-link i {
    width: 18px;
    text-align: center;
    font-size: 0.875rem;
    opacity: 0.85;
    flex-shrink: 0;
}

.sidebar .nav-link:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.sidebar .nav-link.active {
    color: white !important;
    background: rgba(255,255,255,0.15);
    font-weight: 600;
    box-shadow: inset 3px 0 0 rgba(255,255,255,0.6);
}

.sidebar .nav-link.text-danger {
    color: #fca5a5 !important;
    margin-top: 4px;
}

.sidebar .nav-link.text-danger:hover {
    background: rgba(220,38,38,0.15);
    color: #f87171 !important;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    padding: 32px 36px;
    min-height: 100vh;
}

/* ── Header Banner ──────────────────────────────────────────── */
.header-banner {
    background: var(--blue-dark);
    padding: 18px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.header-banner::before {
    content: '';
    position: absolute;
    top: -40px; right: -40px;
    width: 180px; height: 180px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.header-banner::after {
    content: '';
    position: absolute;
    bottom: -60px; right: 80px;
    width: 220px; height: 220px;
    background: rgba(255,255,255,0.025);
    border-radius: 50%;
}

.logo-container {
    background: white;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.header-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.header-text .page-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    margin: 0;
    letter-spacing: -0.01em;
}

.header-text .sub-title {
    font-size: 1.1rem;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    margin: 0;
}

.header-text .page-subtitle {
    font-size: 0.8rem;
    color: rgba(255,255,255,0.55);
    margin: 4px 0 0;
    font-weight: 400;
}

/* ── Page Title ─────────────────────────────────────────────── */
.page-heading {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.page-subheading {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

/* ── Cards & Containers ─────────────────────────────────────── */
.section-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.section-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    border-left: 3px solid var(--blue-dark);
    padding-left: 12px;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
}

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s ease;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--blue-mid);
    opacity: 0;
    transition: opacity 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: #c7d9f0;
}

.stat-card:hover::after { opacity: 1; }

.icon-box {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 3px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.table {
    font-size: 0.875rem;
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0;
}

.table thead th {
    background: var(--bg);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    border-top: none;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

.table tbody tr:last-child td { border-bottom: none; }

.table-hover tbody tr:hover {
    background: #f8faff;
    cursor: pointer;
}

.table tbody tr:hover td { color: var(--text-primary); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge-qualified {
    background: #dcfce7;
    color: #15803d;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-pending {
    background: #fef9c3;
    color: #854d0e;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-expired {
    background: #fee2e2;
    color: #991b1b;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-notqualified {
    background: #f1f5f9;
    color: #475569;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary {
    background: var(--blue-dark) !important;
    border-color: var(--blue-dark) !important;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: var(--radius-sm) !important;
    padding: 9px 20px !important;
    transition: all 0.15s ease !important;
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: var(--blue-mid) !important;
    border-color: var(--blue-mid) !important;
    box-shadow: 0 4px 12px rgba(0,45,90,0.25) !important;
}

.btn-ecb {
    background: var(--blue-dark);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 20px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    letter-spacing: 0.01em;
}

.btn-ecb:hover {
    background: var(--blue-mid);
    box-shadow: 0 4px 12px rgba(0,45,90,0.25);
    color: white;
}

.btn-ecb-outline {
    background: transparent;
    color: var(--blue-dark);
    border: 1.5px solid var(--blue-dark);
    border-radius: var(--radius-sm);
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.btn-ecb-outline:hover {
    background: var(--blue-light);
}

.search-pill-btn {
    background: var(--blue-dark);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: all 0.15s ease;
}

.search-pill-btn:hover {
    background: var(--blue-mid);
    box-shadow: 0 4px 12px rgba(0,45,90,0.2);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

.form-control, .form-select {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    padding: 9px 13px;
    color: var(--text-primary);
    font-family: var(--font);
    transition: border-color 0.15s, box-shadow 0.15s;
    background-color: #fafbfc;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26,111,196,0.12);
    outline: none;
    background-color: white;
}

/* ── Search Box ─────────────────────────────────────────────── */
.search-box {
    display: flex;
    align-items: center;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 4px 4px 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
    gap: 8px;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26,111,196,0.1);
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-family: var(--font);
    flex: 1;
    min-width: 0;
}

.search-box input::placeholder { color: var(--text-muted); }

/* ── Tabs ───────────────────────────────────────────────────── */
.nav-tabs {
    border: none;
    gap: 4px;
    margin-bottom: 24px;
}

.nav-tabs .nav-link {
    border: none !important;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 8px 18px;
    border-radius: 20px;
    transition: all 0.15s;
    background: transparent;
}

.nav-tabs .nav-link:hover {
    color: var(--text-primary);
    background: var(--border);
}

.nav-tabs .nav-link.active {
    background: var(--blue-dark) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0,45,90,0.2);
}

.nav-pills .nav-link {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 8px 20px;
    border-radius: 20px;
    transition: all 0.15s;
}

.nav-pills .nav-link.active {
    background: var(--blue-mid) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0,74,153,0.25);
}

/* ── Alerts ─────────────────────────────────────────────────── */
.alert {
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 12px 16px;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-left: 4px solid #22c55e;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid #f59e0b;
}

/* ── Divider ────────────────────────────────────────────────── */
.ecb-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ── Utility ────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.text-blue { color: var(--blue-dark); }
.bg-blue-light { background: var(--blue-light); }

/* ── Inactivity / Session timer ─────────────────────────────── */
#session-warning {
    position: fixed;
    bottom: 20px; right: 20px;
    background: #1e293b;
    color: white;
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    display: none;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
}

/* ============================================================
   RESPONSIVE — Mobile & Tablet + Sidebar User Email
   ============================================================ */

/* ── Hamburger Toggle Button ────────────────────────────────── */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1100;
    background: var(--blue-dark);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background 0.15s;
}
.sidebar-toggle:hover { background: var(--blue-mid); }

/* Dim overlay behind open sidebar on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1049;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Sidebar user block (replaces plain title) ──────────────── */
.sidebar-user {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
    font-weight: 700;
    text-transform: uppercase;
}

.sidebar-user-info { overflow: hidden; }

.sidebar-user-label {
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    line-height: 1;
    margin-bottom: 3px;
}

.sidebar-user-email {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

/* ── Tablet (sidebar hidden, hamburger shown) ───────────────── */
@media (max-width: 991px) {
    .sidebar-toggle { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1050;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0 !important;
        padding: 20px 16px;
    }

    .header-banner {
        padding: 14px 16px 14px 56px;
        margin-top: 0;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-logo { height: 46px; }
    .header-text .sub-title  { font-size: 0.95rem; }
    .header-text .page-title { font-size: 1rem; }
}

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 575px) {
    .main-content { padding: 12px 10px; }

    .header-banner {
        padding: 10px 10px 10px 52px;
        border-radius: var(--radius-md);
        gap: 6px;
    }

    .logo-container { padding: 5px 8px; }
    .header-logo { height: 36px; }

    .header-text .sub-title  { font-size: 0.78rem; }
    .header-text .page-title { font-size: 0.88rem; }

    .stat-card { padding: 12px 14px; }
    .stat-value { font-size: 1.25rem; }
    .section-container { padding: 16px 12px; }
}