/*
 * Ultra CMS — Dark News Theme (loads LAST — overrides all previous CSS)
 * اتجاه بصري: عصري داكن، ذهبي/بنفسجي، glassmorphism، صحافة راقية
 * ─────────────────────────────────────────────────────────────────
 * يستخدم --theme-* variables من لوحة التحكم عند وجودها
 * fallback للقيم الداكنة الافتراضية إذا لم يحدد الأدمن شيئاً
 */

/* ═══ Design Tokens ═══ */
:root {
    /* Admin-customizable via --theme-primary, --theme-secondary */
    --gold:          var(--theme-primary, #d4a843);
    --gold-light:    #f0c84e;
    --gold-dim:      rgba(212,168,67,0.12);
    --purple:        var(--theme-secondary, #8b5cf6);
    --purple-light:  #a78bfa;
    --purple-dim:    rgba(139,92,246,0.12);

    /* Backgrounds — admin can override via bg_color setting */
    --bg-base:       var(--theme-bg, #0c0c12);
    --bg-surface:    #13131e;
    --bg-card:       #1a1a28;
    --bg-card-hover: #20202f;
    --bg-glass:      rgba(255,255,255,0.04);
    --border-subtle: rgba(255,255,255,0.07);
    --border-accent: rgba(212,168,67,0.25);

    /* Text — admin can override via text_color */
    --text-primary:  var(--theme-text, #f0f0f5);
    --text-secondary:#9999b8;
    --text-muted:    #5a5a7a;

    /* Radii */
    --radius-sm:     8px;
    --radius-md:     14px;
    --radius-lg:     20px;
    --radius-xl:     28px;

    /* Shadows */
    --shadow-card:   0 4px 24px rgba(0,0,0,0.4);
    --shadow-hover:  0 12px 40px rgba(0,0,0,0.6);
    --shadow-glow:   0 0 30px rgba(212,168,67,0.15);

    --transition:    0.3s cubic-bezier(0.4,0,0.2,1);

    /* ═══ Override old token variables used by other CSS files ═══ */
    --primary-color:   var(--theme-primary, #d4a843);
    --secondary-color: var(--theme-secondary, #8b5cf6);
    --accent-color:    var(--theme-primary, #d4a843);
    --bg-body:         var(--theme-bg, #0c0c12);
    --bg-light:        #0c0c12;
    --text-main:       var(--theme-text, #f0f0f5);
    --border-color:    rgba(255,255,255,0.07);
    --bg-header:       rgba(12,12,18,0.95);

    /* ═══ Bootstrap overrides ═══ */
    --bs-body-bg:      var(--theme-bg, #0c0c12);
    --bs-body-color:   var(--theme-text, #f0f0f5);
    --bs-card-bg:      #1a1a28;
    --bs-card-color:   #f0f0f5;
    --bs-border-color: rgba(255,255,255,0.07);
    --bs-primary:      var(--theme-primary, #d4a843);
    --bs-secondary:    var(--theme-secondary, #8b5cf6);
    --bs-light:        #1a1a28;
    --bs-dark:         #f0f0f5;
}

/* ═══ Base Reset ═══ */
body {
    background: var(--bg-base) !important;
    color: var(--text-primary) !important;
    font-family: var(--theme-font-ar, 'Tajawal'), 'Cairo', sans-serif;
    min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ═══ Bootstrap Dark Overrides ═══ */
.card, .card-body { background-color: var(--bg-card) !important; color: var(--text-primary); border-color: var(--border-subtle) !important; }
.bg-white, .bg-light { background-color: var(--bg-card) !important; }
.text-dark { color: var(--text-primary) !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.border, .border-bottom, .border-top { border-color: var(--border-subtle) !important; }
.shadow-sm, .shadow { box-shadow: var(--shadow-card) !important; }
.breadcrumb-item a { color: var(--text-muted) !important; }
.breadcrumb-item.active { color: var(--text-secondary) !important; }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted) !important; }
.form-control, .form-select { background-color: var(--bg-surface) !important; color: var(--text-primary) !important; border-color: var(--border-subtle) !important; }
.form-control:focus, .form-select:focus { border-color: var(--border-accent) !important; box-shadow: 0 0 0 3px var(--gold-dim) !important; }
.badge.bg-primary { background: var(--gold) !important; color: #0c0c12 !important; }
.badge.bg-light { background: var(--bg-glass) !important; color: var(--text-secondary) !important; }
.btn-primary { background: var(--gold) !important; border-color: var(--gold) !important; color: #0c0c12 !important; }
.btn-outline-primary { color: var(--gold) !important; border-color: var(--gold) !important; }
.btn-outline-primary:hover { background: var(--gold) !important; color: #0c0c12 !important; }
.dropdown-menu { background: var(--bg-card) !important; border-color: var(--border-subtle) !important; }
.dropdown-item { color: var(--text-secondary) !important; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--gold-dim) !important; color: var(--gold) !important; }

/* ═══ Scrollbar ═══ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ═══ Navbar Override ═══ */
.navbar, nav.navbar {
    background: rgba(12,12,18,0.95) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.navbar-brand, .nav-link { color: var(--text-primary) !important; }
.nav-link:hover { color: var(--gold) !important; }

/* ═══ Ticker ═══ */
.news-ticker, .ticker-wrap {
    background: linear-gradient(90deg, #1a1a28 0%, #20202f 100%) !important;
    border-top: 1px solid var(--border-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

/* ═══════════════════════════════════════
   HOME — Hero Slider
   ═══════════════════════════════════════ */
.hero-card {
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-subtle);
    transition: box-shadow var(--transition);
}
.hero-card:hover { box-shadow: var(--shadow-hover); }
.hero-overlay {
    background: linear-gradient(0deg, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.55) 45%, transparent 100%);
}
.trending-badge {
    background: linear-gradient(135deg, var(--gold), #e8b855);
    color: #0c0c12;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 4px 14px;
    border-radius: 20px;
    text-transform: uppercase;
}

/* ═══ Trending Sidebar ═══ */
.trending-sidebar {
    background: var(--bg-glass);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.trending-sidebar .section-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 1.25rem;
}
.trending-item {
    display: flex;
    gap: 12px;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    transition: var(--transition);
}
.trending-item:last-child { border-bottom: none; padding-bottom: 0; }
.trending-item:hover .trending-title { color: var(--gold); }
.trending-num {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--border-accent);
    line-height: 1;
    min-width: 36px;
}
.trending-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    transition: color var(--transition);
}
.trending-meta { font-size: 0.75rem; color: var(--text-muted); }

/* ═══ Category Pills ═══ */
.category-pills-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    padding: 1rem 0;
}
.category-pill {
    background: var(--bg-glass) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-subtle) !important;
    padding: 7px 20px;
    border-radius: 30px;
    font-size: 0.875rem;
    font-weight: 600;
    transition: all var(--transition);
    text-decoration: none;
    cursor: pointer;
}
.category-pill:hover,
.category-pill.active {
    background: linear-gradient(135deg, var(--gold), #e8b855) !important;
    color: #0c0c12 !important;
    border-color: transparent !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212,168,67,0.35);
}

/* ═══ POST CARDS ═══ */
.post-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
    box-shadow: var(--shadow-card);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.post-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-accent) !important;
    box-shadow: var(--shadow-hover), var(--shadow-glow);
}
.post-card .card-img-wrap {
    overflow: hidden;
    height: 200px;
    position: relative;
}
.post-card .card-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4,0,0.2,1);
}
.post-card:hover .card-img-wrap img { transform: scale(1.08); }
.post-card .cat-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--gold) !important;
    color: #0c0c12 !important;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 3px 12px;
    border-radius: 20px;
    z-index: 2;
}
.post-card .card-body {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card) !important;
}
.post-card .card-title a {
    color: var(--text-primary) !important;
    font-weight: 700;
    font-size: 0.975rem;
    line-height: 1.55;
    transition: color var(--transition);
}
.post-card:hover .card-title a { color: var(--gold) !important; }
.post-card .card-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.7;
    flex-grow: 1;
}
.post-card .card-footer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-subtle) !important;
    margin-top: auto;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ═══ SECTION HEADERS ═══ */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.75rem;
}
.section-header h3, .section-header h2 {
    font-weight: 800;
    font-size: 1.4rem;
    margin: 0;
    color: var(--text-primary);
}
.section-header::before {
    content: '';
    display: block;
    width: 4px;
    height: 28px;
    background: linear-gradient(180deg, var(--gold), var(--purple));
    border-radius: 4px;
    flex-shrink: 0;
}

/* ═══ CATEGORY HERO ═══ */
.category-hero {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-card) 100%) !important;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}
.category-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(212,168,67,0.12) 0%, transparent 70%);
    pointer-events: none;
}
.category-hero h1 { color: var(--text-primary); font-weight: 900; font-size: clamp(1.5rem, 4vw, 2.25rem); }
.category-hero .cat-icon { color: var(--gold); }
.category-hero .cat-count {
    display: inline-block;
    background: var(--gold-dim);
    color: var(--gold);
    border: 1px solid var(--border-accent);
    padding: 4px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

/* ═══ PAGINATION ═══ */
.pagination-dark {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 3rem;
}
.pagination-dark .page-item .page-link,
.pagination-dark .page-link {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-subtle) !important;
    color: var(--text-secondary) !important;
    border-radius: 10px !important;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    transition: all var(--transition);
}
.pagination-dark .page-item .page-link:hover,
.pagination-dark .page-link:hover {
    background: var(--gold-dim) !important;
    border-color: var(--border-accent) !important;
    color: var(--gold) !important;
    transform: translateY(-2px);
}
.pagination-dark .page-item.active .page-link,
.pagination-dark .active .page-link {
    background: linear-gradient(135deg, var(--gold), #e8b855) !important;
    border-color: transparent !important;
    color: #0c0c12 !important;
    box-shadow: 0 4px 15px rgba(212,168,67,0.4);
}
/* Bootstrap pagination override */
.pagination .page-link {
    background: var(--bg-card);
    border-color: var(--border-subtle);
    color: var(--text-secondary);
}
.pagination .page-item.active .page-link {
    background: var(--gold);
    border-color: var(--gold);
    color: #0c0c12;
}

/* ═══ SINGLE POST ═══ */
.post-content {
    font-size: 1.1rem;
    line-height: 2;
    color: #c8c8d8;
    font-family: 'Tajawal', sans-serif;
}
.post-content p { margin-bottom: 1.5rem; }
.post-content h2, .post-content h3 {
    color: var(--text-primary) !important;
    font-weight: 800;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-right: 0.75rem;
    border-right: 3px solid var(--gold);
}
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
    margin: 1.5rem 0;
    border: 1px solid var(--border-subtle);
}
.post-content blockquote {
    border-right: 4px solid var(--gold);
    padding: 1rem 1.5rem;
    margin: 2rem 0;
    background: var(--bg-glass);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    font-style: italic;
}
.post-content a { color: var(--gold); border-bottom: 1px solid var(--border-accent); }
.post-content a:hover { color: var(--gold-light); }

