/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --primary-color: #3498db;
    --secondary-color: #2980b9;
    --dark-color: #1e293b;
    --glass-bg: rgba(255, 255, 255, 0.9);
    --glass-shadow: 0 8px 32px rgba(31, 38, 135, 0.1);
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-color: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --radius: 16px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dark-mode {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-color: #f1f5f9;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --glass-bg: rgba(15, 23, 42, 0.9);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

img,
video,
iframe,
embed,
object {
    max-width: 100%;
    height: auto;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    direction: rtl;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(circle at top right, var(--primary-color) -50%, transparent 40%),
        radial-gradient(circle at bottom left, var(--secondary-color) -50%, transparent 40%);
    opacity: 0.1;
    z-index: -1;
    pointer-events: none;
}

/* Modern Stacked Header */
.site-header {
    background: linear-gradient(135deg, var(--primary-color), var(--dark-color));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-top {
    text-align: center;
    padding: 0.6rem 0 0.4rem 0;
    position: relative;
    /* Adding the premium AI generated background inside the header with overlay */
    background-image:
        linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.8)),
        url('../img/header_bg_premium.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.brand-link {
    display: inline-block;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.brand-link:hover {
    transform: scale(1.05);
}

.brand-main {
    font-size: 2.3rem;
    font-weight: 800;
    color: #fff;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
    margin-bottom: 0px;
    line-height: 1.1;
    font-family: inherit;
}

.brand-sub {
    font-size: 1.2rem;
    color: #f1f5f9;
    font-weight: 500;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .brand-main {
        font-size: 1.8rem;
    }

    .brand-sub {
        font-size: 0.95rem;
    }

    .header-top {
        padding: 0.4rem 0 0.2rem 0;
    }
}

.header-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 15px 5%;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.header-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 700;
    padding: 8px 15px;
    border-radius: 20px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
}

.header-nav a:hover,
.header-nav a.active {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.nav-divider {
    width: 2px;
    background: rgba(255, 255, 255, 0.2);
    height: 30px;
    margin: 0 5px;
    align-self: center;
}

.admin-btn {
    background: #eab308 !important;
    /* Gold */
    color: #422006 !important;
    border-color: #fef08a !important;
}

.admin-btn:hover {
    background: #fde047 !important;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.5) !important;
}

.login-btn {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px dashed rgba(255, 255, 255, 0.5) !important;
}

/* Mobile Responsiveness for Header Navigation */
@media (max-width: 768px) {
    .header-nav {
        padding: 10px 5px;
        gap: 6px;
        justify-content: center;
        flex-wrap: wrap;
    }

    .header-nav a {
        font-size: 0.85rem;
        padding: 6px 10px;
        border-radius: 8px;
        flex: 1 1 calc(33% - 10px);
        justify-content: center;
        white-space: nowrap;
    }

    .nav-divider {
        display: none;
        /* Hide vertical divider on small screens */
    }

    .user-dropdown {
        width: 100%;
        text-align: center;
        margin-top: 5px;
    }

    .dropdown-toggle {
        justify-content: center !important;
    }
}

/* User Dropdown */
.user-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-menu {
    position: absolute;
    top: 130%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--dark-color);
    min-width: 220px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    padding: 10px;
}

.user-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 12px;
    height: 12px;
    background: var(--dark-color);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.dropdown-menu a {
    padding: 10px 15px !important;
    margin: 3px 0;
    justify-content: flex-start !important;
    border: none !important;
    border-radius: 8px !important;
    width: 100%;
}

.dropdown-menu a:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    transform: none !important;
    box-shadow: none !important;
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 0;
}

.user-btn {
    background: rgba(20, 184, 166, 0.15) !important;
    color: #5eead4 !important;
}

.user-btn:hover {
    background: rgba(20, 184, 166, 0.3) !important;
}

.logout-btn {
    color: #fca5a5 !important;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 280px 1fr 280px;
    gap: 2rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

/* Article Cards */
.article-card {
    background: var(--glass-bg);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.4);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.article-image {
    width: 100%;
    height: 250px;
    border-radius: calc(var(--radius) - 4px);
    object-fit: cover;
    margin-bottom: 1rem;
    transition: transform 0.5s ease;
}

.article-card:hover .article-image {
    transform: scale(1.02);
}

.article-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.article-title a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.article-title a:hover {
    color: var(--primary-color);
}

.meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    display: flex;
    gap: 15px;
}

.meta i {
    color: var(--primary-color);
}

.excerpt {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.action-btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: bold;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    color: white;
}

/* Sidebars */
.sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.block {
    background: var(--glass-bg);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.block h3 {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 1rem;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.block-content {
    padding: 1rem;
}

.block-content a {
    display: block;
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.block-content a:last-child {
    border-bottom: none;
}

.block-content a:hover {
    color: var(--primary-color);
    padding-right: 10px;
}

/* Themes Config - We inject this to the body class or :root inline, but defaults are here */

/* Footer column styles */
.footer-about,
.footer-links,
.footer-contact {
    min-width: 0;
}

/* Premium Dynamic Footer */
.site-footer {
    background: linear-gradient(to bottom, var(--dark-color), #0a0f18);
    color: white;
    margin-top: 5rem;
    position: relative;
    border-top: 4px solid var(--primary-color);
    font-family: 'Tajawal', sans-serif;
    overflow: hidden;
}

/* Subtle background pattern for the footer */
.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 255, 255, 0.03) 0%, transparent 20%);
    pointer-events: none;
    z-index: 0;
}

.footer-top {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 4rem;
    padding: 5rem 10%;
    position: relative;
    z-index: 1;
}

.site-footer h3 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1.8rem;
    position: relative;
    padding-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
}

.site-footer h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 3px;
    background: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s;
}

