:root {
    --brand-navy-dark: #070d18;
    --brand-navy: #0f172a;
    --brand-navy-surface: #1e293b;
    --brand-gold: #c59b27;
    --brand-gold-hover: #dfb235;
    --brand-gold-dim: rgba(197, 155, 39, 0.12);
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0b1120;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-light: #e2e8f0;
    --border-color: #e2e8f0;
    --rec-red: #ef4444;
    --topbar-height: 64px;
    --topbar-height-mobile: 122px;
    --sidebar-width: 310px;
    --reading-max-width: 860px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Assistant", "Heebo", sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.75;
    padding-top: var(--topbar-height);
    direction: rtl;
    text-align: right;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 1050;
}

.progress-bar {
    height: 100%;
    background: var(--brand-gold);
    width: 0%;
    transition: width 0.08s linear;
}

/* ==========================================================================
   Institutional Fixed Header
   ========================================================================== */

.top-official-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: var(--topbar-height);
    background-color: var(--brand-navy-dark);
    color: #ffffff;
    z-index: 1000;
    border-bottom: 1px solid rgba(197, 155, 39, 0.35);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.header-inner {
    max-width: 100%;
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-identity {
    display: flex;
    align-items: center;
    min-width: 0;
}

.header-titles {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.header-titles .main-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.2px;
}

.header-titles .sub-title {
    font-size: 0.72rem;
    color: #94a3b8;
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.action-btn {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.16);
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.action-btn:hover {
    background: rgba(197, 155, 39, 0.18);
    border-color: var(--brand-gold);
    color: #ffffff;
}

.mobile-text {
    display: none;
}

.mobile-nav-btn {
    display: none;
}

.header-countdown-box {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.countdown-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #020617;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.82rem;
    color: #f1f5f9;
    direction: ltr;
}

.rec-indicator {
    color: var(--rec-red);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    letter-spacing: 0.5px;
}

.rec-dot {
    animation: pulseDot 1.2s infinite ease-in-out;
}

@keyframes pulseDot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.2; }
}

/* ==========================================================================
   Font Controls Floating Pill
   ========================================================================== */

.font-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: var(--brand-navy-dark);
    color: #ffffff;
    border: 1px solid rgba(197, 155, 39, 0.4);
    border-radius: 24px;
    padding: 3px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 950;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.font-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1;
}

.font-btn:hover {
    color: var(--brand-gold);
}

.font-divider {
    color: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Mobile Sidebar Backdrop
   ========================================================================== */

.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 13, 24, 0.7);
    backdrop-filter: blur(2px);
    z-index: 850;
    opacity: 0;
    transition: opacity 0.25s ease-in-out;
    pointer-events: none;
}

/* ==========================================================================
   App Layout: Dedicated Sidebar + Main Content
   ========================================================================== */

.app-container {
    display: flex;
    position: relative;
    min-height: calc(100vh - var(--topbar-height));
}

.sidebar {
    position: fixed;
    top: var(--topbar-height);
    right: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background-color: var(--bg-sidebar);
    color: #cbd5e1;
    overflow-y: scroll;
    overscroll-behavior: contain;
    z-index: 900;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.sidebar-header {
    position: sticky;
    top: 0;
    background: #080d1a;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-header-title {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--brand-gold);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.sidebar-header-sub {
    display: block;
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
}

.sidebar-x-close {
    display: none;
}

.chapters-menu {
    padding: 10px 0 30px;
}

.chapter-item {
    margin: 2px 0;
    position: relative;
    transition: background 0.15s ease;
}

.chapter-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.84rem;
    line-height: 1.35;
    border-right: 3px solid transparent;
    transition: all 0.15s ease-in-out;
}