.post-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-subtle) !important;
    margin-bottom: 2rem;
}
.post-header h1 { color: var(--text-primary); font-weight: 900; line-height: 1.5; }
.post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.post-meta i { color: var(--gold); margin-left: 4px; }
.post-featured-img {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 2rem;
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-card);
}

/* Share buttons */
.share-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    text-decoration: none !important;
    font-size: 1rem;
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary) !important;
}
.share-btn:hover { transform: translateY(-4px); box-shadow: 0 8px 20px rgba(0,0,0,0.4); border-color: var(--border-accent); }
.share-btn.twitter:hover  { background: #1da1f2; border-color: #1da1f2; color: #fff !important; }
.share-btn.facebook:hover { background: #1877f2; border-color: #1877f2; color: #fff !important; }
.share-btn.whatsapp:hover { background: #25d366; border-color: #25d366; color: #fff !important; }
.share-btn.telegram:hover { background: #0088cc; border-color: #0088cc; color: #fff !important; }

/* Tags */
.tag-link {
    background: var(--bg-glass) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-subtle) !important;
    padding: 5px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    text-decoration: none !important;
    transition: all var(--transition);
    display: inline-block;
}
.tag-link:hover {
    background: var(--purple-dim) !important;
    color: var(--purple-light) !important;
    border-color: rgba(139,92,246,0.3) !important;
}

/* Related posts */
.related-card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition);
}
.related-card:hover { border-color: var(--border-accent); transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.related-card img { height: 140px; object-fit: cover; width: 100%; }
.related-card .related-body { padding: 1rem; }
.related-card .related-title a { color: var(--text-primary) !important; font-weight: 700; font-size: 0.9rem; line-height: 1.5; transition: color var(--transition); }
.related-card:hover .related-title a { color: var(--gold) !important; }

/* Comments */
.comments-section {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-lg);
    padding: 2rem;
    margin-top: 2.5rem;
}
.comment-item { padding-bottom: 1.25rem; border-bottom: 1px solid var(--border-subtle) !important; margin-bottom: 1.25rem; }
.comment-item:last-child { border-bottom: none !important; }
.comment-name { color: var(--text-primary); font-weight: 700; }
.comment-text { color: var(--text-secondary); line-height: 1.8; }
.comment-date { color: var(--text-muted); font-size: 0.8rem; }

/* Form inputs (dark) */
.dark-input {
    background: var(--bg-surface) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-primary) !important;
    padding: 0.75rem 1rem !important;
    transition: all var(--transition);
}
.dark-input:focus { border-color: var(--border-accent) !important; box-shadow: 0 0 0 3px var(--gold-dim) !important; }
.dark-input::placeholder { color: var(--text-muted) !important; }

