/* ════════════════════════════════════════════════════════════════════
   THEME — CSS Custom Properties for light/dark mode
   All colors come from variables. Dark mode = just swap :root values.
   ════════════════════════════════════════════════════════════════════ */

:root {
    --bg:          #f4f6fb;
    --surface:     #ffffff;
    --surface2:    #f0f2f8;
    --primary:     #1a1a2e;
    --accent:      #2196F3;
    --accent-dark: #1565C0;
    --text:        #1e1e2e;
    --text-muted:  #6b7280;
    --border:      #e5e7ef;
    --shadow-sm:   0 1px 4px rgba(0,0,0,.06);
    --shadow:      0 4px 16px rgba(0,0,0,.09);
    --radius:      12px;
    --radius-sm:   8px;
    --transition:  .2s ease;
}

html.dark-mode {
    --bg:          #0d0d1a;
    --surface:     #1a1a2e;
    --surface2:    #16213e;
    --primary:     #e8e8f5;
    --text:        #e0e0f0;
    --text-muted:  #8888aa;
    --border:      #2a2a40;
    --shadow-sm:   0 1px 4px rgba(0,0,0,.3);
    --shadow:      0 4px 16px rgba(0,0,0,.4);
}

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

html {
    font-family: 'Tajawal', Arial, sans-serif;
    font-size: 16px;
    scroll-behavior: smooth;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3 { line-height: 1.3; font-weight: 700; color: var(--primary); }
html.dark-mode h1,
html.dark-mode h2,
html.dark-mode h3 { color: var(--text); }

/* ─── Top Bar ──────────────────────────────────────────────────────── */
.top-bar {
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 20px;
    font-size: .82rem;
}

.date-display {
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: .85;
}
.date-display svg { width: 15px; height: 15px; fill: #fff; flex-shrink: 0; }

/* Dark mode toggle button */
.dark-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    gap: 2px;
}
.dark-toggle svg { width: 18px; height: 18px; fill: #fff; transition: opacity var(--transition); }
.dark-toggle .icon-sun  { display: block; }
.dark-toggle .icon-moon { display: none; }
html.dark-mode .dark-toggle .icon-sun  { display: none; }
html.dark-mode .dark-toggle .icon-moon { display: block; }

/* ─── Logo ─────────────────────────────────────────────────────────── */
.logo-area {
    background: var(--surface);
    padding: 10px 20px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.site-logo { height: 50px; width: auto; margin: 0 auto; object-fit: contain; }

/* ─── Navigation ────────────────────────────────────────────────────── */
.main-nav {
    background: var(--primary);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
}
.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
}
.nav-links a {
    color: rgba(255,255,255,.85);
    padding: 12px 14px;
    font-size: .9rem;
    font-weight: 500;
    transition: color var(--transition), background var(--transition);
    border-radius: var(--radius-sm);
}
.nav-links a:hover,
.nav-links a.active { color: #fff; background: rgba(255,255,255,.12); }

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
}
.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: transform var(--transition);
}

/* ─── Page Container ────────────────────────────────────────────────── */
.page-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 16px 40px;
    flex: 1;
    width: 100%;
}

/* ─── Search Section ─────────────────────────────────────────────────── */
.search-section { margin: 24px 0; }
.search-form {
    display: flex;
    gap: 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.search-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-left: none;
    border-radius: var(--radius) 0 0 var(--radius);
    font-family: inherit;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}
html[dir="rtl"] .search-input {
    border-left: 2px solid var(--border);
    border-right: none;
    border-radius: 0 var(--radius) var(--radius) 0;
}
.search-input:focus { border-color: var(--accent); }
.search-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 22px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 0 var(--radius) var(--radius) 0;
    transition: background var(--transition);
    white-space: nowrap;
}
html[dir="rtl"] .search-btn { border-radius: var(--radius) 0 0 var(--radius); }
.search-btn:hover { background: var(--accent-dark); }
.search-btn svg { width: 20px; height: 20px; fill: #fff; }

/* ─── Breadcrumb ─────────────────────────────────────────────────────── */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .85rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.breadcrumb a { color: var(--accent); }
.breadcrumb a:hover { text-decoration: underline; }

/* ─── Page Header ────────────────────────────────────────────────────── */
.page-header {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border-right: 4px solid var(--accent);
}
.page-header h1 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}
.page-description {
    color: var(--text-muted);
    font-size: .95rem;
    line-height: 1.7;
}

/* ─── Result Cards ────────────────────────────────────────────────────── */
.results-list { display: flex; flex-direction: column; gap: 16px; }