.chap-badge {
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.chap-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chapter-link:hover {
    background-color: rgba(255, 255, 255, 0.04);
    color: #f8fafc;
}

.chapter-item.active {
    background: var(--brand-gold-dim);
}

.chapter-item.active .chapter-link {
    color: #ffffff;
    font-weight: 700;
    border-right-color: var(--brand-gold);
}

.chapter-item.active .chap-badge {
    background: var(--brand-gold);
    color: var(--brand-navy-dark);
    border-color: var(--brand-gold);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */

.main-content {
    margin-right: var(--sidebar-width);
    flex: 1;
    padding: 40px 24px 80px;
    width: calc(100% - var(--sidebar-width));
}

.content-wrapper {
    max-width: var(--reading-max-width);
    margin: 0 auto;
    background: var(--bg-card);
    padding: 44px 50px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.doc-header {
    margin-bottom: 35px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 30px;
}

.court-heading {
    margin-bottom: 12px;
}

.doc-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--brand-navy);
    line-height: 1.25;
}

.case-years {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 4px;
}

.case-parties {
    background-color: #f1f5f9;
    border-right: 4px solid var(--brand-navy);
    padding: 14px 18px;
    font-size: 0.98rem;
    margin: 18px 0 24px;
    line-height: 1.6;
    border-radius: 0 4px 4px 0;
}

.doc-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    text-align: center;
    color: var(--brand-navy);
    margin: 24px 0 18px;
}

.indictment-summary-box {
    background-color: #fffbeb;
    border: 1px solid #fef3c7;
    border-right: 4px solid var(--brand-gold);
    padding: 16px 20px;
    border-radius: 4px;
    margin-bottom: 25px;
}

.indictment-summary-box strong {
    color: #92400e;
    font-size: 1rem;
    display: block;
    margin-bottom: 8px;
}

.indictment-summary-box ul {
    margin-right: 20px;
}

.indictment-summary-box li {
    margin-bottom: 6px;
    font-size: 0.95rem;
    color: #78350f;
}

.lead-text p {
    font-size: 1.02rem;
    line-height: 1.8;
    margin-bottom: 16px;
    color: #334155;
    text-align: justify;
}

.doc-section {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 1px solid var(--border-color);
    scroll-margin-top: calc(var(--topbar-height) + 20px);
}

.section-title {
    font-size: 1.22rem;
    font-weight: 700;
    color: var(--brand-navy);
    margin-bottom: 18px;
    line-height: 1.4;
}

p {
    margin-bottom: 16px;
    font-size: 1rem;
    color: var(--text-main);
    text-align: justify;
}

ul {
    margin-right: 24px;
    margin-bottom: 16px;
}

li {
    margin-bottom: 8px;
    line-height: 1.65;
}

blockquote {
    background-color: #f8fafc;
    border-right: 4px solid var(--brand-gold);
    padding: 14px 18px;
    margin: 18px 0;
    color: #334155;
    font-size: 0.96rem;
    line-height: 1.7;
    border-radius: 0 4px 4px 0;
}

.author-signature {
    margin-top: 30px;
    font-size: 1.1rem;
    color: var(--brand-navy);
}

.doc-divider {
    margin: 30px 0;
    border: 0;
    border-top: 1px solid var(--border-color);
}

.ai-prompt-guide-box {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    padding: 20px;
    border-radius: 6px;
    font-size: 0.95rem;
}

.guide-title {
    margin-bottom: 10px;
    color: var(--brand-navy);
}

.sample-prompt {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-right: 4px solid var(--brand-gold);
    margin: 12px 0;
    padding: 12px 16px;
}

.license-text {
    margin-top: 16px;
    margin-bottom: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.license-text a {
    color: var(--brand-navy);
    text-decoration: underline;
    word-break: break-all;
}

/* ==========================================================================
   Modal Popup & Elegant Top-Left X Button
   ========================================================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(2px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-card {
    background: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 8px;
    padding: 24px 26px 26px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-color);
    position: relative;
}

/* Elegant Dark Floating X in Top-Left Corner */
.modal-x-close {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--brand-navy-dark);
    color: #f1f5f9;
    border: 1px solid rgba(197, 155, 39, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    transition: background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.15s ease-out;
    z-index: 5;
}

.modal-x-close:hover {
    background-color: var(--brand-navy-surface);
    color: var(--brand-gold);
    border-color: var(--brand-gold);
    transform: scale(1.06);
}

.modal-x-close:active {
    transform: scale(0.95);
}

.modal-header {
    display: flex;
    align-items: center;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-navy);
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    padding-left: 42px; /* Ensure space for top-left X button */
}

