﻿/* ============================================================
   מעין אומר - Styles
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&family=Frank+Ruhl+Libre:wght@400;500;700&display=swap');

/* ---------- Design Tokens ---------- */
:root {
    --primary:        #972f55;
    --primary-dark:   #7a2644;
    --primary-light:  rgba(151, 47, 85, 0.12);
    --accent:         #f1c232;
    --accent-dark:    #d9ae2d;
    --green:          #69a243;
    --green-dark:     #5a8234;

    --text:           #2d2d2d;
    --text-muted:     #6b7280;
    --surface:        #ffffff;
    --bg:             #f8f5f7;
    --border:         rgba(151, 47, 85, 0.14);

    --radius-sm:  8px;
    --radius-md:  14px;
    --radius-lg:  22px;
    --radius-xl:  30px;
    --radius-full: 9999px;

    --shadow-sm:  0 1px 4px rgba(0,0,0,.06);
    --shadow-md:  0 4px 18px rgba(0,0,0,.09);
    --shadow-lg:  0 10px 40px rgba(0,0,0,.12);
    --shadow-primary: 0 6px 20px rgba(151,47,85,.25);

    --header-height-desktop: 110px;
    --search-height: 64px;
    --font-body: 'Heebo', 'Segoe UI', Tahoma, sans-serif;
    --font-heading: 'Frank Ruhl Libre', 'Heebo', serif;

    --transition: .25s cubic-bezier(.4,0,.2,1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    direction: rtl;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.container {
    width: min(92%, 1200px);
    margin: 0 auto;
    padding: 0 16px;
}

/* ============================================================
   HEADER
   ============================================================ */
.modern-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 20px rgba(0,0,0,.18);
}

.modern-header::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--primary-dark), var(--accent));
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}

.logo {
    height: 72px;
    width: 72px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 3px rgba(255,255,255,.3), var(--shadow-md);
    flex-shrink: 0;
    transition: transform var(--transition);
}
.logo:hover { transform: scale(1.07); }

.title-section { min-width: 0; }

.title-section h1 {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    font-weight: 700;
    margin: 0;
    background: linear-gradient(45deg, #fff 40%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    white-space: nowrap;
}

.title-section .subtitle {
    font-size: .95rem;
    opacity: .88;
    margin: 0;
    font-style: italic;
    white-space: nowrap;
    color: rgba(255,255,255,.9);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ---------- Action Buttons ---------- */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .85rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    min-height: 44px;
    white-space: nowrap;
}

.download-btn {
    background: rgba(255,255,255,.15);
    color: white;
    border: 1.5px solid rgba(255,255,255,.35);
    backdrop-filter: blur(8px);
}
.download-btn:hover {
    background: rgba(255,255,255,.28);
    border-color: rgba(255,255,255,.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.download-btn svg { width: 17px; height: 17px; }

.toremez-btn {
    background: var(--green);
    color: white;
    border: 1.5px solid transparent;
}
.toremez-btn:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(105,162,67,.35);
}
.toremez-btn img { width: 20px; height: 20px; }

/* ============================================================
   SEARCH NAV
   ============================================================ */
.search-nav {
    background: var(--accent);
    padding: 12px 0;
    position: sticky;
    top: var(--header-height-desktop);
    z-index: 199;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.search-container {
    position: relative;
    max-width: 560px;
    margin: 0 auto;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 19px; height: 19px;
    fill: #6b5000;
    pointer-events: none;
}

#search-input {
    width: 100%;
    padding: 13px 48px 13px 18px;
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 15px;
    background: white;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    color: var(--text);
}
#search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(151,47,85,.15);
}
#search-input::placeholder { color: #9b7700; }

/* ============================================================
   WELCOME BANNER
   ============================================================ */
.welcome-banner {
    background: linear-gradient(135deg, rgba(151,47,85,.06) 0%, rgba(241,194,50,.1) 100%);
    border-bottom: 1px solid rgba(151,47,85,.1);
    padding: 12px 0;
}
.welcome-text {
    text-align: center;
    color: var(--text-muted);
    font-size: .92rem;
    line-height: 1.7;
    max-width: 700px;
    margin: 0 auto;
}
.welcome-text strong { color: var(--primary); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
main { padding: 36px 0 100px; }

/* ---------- Content Sections ---------- */
.content-section {
    margin: 50px 0;
    opacity: 0;
    animation: fadeInUp .55s ease forwards;
}
.content-section:nth-child(1) { animation-delay: .08s; }
.content-section:nth-child(2) { animation-delay: .18s; }
.content-section:nth-child(3) { animation-delay: .28s; }

/* ---------- Section Header ---------- */
.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 18px 22px;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.section-icon {
    width: 52px; height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(151,47,85,.28);
    flex-shrink: 0;
}
.section-icon svg { width: 26px; height: 26px; fill: white; }

.section-title { flex: 1; min-width: 0; }
.section-title h2 {
    font-family: var(--font-heading);
    color: var(--primary);
    font-size: clamp(1.4rem, 3.5vw, 1.9rem);
    font-weight: 700;
    margin: 0;
}
.section-subtitle {
    color: var(--text-muted);
    font-size: .9rem;
    margin: 3px 0 0;
}

/* ---------- Expand Button ---------- */
.expand-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    font-size: .85rem;
    transition: all var(--transition);
    min-height: 44px;
    white-space: nowrap;
}
.expand-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-primary);
}
.expand-btn svg { width: 15px; height: 15px; transition: transform .3s; }
.expand-btn svg.rotated { transform: rotate(180deg); }

