/* CTAPRO Feature Reference — Stylesheet v2 (polished) */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --navy: #0F2640;
    --navy-mid: #1A3A5C;
    --blue: #2878B5;
    --blue-light: #3D9BE9;
    --orange: #E8792B;
    --orange-glow: #F59E4A;
    --lt-blue: #E1ECF7;
    --bg: #F4F7FA;
    --bg-warm: #FAFBFD;
    --text: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --sidebar-w: 270px;
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(15,38,64,0.06), 0 1px 2px rgba(15,38,64,0.04);
    --shadow-md: 0 4px 12px rgba(15,38,64,0.08), 0 2px 4px rgba(15,38,64,0.04);
    --shadow-lg: 0 10px 30px rgba(15,38,64,0.12), 0 4px 8px rgba(15,38,64,0.06);
    --font: -apple-system, BlinkMacSystemFont, t('d4_segoe_ui', 'Segoe UI'), 'Helvetica Neue', Arial, sans-serif;
    --font-mono: t('d4_courier_new', 'Courier New'), monospace;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.65;
    display: flex;
    min-height: 100vh;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* ── SIDEBAR ─────────────────────────────────────── */

.sidebar {
    width: var(--sidebar-w);
    min-height: 100vh;
    background: linear-gradient(180deg, #0A1D33 0%, var(--navy) 40%, #0F2640 100%);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid rgba(255,255,255,0.05);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }

.sidebar-logo {
    padding: 24px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
}
.sidebar-logo img {
    width: 100%;
    max-width: 190px;
    height: auto;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.sidebar-search {
    padding: 14px 16px;
}
.sidebar-search input {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-family: var(--font);
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7F99' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.868-3.834zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
}
.sidebar-search input::placeholder { color: #5A7089; }
.sidebar-search input:focus {
    border-color: var(--orange);
    background-color: rgba(255,255,255,0.1);
    box-shadow: 0 0 0 3px rgba(232,121,43,0.15);
}

.sidebar-nav {
    flex: 1;
    padding: 6px 8px;
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 14px;
    color: #94A3B8;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s ease;
    border-radius: 8px;
    margin: 1px 0;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background: rgba(255,255,255,0.07);
    color: #E2E8F0;
    transform: translateX(2px);
}
.sidebar-nav a.active {
    background: linear-gradient(135deg, rgba(232,121,43,0.15), rgba(232,121,43,0.05));
    color: var(--orange-glow);
    border-left-color: var(--orange);
    font-weight: 700;
}
.sidebar-nav a .nav-icon {
    font-size: 15px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 11px;
    color: #475569;
    text-align: center;
    letter-spacing: 0.3px;
}

/* ── HAMBURGER (mobile) ──────────────────────────── */

.hamburger {
    display: none;
    position: fixed;
    top: 14px; left: 14px;
    z-index: 200;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s;
}
.hamburger:active { transform: scale(0.95); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,38,64,0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}

/* ── MAIN CONTENT ────────────────────────────────── */

.main {
    margin-left: var(--sidebar-w);
    flex: 1;
    min-width: 0;
    background: var(--bg);
}

.content {
    max-width: 920px;
    margin: 0 auto;
    padding: 36px 44px 80px;
    animation: fadeUp 0.4s ease-out;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── PAGE HEADER ─────────────────────────────────── */

.page-header {
    background: linear-gradient(135deg, var(--navy) 0%, #1A3F6B 60%, #1E4D7E 100%);
    color: #fff;
    padding: 32px 44px 28px;
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
}
.page-header::before {
    content: '';
    position: absolute;
    top: -50%; right: -10%;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(232,121,43,0.08) 0%, transparent 70%);
    border-radius: 50%;
}
.page-header h1 {
    font-size: 30px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    letter-spacing: -0.3px;
}
.page-header .breadcrumb {
    font-size: 13px;
    color: #7B9BBF;
    margin-bottom: 6px;
    position: relative;
}
.page-header .breadcrumb a {
    color: var(--orange-glow);
    text-decoration: none;
    font-weight: 500;
}
.page-header .breadcrumb a:hover { text-decoration: underline; }

/* ── SECTIONS ────────────────────────────────────── */

.section {
    margin-bottom: 42px;
    animation: fadeUp 0.5s ease-out both;
}
.section:nth-child(2) { animation-delay: 0.05s; }
.section:nth-child(3) { animation-delay: 0.1s; }
.section:nth-child(4) { animation-delay: 0.15s; }

.section-title {
    font-size: 21px;
    font-weight: 700;
    color: var(--navy-mid);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--lt-blue);
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.2px;
}

.subsection-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--blue);
    margin: 24px 0 10px;
    padding-left: 12px;
    border-left: 3px solid var(--blue-light);
}

p {
    margin-bottom: 14px;
    color: #334155;
    line-height: 1.7;
}

ol, ul { margin: 8px 0 14px 24px; color: #334155; }
li { margin-bottom: 6px; }

/* ── TABLES ──────────────────────────────────────── */

.ref-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 16px 0 24px;
    font-size: 14px;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.ref-table thead th {
    background: linear-gradient(180deg, #EDF2F8 0%, #E3EBF5 100%);
    color: var(--navy);
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--lt-blue);
    position: sticky;
    top: 0;
    z-index: 10;
}
.ref-table tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid #F1F5F9;
    vertical-align: top;
    transition: background 0.1s;
}
.ref-table tbody tr:last-child td { border-bottom: none; }
.ref-table tbody tr:nth-child(even) { background: #FAFBFD; }
.ref-table tbody tr:hover { background: #EFF6FF; }

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

/* ── IMAGES ──────────────────────────────────────── */

.fig {
    margin: 20px 0 24px;
    text-align: center;
}
.fig img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    border: 1px solid var(--border);
}
.fig img:hover {
    transform: scale(1.01) translateY(-2px);
    box-shadow: var(--shadow-lg);
}
.fig-caption {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 10px;
    font-style: italic;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,29,51,0.92);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 24px;
    cursor: zoom-out;
    animation: lbIn 0.2s ease-out;
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox.active { display: flex; }
.lightbox img {
    max-width: 92vw;
    max-height: 92vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

/* ── TIP BOX ─────────────────────────────────────── */

.tip {
    background: linear-gradient(135deg, #FFFCF5 0%, #FFF8EC 100%);
    border-left: 4px solid var(--orange);
    padding: 16px 20px;
    margin: 18px 0;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 14px;
    box-shadow: var(--shadow-sm);
    position: relative;
}
.tip strong {
    color: var(--orange);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
}

/* ── CARDS (index page) ──────────────────────────── */

.cards {
    margin: 24px -9px;
    overflow: hidden;
}
.cards::after { content: ''; display: table; clear: both; }
.card {
    width: calc(33.333% - 18px);
    min-width: 200px;
    background: #fff;
    border-radius: 12px;
    padding: 24px 20px 20px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    float: left;
    margin: 0 9px 18px;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--blue), var(--blue-light));
    opacity: 0;
    transition: opacity 0.25s;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--blue);
}
.card:hover::before { opacity: 1; }
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, var(--lt-blue), #EBF3FC);
    border: 1px solid rgba(40,120,181,0.12);
}
.card:nth-child(3n+1) .card-icon { background: linear-gradient(135deg, #DBEAFE, #EFF6FF); }
.card:nth-child(3n+2) .card-icon { background: linear-gradient(135deg, #FEF3C7, #FFFBEB); }
.card:nth-child(3n+3) .card-icon { background: linear-gradient(135deg, #D1FAE5, #ECFDF5); }
.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 6px;
    letter-spacing: -0.1px;
}
.card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; }

/* ── STATUS BADGES ───────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 13px;
    font-weight: 700;
}
.badge-yes {
    background: #D1FAE5;
    color: #065F46;
    box-shadow: 0 0 0 2px rgba(6,95,70,0.08);
}
.badge-no {
    background: #FEE2E2;
    color: #991B1B;
    box-shadow: 0 0 0 2px rgba(153,27,27,0.06);
}

/* ── RESPONSIVE ──────────────────────────────────── */

@media (max-width: 900px) {
    .card { width: calc(50% - 18px); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .hamburger { display: block; }
    .main { margin-left: 0; }
    .content { padding: 24px 18px 50px; }
    .page-header { padding: 64px 18px 22px; }
    .page-header h1 { font-size: 22px; }
    .card { width: calc(100% - 18px); float: none; }
}

/* ── HERO (index page) ───────────────────────────── */

.hero {
    background: linear-gradient(135deg, var(--navy) 0%, #1A4370 50%, #1D527F 100%);
    border-radius: var(--radius);
    padding: 36px 40px;
    margin-bottom: 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.hero::before {
    content: '';
    position: absolute;
    top: -40%; right: -15%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(232,121,43,0.12) 0%, transparent 65%);
    border-radius: 50%;
}
.hero::after {
    content: '';
    position: absolute;
    bottom: -30%; left: 10%;
    width: 250px; height: 250px;
    background: radial-gradient(circle, rgba(61,155,233,0.1) 0%, transparent 65%);
    border-radius: 50%;
}
.hero h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    position: relative;
    letter-spacing: -0.3px;
}
.hero p {
    color: #94B3D0;
    font-size: 15px;
    margin: 0;
    position: relative;
    line-height: 1.6;
}
.hero-stats {
    margin-top: 24px;
    position: relative;
    overflow: hidden;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.hero-stat {
    display: inline-block;
    text-align: center;
    width: 15%;
    min-width: 80px;
    vertical-align: top;
}
.hero-stat-num {
    font-size: 32px;
    font-weight: 700;
    color: var(--orange-glow);
    line-height: 1;
}
.hero-stat-label {
    font-size: 11px;
    color: #7B9BBF;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* ── SECTION STRIPE (alternating bg) ─────────────── */

.section:nth-child(even) {
    background: #fff;
    padding: 24px 28px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ── TABLE BADGES CENTER ─────────────────────────── */

.ref-table td:has(.badge) { text-align: center; }
/* Fallback for browsers without :has() */
.ref-table .badge { margin: 0 auto; }

/* ── TWO-COL IMAGE ROW ───────────────────────────── */

.fig-row {
    display: flex;
    gap: 16px;
    margin: 20px 0 24px;
}
.fig-row .fig {
    flex: 1;
    margin: 0;
}

/* ── PRINT ───────────────────────────────────────── */

@media print {
    .sidebar, .hamburger, .sidebar-overlay { display: none !important; }
    .main { margin-left: 0; }
    .content { max-width: 100%; padding: 0; }
    .ref-table { font-size: 11px; box-shadow: none; border: 1px solid #ccc; }
    .fig img { max-width: 80%; box-shadow: none; }
    .lightbox { display: none !important; }
    .section { animation: none; }
}

/* ── SEARCH HIGHLIGHT ────────────────────────────── */
mark.search-hit {
    background: rgba(232,121,43,0.25);
    padding: 1px 4px;
    border-radius: 3px;
    box-shadow: 0 0 0 1px rgba(232,121,43,0.15);
}
.search-hidden { display: none; }