.modal-instruction {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.modal-btn-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.modal-opt-btn {
    background: #f1f5f9;
    color: var(--text-main);
    border: 1px solid #cbd5e1;
    padding: 10px 14px;
    font-size: 0.92rem;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    text-align: right;
    transition: background 0.15s, border-color 0.15s;
}

.modal-opt-btn:hover {
    background: #e2e8f0;
    border-color: var(--brand-gold);
}

.modal-opt-btn.dark-opt {
    background: #334155;
    color: #ffffff;
    border-color: #1e293b;
}

.modal-opt-btn.dark-opt:hover {
    background: #1e293b;
}

/* ==========================================================================
   Mobile Header: Multi-Row Architecture (max-width: 900px)
   ========================================================================== */

@media (max-width: 900px) {
    body {
        padding-top: var(--topbar-height-mobile);
    }

    .doc-section {
        scroll-margin-top: calc(var(--topbar-height-mobile) + 16px);
    }

    .top-official-bar {
        height: var(--topbar-height-mobile);
        padding: 6px 12px;
    }

    .header-inner {
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        padding: 0;
        gap: 5px;
    }

    .header-identity {
        display: flex;
        align-items: center;
        justify-content: flex-start;
        width: 100%;
    }

    .header-titles .main-title {
        font-size: 0.88rem;
    }

    .header-titles .sub-title {
        display: none;
    }

    .header-actions {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
        width: 100%;
    }

    .action-btn {
        padding: 5px 2px;
        font-size: 0.78rem;
        width: 100%;
        text-align: center;
    }

    .desktop-text {
        display: none;
    }

    .mobile-text {
        display: inline;
    }

    .mobile-nav-btn {
        display: inline-flex;
    }

    .header-countdown-box {
        width: 100%;
        justify-content: center;
    }

    .countdown-wrapper {
        width: 100%;
        justify-content: center;
        font-size: 0.75rem;
        padding: 3px 6px;
        letter-spacing: 0.4px;
    }

    /* Mobile Backdrop Active */
    .sidebar-backdrop {
        display: block;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Mobile Sidebar & Close Button */
    .sidebar {
        top: var(--topbar-height-mobile);
        height: calc(100vh - var(--topbar-height-mobile));
        right: -100%;
        width: 84%;
        max-width: 320px;
        transition: right 0.28s ease-in-out;
        box-shadow: -6px 0 20px rgba(0, 0, 0, 0.4);
    }

    .sidebar.open {
        right: 0;
    }

    .sidebar-x-close {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.08);
        border: 1px solid rgba(255, 255, 255, 0.15);
        color: #cbd5e1;
        width: 30px;
        height: 30px;
        border-radius: 4px;
        font-size: 0.95rem;
        cursor: pointer;
        transition: background 0.15s, color 0.15s;
    }

    .sidebar-x-close:hover {
        background: rgba(255, 255, 255, 0.18);
        color: #ffffff;
    }

    .main-content {
        margin-right: 0;
        width: 100%;
        padding: 16px 10px 60px;
    }

    .content-wrapper {
        padding: 20px 14px;
    }

    .doc-header h1 {
        font-size: 1.35rem;
    }
    
    
    
    /* קיבוע צבע אדום קבוע לנקודת ה-REC בכל מצב */
.rec-dot {
    color: #ff3b30 !important;
    display: inline-block;
}

/* הגדרת אנימציית הבהוב מבוססת שקיפות בלבד (ללא שינוי צבע) */
@keyframes recBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.2;
    }
}

/* הפעלת האנימציה על הנקודה */
.rec-dot:not(.stopped) {
    animation: recBlink 1s infinite ease-in-out !important;
    color: #ff3b30 !important;
}

/* מצב עצירה (לחיצה על ה-✕) - אדום מלא וסטטי */
.rec-dot.stopped {
    animation: none !important;
    opacity: 1 !important;
    color: #ff3b30 !important;
}

.rec-dot {
    color: #ff3b30 !important;
}
    
}