/* ============================================================
   SCROLL TRACK + SWIPE HINT
   ============================================================ */
.scroll-track {
    position: relative;
}



/* Swipe hint pill — visible only on touch/mobile, fades out after first scroll */
.scroll-swipe-hint {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: .78rem;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border-radius: var(--radius-full);
    padding: 5px 14px;
    margin-bottom: 10px;
    width: fit-content;
    animation: swipeNudge 1.4s ease-in-out 0.8s 2;
    opacity: 1;
    transition: opacity .4s;
}
.scroll-swipe-hint svg {
    width: 15px; height: 15px;
    fill: var(--primary);
    animation: nudgeArrow 1.4s ease-in-out 0.8s 2;
}
.scroll-swipe-hint.hidden { opacity: 0; pointer-events: none; }

@keyframes nudgeArrow {
    0%, 100% { transform: translateX(0); }
    40%       { transform: translateX(-6px); }
    70%       { transform: translateX(3px); }
}

/* Only show on touch devices (mobile) */
@media (hover: none) and (pointer: coarse) {
    .scroll-swipe-hint { display: flex; }
}

/* ============================================================
   CARDS GRID
   ============================================================ */
.content-grid,
.scrollable-grid {
    display: flex;
    overflow-x: auto;
    gap: 20px;
    padding: 6px 4px 20px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) transparent;
}
.scrollable-grid::-webkit-scrollbar { height: 5px; }
.scrollable-grid::-webkit-scrollbar-track { background: transparent; }
.scrollable-grid::-webkit-scrollbar-thumb {
    background: rgba(151,47,85,.25);
    border-radius: 10px;
}

/* ---------- Modern Card ---------- */
.modern-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 22px 22px 18px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
    flex: 0 0 300px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    animation: slideInUp .5s ease forwards;
    opacity: 0;
}

.modern-card:nth-child(1) { animation-delay: .08s; }
.modern-card:nth-child(2) { animation-delay: .16s; }
.modern-card:nth-child(3) { animation-delay: .24s; }
.modern-card:nth-child(4) { animation-delay: .32s; }
.modern-card:nth-child(5) { animation-delay: .40s; }
.modern-card:nth-child(6) { animation-delay: .48s; }

.modern-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform: scaleX(0);
    transition: transform var(--transition);
    transform-origin: right;
}
.modern-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.modern-card:hover::before { transform: scaleX(1); transform-origin: left; }

.card-header { margin-bottom: 16px; flex: 1; }
.card-header h3 {
    color: var(--primary-dark);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    margin: 0 0 10px;
}

.card-badge {
    display: inline-block;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #5a3b00;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    font-size: .8rem;
    font-weight: 700;
}