.site-footer:hover h3::after {
    width: 80px;
}

.site-footer h3 i {
    color: var(--primary-color);
    font-size: 1.8rem;
}

.footer-about p {
    color: #cbd5e1;
    line-height: 1.9;
    font-size: 1.05rem;
}

.contact-info-list {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.contact-info-list li {
    margin-bottom: 1.2rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.05rem;
}

.contact-info-list i {
    color: var(--primary-color);
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
    transition: var(--transition);
}

.contact-info-list li:hover i {
    transform: scale(1.2);
    text-shadow: 0 0 10px var(--primary-color);
}

.social-links {
    display: flex;
    gap: 12px;
    margin-top: 1.5rem;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    text-decoration: none;
    font-size: 1.3rem;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-icon:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-8px) rotate(8deg);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
    border-color: var(--primary-color);
}

.footer-bottom {
    background: rgba(0, 0, 0, 0.4);
    padding: 1.5rem 10%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.05rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
}

.copyright {
    color: #94a3b8;
    text-align: center;
}

.dev-name {
    color: #f1c40f;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.3);
    transition: color 0.3s;
}

.dev-name:hover {
    color: #fff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

@media (max-width: 992px) {
    .footer-top {
        grid-template-columns: 1fr !important;
        gap: 3rem;
        padding: 4rem 5%;
    }
}

@media (max-width: 768px) {
    .footer-bottom {
        flex-direction: column;
        gap: 15px;
        text-align: center;
        justify-content: center;
    }

    .dev-credits {
        flex-direction: column;
        gap: 5px;
    }
}

/* Layout for Main Portal */
.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.portal-section-card {
    background: var(--glass-bg);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    box-shadow: var(--glass-shadow);
    transition: var(--transition);
    border-top: 5px solid var(--primary-color);
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.portal-section-card i {
    font-size: 3rem;
    color: var(--primary-color);
    background: rgba(0, 0, 0, 0.05);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.portal-section-card:hover {
    transform: translateY(-10px);
}

.portal-section-card:hover i {
    transform: scale(1.1) rotate(5deg);
    background: var(--primary-color);
    color: white;
}

.portal-section-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.sidebar-item-link {
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
}

.sidebar-item-link:hover {
    background: rgba(0, 0, 0, 0.02);
    border-right: 3px solid var(--primary-color);
    padding-right: 15px !important;
}

@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr !important;
        display: flex !important;
        flex-direction: column-reverse !important;
        align-items: stretch !important;
    }

    .main-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Force the sidebar to display and take full width */
    .sidebar,
    aside {
        display: block !important;
        width: 100% !important;
        position: relative !important;
        top: 0 !important;
        margin-top: 2rem;
    }


    .block {
        width: 100%;
    }
}

/* ══════════════════════════════════════════════════════
   PRINT & PDF STYLES
   ══════════════════════════════════════════════════════ */
@media print {

    .site-header,
    .site-footer,
    .sidebar,
    .interaction-bar,
    .comment-form,
    .nav-divider,
    .user-dropdown,
    .login-btn,
    #dark-mode-toggle,
    .related-articles-section,
    .thanks-note,
    .social-share,
    .ads-container,
    .top-ads,
    .bottom-ads,
    .popup-ads,
    button,
    .action-btn,
    #today-in-history-block {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        padding: 0 !important;
        background-image: none !important;
    }

    body::before {
        display: none !important;
    }

    .container {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        max-width: 100% !important;
    }

    .main-content {
        width: 100% !important;
    }

    .article-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        background: transparent !important;
    }

    .article-title,
    .section-title {
        color: black !important;
        margin-top: 0 !important;
    }

    .article-body {
        font-size: 12pt !important;
    }

    a {
        text-decoration: underline !important;
        color: black !important;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}

/* ══════════════════════════════════════
   BREADCRUMBS
══════════════════════════════════════ */
.breadcrumb-container {
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.02);
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
}

.breadcrumb-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    color: #64748b;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
    color: var(--secondary-color);
}

.breadcrumb-item:not(:last-child):after {
    content: '\f104';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-right: 8px;
    font-size: 0.75rem;
    opacity: 0.5;
}

.breadcrumb-item.active {
    color: #1e293b;
    opacity: 0.8;
}

/* ══════════════════════════════════════
   READING PROGRESS BAR
══════════════════════════════════════ */
.reading-progress-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 5px;
    z-index: 9999;
    background: transparent;
}

#reading-progress {
    height: 100%;
    width: 0%;
    background: linear-gradient(to left, var(--primary-color), var(--secondary-color));
    border-radius: 0 5px 5px 0;
    transition: width 0.1s linear;
}

/* ══════════════════════════════════════
   BACK TO TOP BUTTON
══════════════════════════════════════ */
#backToTop {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s;
}

#backToTop:hover {
    transform: translateY(-5px);
    background: var(--secondary-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

/* ══════════════════════════════════════
   PRINT OPTIMIZATION
══════════════════════════════════════ */
@media print {

    .header,
    .footer,
    .sidebar,
    .sidebar-widget,
    .top-ads,
    .ticker-container,
    .hero-section,
    .stats-bar,
    .breadcrumb-container,
    .interaction-bar,
    .comment-section,
    .back-to-top,
    .reading-progress-wrap,
    header,
    footer,
    aside,
    button,
    nav,
    .ads,
    .ticker-row {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
        padding: 0 !important;
        margin: 1cm !important;
    }

    .main-wrap,
    .page-layout,
    main,
    .article-container {
        display: block !important;
        width: 100% !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .page-layout {
        grid-template-columns: 1fr !important;
    }

    h1 {
        font-size: 24pt;
        margin-bottom: 0.5cm;
    }

    .article-body {
        font-size: 11pt;
        line-height: 1.6;
    }

    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}