/* Gold button */
.btn-gold {
    background: linear-gradient(135deg, var(--gold), #e8b855) !important;
    color: #0c0c12 !important;
    border: none;
    border-radius: 30px;
    padding: 0.6rem 1.75rem;
    font-weight: 800;
    transition: all var(--transition);
    font-family: 'Tajawal', sans-serif;
    text-decoration: none;
    display: inline-block;
}
.btn-gold:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(212,168,67,0.45); color: #0c0c12 !important; }

/* ═══ SEARCH PAGE ═══ */
.search-hero {
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-card)) !important;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    text-align: center;
    border: 1px solid var(--border-subtle);
}
.search-input-wrap { max-width: 600px; margin: 0 auto; position: relative; }
.search-input-wrap input {
    background: var(--bg-base) !important;
    border: 2px solid var(--border-accent) !important;
    border-radius: 50px !important;
    padding: 0.85rem 3.5rem 0.85rem 1.5rem !important;
    font-size: 1rem;
    color: var(--text-primary) !important;
}
.search-input-wrap input:focus { box-shadow: 0 0 0 4px var(--gold-dim) !important; border-color: var(--gold) !important; }
.search-input-wrap .search-icon { position: absolute; left: 1.25rem; top: 50%; transform: translateY(-50%); color: var(--gold); }

/* ═══ FOOTER ═══ */
footer {
    background: var(--bg-surface) !important;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-secondary) !important;
}
footer a { color: var(--text-secondary) !important; transition: color var(--transition); }
footer a:hover { color: var(--gold) !important; }

/* ═══ GLASS UTILITY ═══ */
.glass-card {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}
.text-gold { color: var(--gold) !important; }
.text-dim  { color: var(--text-muted) !important; }
.bg-dark-card { background: var(--bg-card) !important; }

/* Reading progress bar */
#readProgress {
    background: linear-gradient(90deg, var(--gold), var(--purple));
    box-shadow: 0 0 10px rgba(212,168,67,0.5);
}

/* ═══ Catch-all white backgrounds from Bootstrap/old CSS ═══ */
.rounded-4, .rounded-3 { background-color: var(--bg-card); }
.card-footer { background: transparent !important; border-top-color: var(--border-subtle) !important; }

/* ═══ Responsive ═══ */
@media (max-width: 768px) {
    .hero-card { border-radius: var(--radius-lg); }
    .category-hero { padding: 1.5rem; }
    .section-header h3 { font-size: 1.15rem; }
    .post-card .card-img-wrap { height: 160px; }
}