.card-date {
    color: var(--text-muted);
    font-size: .85rem;
    background: #f3f4f6;
    padding: 3px 12px;
    border-radius: var(--radius-full);
    display: inline-block;
}

.card-actions { display: flex; justify-content: flex-end; margin-top: auto; }

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    font-size: .85rem;
    transition: all var(--transition);
    min-height: 44px;
}
.view-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-primary); }
.view-btn svg { width: 15px; height: 15px; }

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    font-family: var(--font-body);
}
button:hover { background: var(--primary-dark); }

/* ============================================================
   CONTENT VIEWER
   ============================================================ */
#content-viewer {
    position: fixed;
    top: 0; left: 0;
    width: 45%;
    height: 100vh;
    background: white;
    box-shadow: 4px 0 30px rgba(0,0,0,.18);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    transform: translateX(-100%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    border-radius: 0 16px 16px 0;
    overflow: hidden;
}
#content-viewer.visible { transform: translateX(0); }
#content-viewer.minimized { height: 60px; overflow: hidden; }

.viewer-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 58px;
}
.viewer-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.viewer-icon { width: 22px; height: 22px; flex-shrink: 0; }
#content-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-controls { display: flex; gap: 7px; align-items: center; }
.viewer-btn {
    background: rgba(255,255,255,.2);
    border: none;
    color: white;
    width: 34px; height: 34px;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    padding: 0;
}
.viewer-btn:hover { background: rgba(255,255,255,.35); }
.viewer-btn svg { width: 16px; height: 16px; }

.viewer-toolbar {
    background: #f8f9fa;
    padding: 10px 18px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: white;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: .8rem;
    font-weight: 500;
    transition: all var(--transition);
    min-height: 36px;
}
.toolbar-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.toolbar-btn svg { width: 13px; height: 13px; }