.result-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    gap: 0;
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition);
}
.result-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.card-thumb {
    position: relative;
    flex-shrink: 0;
    width: 180px;
}
.card-thumb img {
    width: 180px;
    height: 101px;
    object-fit: cover;
    display: block;
}
.duration-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0,0,0,.75);
    color: #fff;
    font-size: .75rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.card-title { font-size: 1rem; font-weight: 700; line-height: 1.4; }
.card-title a { color: var(--text); }
.card-title a:hover { color: var(--accent); }

.card-meta {
    display: flex;
    gap: 12px;
    font-size: .82rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

/* ─── Download Button ─────────────────────────────────────────────────── */
.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: .88rem;
    font-weight: 700;
    transition: background var(--transition);
    align-self: flex-start;
}
.btn-download:hover { background: var(--accent-dark); color: #fff; }
.btn-download svg { width: 16px; height: 16px; fill: #fff; }
.btn-download.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-download.btn-lg svg { width: 20px; height: 20px; }

/* ─── No Results ─────────────────────────────────────────────────────── */
.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.no-data svg { width: 48px; height: 48px; fill: var(--border); margin: 0 auto 16px; }
.no-data p { font-size: 1.1rem; }

/* ─── Tags / Related ──────────────────────────────────────────────────── */
.tags-section, .related-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    margin: 24px 0;
    box-shadow: var(--shadow-sm);
}
.section-title, .related-title {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--primary);
}
html.dark-mode .section-title,
html.dark-mode .related-title { color: var(--text); }

.tags-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.tag-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--surface2);
    color: var(--text);
    padding: 7px 14px;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 500;
    border: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition);
}
.tag-link:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.tag-link svg { width: 14px; height: 14px; fill: currentColor; }

/* ─── Features Grid ──────────────────────────────────────────────────── */
.features-title {
    text-align: center;
    font-size: 1.4rem;
    margin: 40px 0 20px;
    color: var(--accent);
}
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}
.feature-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 28px 22px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.feature-icon {
    width: 56px;
    height: 56px;
    background: #e3f2fd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
html.dark-mode .feature-icon { background: #1a2a3a; }
.feature-icon svg { width: 26px; height: 26px; fill: var(--accent); stroke: none; color: var(--accent); }
.feature-card h3 { font-size: 1rem; margin-bottom: 10px; }
.feature-card p { color: var(--text-muted); font-size: .9rem; line-height: 1.6; }

/* ─── Video Player ──────────────────────────────────────────────────── */
.player-container {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    text-align: center;
}
.player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: #000;
    max-width: 800px;
    margin: 0 auto;
}
.player-wrapper iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    border: none;
}
.player-actions { margin-top: 20px; display: flex; justify-content: center; }

/* ─── Static Pages ──────────────────────────────────────────────────── */
.static-page {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    line-height: 1.8;
}
.static-page h1 { font-size: 1.6rem; margin-bottom: 20px; border-bottom: 2px solid var(--accent); padding-bottom: 12px; }
.static-page h2 { font-size: 1.15rem; margin: 24px 0 10px; }
.static-page p { margin-bottom: 14px; color: var(--text-muted); }
.static-page a { color: var(--accent); }

/* ─── Footer ────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--primary);
    color: rgba(255,255,255,.8);
    margin-top: auto;
}
.footer-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 16px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.footer-copy { font-size: .85rem; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: rgba(255,255,255,.75); font-size: .85rem; transition: color var(--transition); }
.footer-links a:hover { color: #fff; }

/* ─── Scroll to Top ─────────────────────────────────────────────────── */
.scroll-top {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 44px;
    height: 44px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition), transform var(--transition);
    z-index: 200;
}
.scroll-top.visible { opacity: 1; transform: translateY(0); }
.scroll-top svg { width: 20px; height: 20px; fill: #fff; }

/* ─── Responsive ────────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .menu-toggle { display: flex; }

    .nav-links {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: 0; left: 0;
        background: var(--primary);
        padding: 8px 0 12px;
        box-shadow: 0 4px 12px rgba(0,0,0,.2);
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 10px 20px; border-radius: 0; }

    .result-card { flex-direction: column; }
    .card-thumb { width: 100%; }
    .card-thumb img { width: 100%; height: 200px; }

    .page-header h1 { font-size: 1.15rem; }
    .features-grid { grid-template-columns: 1fr; }
    .footer-inner { flex-direction: column; text-align: center; }
    .footer-links { justify-content: center; }
}

@media (max-width: 400px) {
    .search-form { flex-direction: column; border-radius: var(--radius); }
    .search-input, .search-btn {
        border-radius: var(--radius-sm) !important;
        border: 2px solid var(--border) !important;
    }
    .search-btn { justify-content: center; }
}