.zoom-controls { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.zoom-level { font-size: .8rem; font-weight: 600; color: #495057; min-width: 42px; text-align: center; }

.viewer-content { flex: 1; overflow: hidden; background: #f8f9fa; }
.viewer-content iframe { width: 100%; height: 100%; border: none; }

.viewer-resize-handle {
    position: absolute;
    top: 0; right: -5px;
    width: 10px; height: 100%;
    cursor: ew-resize;
    z-index: 10;
}
.viewer-resize-handle:hover { background: rgba(151,47,85,.18); }

/* ============================================================
   MODALS
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s, visibility .3s;
    padding: 16px;
    backdrop-filter: blur(3px);
}
.modal.visible { opacity: 1; visibility: visible; }
.modal.hidden { display: none; }

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 680px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(-16px);
    transition: transform .3s;
    border: 1px solid var(--border);
}
.modal.visible .modal-content { transform: translateY(0); }

.large-modal { max-width: 90vw; width: 1100px; }

.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(151,47,85,.04), rgba(241,194,50,.04));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}
.modal-header h2 {
    margin: 0;
    color: var(--primary);
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
}

.close-modal {
    background: var(--primary-light);
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--primary);
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all var(--transition);
    font-weight: bold;
    flex-shrink: 0;
    padding: 0;
}
.close-modal:hover { background: var(--primary); color: white; transform: rotate(90deg); }

.modal-filter {
    padding: 16px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(151,47,85,.02);
    display: flex;
    gap: 10px;
    align-items: center;
    position: sticky;
    top: 73px;
    z-index: 9;
}
.filter-input {
    flex: 1;
    padding: 11px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: 15px;
    background: white;
    color: var(--text);
    outline: none;
    transition: all var(--transition);
    text-align: right;
    direction: rtl;
}
.filter-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(151,47,85,.1); }
.filter-input::placeholder { color: rgba(151,47,85,.5); font-style: italic; }

.clear-search-btn {
    background: var(--primary-light);
    border: none;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--primary);
    transition: all var(--transition);
    padding: 0;
}
.clear-search-btn svg { width: 17px; height: 17px; }
.clear-search-btn:hover { background: rgba(151,47,85,.2); transform: scale(1.1); }

.search-results-info {
    padding: 9px 28px;
    background: rgba(105,162,67,.08);
    border-bottom: 1px solid rgba(105,162,67,.2);
    color: var(--green);
    font-size: .85rem;
    font-weight: 500;
    text-align: center;
}

.modal-body { padding: 22px 24px; }

.popup-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 6px;
}

.popup-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    padding: 14px;
    transition: all var(--transition);
    animation: slideInCard .35s ease-out;
}
.popup-card:hover { border-color: var(--primary); box-shadow: 0 3px 10px rgba(151,47,85,.12); }
.popup-card-header h4 {
    margin: 0 0 8px;
    color: var(--text);
    font-size: .95rem;
    line-height: 1.4;
    font-weight: 600;
}
.popup-card-meta {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    font-size: .75rem;
    margin-left: 5px;
}
.popup-card-actions { margin-top: 12px; text-align: center; }
.popup-view-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-size: .85rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition);
    min-height: 38px;
}
.popup-view-btn:hover { background: var(--accent); color: #4a3000; transform: translateY(-1px); }
.popup-view-btn svg { width: 14px; height: 14px; }

.no-results {
    text-align: center;
    padding: 56px 24px;
    color: rgba(151,47,85,.7);
    animation: fadeInUp .4s ease;
}
.no-results-icon {
    margin: 0 auto 18px;
    width: 72px; height: 72px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}
.no-results-icon svg { width: 38px; height: 38px; }
.no-results h3 { font-size: 1.3rem; margin: 0 0 8px; color: var(--primary); }
.no-results p { font-size: .95rem; opacity: .8; }

/* ============================================================
   DOWNLOAD MODAL
   ============================================================ */
.download-options { display: flex; flex-direction: column; gap: 24px; }
.download-section {
    background: linear-gradient(135deg, rgba(151,47,85,.03), rgba(241,194,50,.03));
    padding: 22px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: border-color var(--transition), box-shadow var(--transition);
}
.download-section:hover { border-color: rgba(151,47,85,.22); box-shadow: 0 4px 14px rgba(151,47,85,.07); }
.download-section h3 {
    margin-bottom: 18px;
    color: var(--primary);
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.download-section h3::before {
    content: '';
    width: 4px; height: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 2px;
}

.date-range { display: flex; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.date-range label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 120px;
    font-weight: 600;
    color: var(--primary);
    font-size: .9rem;
}
.date-range input {
    padding: 11px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: var(--font-body);
}
.date-range input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(151,47,85,.1); }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
    user-select: none;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    font-weight: 500;
    font-size: .95rem;
}
.checkbox-label:hover { background: rgba(151,47,85,.05); }
.checkbox-label input[type="checkbox"] { width: 19px; height: 19px; cursor: pointer; accent-color: var(--primary); flex-shrink: 0; }

.books-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    max-height: 280px;
    overflow-y: auto;
    padding: 12px;
    background: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: rgba(151,47,85,.02);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    flex-wrap: wrap;
}
.modal-footer button {
    padding: 11px 28px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 600;
    font-size: .9rem;
    font-family: var(--font-body);
    min-height: 44px;
}
.modal-footer button.secondary { background: white; border: 2px solid var(--primary); color: var(--primary); }
.modal-footer button.secondary:hover { background: var(--primary); color: white; transform: translateY(-2px); }
.modal-footer button.primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); border: 2px solid transparent; color: white; }
.modal-footer button.primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-primary); }
.modal-footer button:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ============================================================
   VIDEO STYLES
   ============================================================ */
.video-wrapper { background: white; padding: 18px; border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.video-wrapper iframe { width: 100%; aspect-ratio: 16/9; border: none; border-radius: var(--radius-sm); margin-bottom: 14px; }
.video-details { padding: 14px; background: #f8f9fa; border-radius: var(--radius-sm); }
.video-details h3 { color: var(--primary); margin-bottom: 8px; }
.video-date { color: var(--text-muted); font-size: .9rem; margin-bottom: 7px; }
.video-description { line-height: 1.65; white-space: pre-wrap; }

/* ============================================================
   AUTOCOMPLETE
   ============================================================ */
.autocomplete-items {
    position: absolute;
    border: 1px solid #e5e7eb;
    z-index: 99;
    top: 100%; left: 0; right: 0;
    background: white;
    box-shadow: var(--shadow-md);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    max-height: 280px;
    overflow-y: auto;
}
.autocomplete-items div { padding: 11px 16px; cursor: pointer; border-bottom: 1px solid #f3f4f6; font-size: .95rem; }
.autocomplete-items div:hover { background: #f8f9fa; }
.autocomplete-active { background: var(--primary-light) !important; color: var(--primary); font-weight: 600; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    text-align: center;
    padding: 28px 0;
    margin-top: 60px;
    position: relative;
}
footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}
footer p { margin: 0; font-size: .95rem; opacity: .92; }

/* ============================================================
   SCROLL TO TOP
   ============================================================ */
.scroll-top {
    position: fixed;
    bottom: 24px; left: 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px; height: 48px;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(151,47,85,.35);
    transition: all var(--transition);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { background: var(--primary-dark); transform: translateY(-3px); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInUp {
    from { opacity: 0; transform: translateY(22px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes slideInCard {
    from { opacity: 0; transform: translateY(14px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .65; } }

.loading-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}
.pulse { animation: pulse 2s infinite; }

/* ============================================================
   RESPONSIVE — 1024px
   ============================================================ */
@media (max-width: 1024px) {
    .modern-card { flex: 0 0 280px; }
    .section-title h2 { font-size: 1.65rem; }
}

/* ============================================================
   RESPONSIVE — 768px
   ============================================================ */
@media (max-width: 768px) {
    :root { --header-height-desktop: 0px; }

    .logo { height: 60px; width: 60px; }
    .title-section h1 { font-size: 1.7rem; }
    .title-section .subtitle { font-size: .85rem; }

    .logo-section { flex: 1 1 auto; }
    .header-actions { flex: 0 0 100%; justify-content: center; gap: 10px; }

    .modern-header { position: relative; }
    .search-nav { position: sticky; top: 0; z-index: 200; }

    /* 1.5 cards visible: card fills ~54vw so half the next card peeks */
    .modern-card { flex: 0 0 54vw; max-width: 54vw; }

    /* Prominent "show all" button on mobile */
    .expand-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 20px;
        font-size: .95rem;
        border-radius: var(--radius-md);
    }

    .section-header { flex-wrap: wrap; gap: 12px; }
    .section-title h2 { font-size: 1.45rem; }

    #content-viewer { width: 100%; border-radius: 0; }
    .viewer-toolbar { flex-wrap: wrap; }
    .zoom-controls { order: -1; width: 100%; justify-content: center; }

    .modal { padding: 0; align-items: flex-end; }
    .modal-content { max-height: 95vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .large-modal { max-width: 100%; width: 100%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
    .modal-header { padding: 18px 20px; }
    .modal-body { padding: 18px 20px; }
    .modal-footer { padding: 16px 20px; flex-direction: column-reverse; }
    .modal-footer button { width: 100%; justify-content: center; }

    .popup-grid { grid-template-columns: 1fr; max-height: 65vh; }
    .date-range { flex-direction: column; gap: 14px; }
    main { padding: 22px 0 88px; }
}

/* ============================================================
   RESPONSIVE — 480px
   ============================================================ */
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .logo { height: 52px; width: 52px; }
    .title-section h1 { font-size: 1.5rem; }
    .action-btn { padding: 9px 14px; font-size: .8rem; }
    .section-icon { width: 44px; height: 44px; }
    .section-icon svg { width: 22px; height: 22px; }
    .section-header { padding: 14px 16px; }
    .section-title h2 { font-size: 1.25rem; }
    .modern-card { padding: 18px 16px; }
    main { padding: 16px 0 80px; }
    .scroll-top { bottom: 16px; left: 16px; width: 44px; height: 44px; }
    .modal-filter { padding: 12px 16px; position: static; }
    .modal-header h2 { font-size: 1.3rem; }
    .modal-footer { position: sticky; bottom: 0; background: white; }
}
