/* =============================================
   Watar - Main Stylesheet
   Dual-Mode: Light (default) & Dark
   ============================================= */

/* --- CSS Variables --- */
:root {
    /* === Core Colors (shared) === */
    --primary-color: #456882;
    --primary-rgb: 69, 104, 130;
    --primary-light: #5a7d99;
    --secondary-color: #E3E3E3;
    --secondary-rgb: 227, 227, 227;

    /* === Light Mode (default) — Soft & Professional === */
    --bg-body: #f4f6f9;
    --bg-body-rgb: 244, 246, 249;
    --bg-alt: #eaeff4;
    --bg-section: #ffffff;
    --bg-section-alt: #f9fafb;
    --text-color: #1a2b3a;
    --text-muted: #5a6b7a;
    --text-hint: #8e99a4;

    /* Navbar */
    --navbar-bg: rgba(255, 255, 255, 0.92);
    --navbar-border: rgba(69, 104, 130, 0.12);
    --navbar-shadow: 0 1px 3px rgba(69, 104, 130, 0.08), 0 4px 12px rgba(69, 104, 130, 0.04);

    /* Cards */
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(69, 104, 130, 0.14);
    --card-shadow: 0 1px 3px rgba(69, 104, 130, 0.06), 0 4px 16px rgba(69, 104, 130, 0.06);
    --card-hover-border: rgba(69, 104, 130, 0.30);
    --card-hover-shadow: 0 4px 12px rgba(69, 104, 130, 0.10), 0 12px 32px rgba(69, 104, 130, 0.12);

    /* Misc */
    --scrollbar-track: #eaeff4;
    --hero-fade-rgb: 11, 18, 24;
    --lang-text: #5a6b7a;
    --lang-hover: #1a2b3a;
    --hamburger-color: #1a2b3a;

    /* Effects */
    --accent-glow: 0 0 15px rgba(69, 104, 130, 0.18);
    --braqa-glow: 0 0 20px rgba(69, 104, 130, 0.08);
    --glow-sm: 0 0 12px rgba(69, 104, 130, 0.15);
    --glow-lg: 0 8px 24px rgba(69, 104, 130, 0.14);
    --glow-lg-hover: 0 8px 32px rgba(69, 104, 130, 0.22);
    --braqa-opacity: 0.35;

    /* Divider */
    --divider-color: rgba(69, 104, 130, 0.12);

    /* Mobile Menu */
    --menu-bg: #ffffff;
    --menu-bg-alt: #f4f6f9;
    --menu-shadow: rgba(69, 104, 130, 0.15);
    --menu-backdrop: rgba(26, 43, 58, 0.25);
}

html.dark {
    /* === Dark Mode === */
    --bg-body: #0b1218;
    --bg-body-rgb: 11, 18, 24;
    --bg-alt: #0d1820;
    --bg-section: #101c26;
    --bg-section-alt: #0d1820;
    --text-color: #ffffff;
    --text-muted: rgba(227, 227, 227, 0.6);
    --text-hint: rgba(227, 227, 227, 0.4);

    /* Navbar */
    --navbar-bg: rgba(11, 18, 24, 0.8);
    --navbar-border: rgba(69, 104, 130, 0.2);
    --navbar-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);

    /* Cards */
    --card-bg: rgba(69, 104, 130, 0.08);
    --card-border: rgba(69, 104, 130, 0.3);
    --card-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.1);
    --card-hover-border: rgba(227, 227, 227, 0.5);
    --card-hover-shadow: 0 0 20px rgba(69, 104, 130, 0.3);

    /* Misc */
    --scrollbar-track: #0b1218;
    --hero-fade-rgb: 11, 18, 24;
    --lang-text: rgba(227, 227, 227, 0.6);
    --lang-hover: #ffffff;
    --hamburger-color: #ffffff;

    /* Effects */
    --accent-glow: 0 0 15px rgba(69, 104, 130, 0.4);
    --braqa-glow: 0 0 20px rgba(227, 227, 227, 0.2);
    --glow-sm: 0 0 15px rgba(69, 104, 130, 0.4);
    --glow-lg: 0 10px 30px rgba(69, 104, 130, 0.4);
    --glow-lg-hover: 0 10px 40px rgba(69, 104, 130, 0.6);
    --braqa-opacity: 0.8;

    /* Divider */
    --divider-color: rgba(69, 104, 130, 0.25);

    /* Mobile Menu */
    --menu-bg: #0d1820;
    --menu-bg-alt: #0b1218;
    --menu-shadow: rgba(0, 0, 0, 0.5);
    --menu-backdrop: rgba(0, 0, 0, 0.6);
}

/* --- Base Styles --- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Glossy Card Effect --- */
.glossy-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    box-shadow: var(--card-shadow);
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

html.dark .glossy-card {
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15) 0%, rgba(var(--primary-rgb), 0.05) 100%);
}

.glossy-card:hover {
    border-color: var(--card-hover-border);
    box-shadow: var(--card-hover-shadow);
}

/* Light mode: subtle inner highlight on cards */
html:not(.dark) .glossy-card {
    background: linear-gradient(160deg, rgba(255,255,255, 0.95) 0%, rgba(244,246,249, 0.80) 100%);
    box-shadow: var(--card-shadow), inset 0 1px 0 rgba(255,255,255,0.8);
}

html:not(.dark) .glossy-card:hover {
    background: linear-gradient(160deg, rgba(255,255,255, 1) 0%, rgba(244,246,249, 0.90) 100%);
    box-shadow: var(--card-hover-shadow), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* --- Hero Gradient Overlay --- */
.hero-gradient {
    background: linear-gradient(0deg, rgba(var(--hero-fade-rgb), 1) 0%, rgba(var(--hero-fade-rgb), 0.4) 50%, rgba(var(--hero-fade-rgb), 0) 100%);
}

/* --- Braqa Border Effect --- */
.braqa-border {
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    position: relative;
}

html:not(.dark) .braqa-border {
    border-color: rgba(var(--primary-rgb), 0.12);
}

html.dark .braqa-border {
    border-color: rgba(var(--primary-rgb), 0.4);
}

.braqa-border::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(45deg, transparent, rgba(var(--primary-rgb), var(--braqa-opacity)), transparent);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    -webkit-mask-composite: xor;
    pointer-events: none;
}

/* --- Section Divider --- */
.section-divider {
    background: linear-gradient(90deg, transparent, var(--divider-color), transparent);
    height: 1px;
    width: 100%;
}

/* --- Primary Glow Effects --- */
.primary-glow {
    box-shadow: var(--glow-sm);
}

.primary-glow-lg {
    box-shadow: var(--glow-lg);
}

.primary-glow-lg:hover {
    box-shadow: var(--glow-lg-hover);
}

/* --- Navbar Glass Effect --- */
.navbar-glass {
    background: var(--navbar-bg);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--navbar-border);
    box-shadow: var(--navbar-shadow);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

/* --- Line Clamp Utilities --- */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* --- Card Hover Effect --- */
.card-hover {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-3px);
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-light);
}

/* =============================================
   Hero Slider Styles
   ============================================= */
.hero-slider {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.hero-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    z-index: 0;
}

.hero-slide.active {
    opacity: 1;
    visibility: visible;
    z-index: 2;
    animation: slideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.hero-slide.prev {
    z-index: 1;
    animation: slideOut 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slideIn {
    0% { opacity: 0; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes slideOut {
    0% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.95); }
}

.hero-slide .slide-image {
    transition: transform 10s ease-out;
    transform: scale(1);
}

.hero-slide.active .slide-image {
    transform: scale(1.15);
}

/* Slide Content Animations */
.hero-slide .slide-content {
    opacity: 0;
    transform: translateY(40px);
    transition: none;
}

.hero-slide.active .slide-content {
    animation: contentFadeIn 0.6s ease-out 0.3s forwards;
}

@keyframes contentFadeIn {
    0% { opacity: 0; transform: translateY(40px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-slide .slide-tag {
    opacity: 0;
    transition: none;
}

[dir="rtl"] .hero-slide .slide-tag {
    transform: translateX(30px);
}
[dir="ltr"] .hero-slide .slide-tag {
    transform: translateX(-30px);
}

.hero-slide.active .slide-tag {
    animation: tagSlideIn 0.5s ease-out 0.2s forwards;
}

@keyframes tagSlideIn {
    0% { opacity: 0; }
    100% { opacity: 1; transform: translateX(0); }
}

.hero-slide .slide-title {
    opacity: 0;
    transform: translateY(50px);
    transition: none;
}

.hero-slide.active .slide-title {
    animation: titleSlideUp 0.7s cubic-bezier(0.4, 0, 0.2, 1) 0.35s forwards;
}

@keyframes titleSlideUp {
    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-slide .slide-description {
    opacity: 0;
    transform: translateY(30px);
    transition: none;
}

.hero-slide.active .slide-description {
    animation: descFadeIn 0.6s ease-out 0.5s forwards;
}

@keyframes descFadeIn {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

.hero-slide .slide-actions {
    opacity: 0;
    transform: translateY(25px);
    transition: none;
}

.hero-slide.active .slide-actions {
    animation: actionsFadeIn 0.6s ease-out 0.65s forwards;
}

@keyframes actionsFadeIn {
    0% { opacity: 0; transform: translateY(25px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* =============================================
   Slider Navigation
   ============================================= */
.slider-dots {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}

.slider-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
}

.slider-dot:hover {
    background: rgba(255, 255, 255, 0.5);
}

.slider-dot.active {
    background: var(--primary-color);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.6);
}

.slider-dot.active::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--primary-color);
    border-top-color: transparent;
    animation: dot-progress 6s linear infinite;
}

@keyframes dot-progress {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Slider Arrow Buttons */
.slider-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(var(--primary-rgb), 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    opacity: 0;
}

.hero-slider-container:hover .slider-arrow {
    opacity: 1;
}

.slider-arrow:hover {
    background: rgba(var(--primary-rgb), 0.6);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 0 20px rgba(var(--primary-rgb), 0.5);
}

/* RTL arrow positions */
[dir="rtl"] .slider-arrow.prev { right: 20px; }
[dir="rtl"] .slider-arrow.next { left: 20px; }

/* LTR arrow positions */
[dir="ltr"] .slider-arrow.prev { left: 20px; }
[dir="ltr"] .slider-arrow.next { right: 20px; }

@media (max-width: 768px) {
    .slider-arrow {
        width: 40px;
        height: 40px;
        opacity: 1;
    }
    [dir="rtl"] .slider-arrow.prev { right: 10px; }
    [dir="rtl"] .slider-arrow.next { left: 10px; }
    [dir="ltr"] .slider-arrow.prev { left: 10px; }
    [dir="ltr"] .slider-arrow.next { right: 10px; }
}

/* =============================================
   Language Switcher
   ============================================= */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem;
    border-radius: 9999px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    transition: background 0.3s ease, border-color 0.3s ease;
}

html.dark .lang-switcher {
    background: rgba(var(--primary-rgb), 0.15);
    border-color: rgba(var(--primary-rgb), 0.3);
}

.lang-switcher a {
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--lang-text);
}

.lang-switcher a.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.4);
}

.lang-switcher a:hover:not(.active) {
    color: var(--lang-hover);
}

/* =============================================
   Dark Mode Toggle
   ============================================= */
.theme-toggle {
    position: relative;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: rgba(var(--primary-rgb), 0.2);
    transform: scale(1.1);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Light mode: show moon (click to go dark) */
.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

/* Dark mode: show sun (click to go light) */
html.dark .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}
html.dark .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: #fbbf24;
}

/* =============================================
   Mobile Hamburger Icon
   ============================================= */
.mobile-hamburger {
    width: 20px;
    height: 14px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.mobile-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--hamburger-color);
    border-radius: 2px;
    transition: all 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    transform-origin: center;
}

.mobile-hamburger span:nth-child(2) {
    width: 60%;
}

/* Active state → X */
.is-active .mobile-hamburger span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.is-active .mobile-hamburger span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.is-active .mobile-hamburger span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* =============================================
   Mobile Menu Overlay & Panel
   ============================================= */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 55;
    pointer-events: none;
    visibility: hidden;
}

.mobile-menu-overlay.is-open {
    pointer-events: auto;
    visibility: visible;
}

/* Backdrop */
.mobile-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.4s ease;
}

.mobile-menu-overlay.is-open .mobile-menu-backdrop {
    background: var(--menu-backdrop);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Panel Base */
.mobile-menu-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 85%;
    max-width: 340px;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, var(--menu-bg) 0%, var(--menu-bg-alt) 100%);
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    box-shadow: 0 25px 80px var(--menu-shadow);
    transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1), background 0.3s ease;
    will-change: transform;
}

html.dark .mobile-menu-panel {
    border-color: rgba(var(--primary-rgb), 0.15);
}

/* RTL → slides from right */
.mobile-menu-panel--rtl {
    right: 0;
    transform: translateX(105%);
    border-radius: 0 0 0 24px;
    border-right: none;
}

.mobile-menu-overlay.is-open .mobile-menu-panel--rtl {
    transform: translateX(0);
}

/* LTR → slides from left */
.mobile-menu-panel--ltr {
    left: 0;
    transform: translateX(-105%);
    border-radius: 0 24px 24px 0;
    border-left: none;
}

.mobile-menu-overlay.is-open .mobile-menu-panel--ltr {
    transform: translateX(0);
}

/* Staggered Link Animation */
.mobile-menu-item {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.35s ease, transform 0.35s ease;
    transition-delay: calc(var(--item-index, 0) * 0.05s + 0.15s);
}

[dir="ltr"] .mobile-menu-item {
    transform: translateX(-20px);
}

.mobile-menu-overlay.is-open .mobile-menu-item {
    opacity: 1;
    transform: translateX(0);
}

/* Active link glow line */
.mobile-menu-panel a.active-link::before {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 3px;
    background: var(--primary-color);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.6);
}

[dir="rtl"] .mobile-menu-panel a.active-link::before {
    right: 0;
}

[dir="ltr"] .mobile-menu-panel a.active-link::before {
    left: 0;
}

/* Hide mobile menu on desktop */
@media (min-width: 1024px) {
    .mobile-menu-overlay {
        display: none !important;
    }
}

/* =============================================
   Theme-Aware Text Utilities
   ============================================= */
.text-desc {
    color: var(--text-muted);
}

.text-hint {
    color: var(--text-hint);
}

/* =============================================
   Light Mode: Fix text-secondary visibility
   text-secondary (#E3E3E3) is too light on white bg.
   Override to use dark tones when NOT in dark mode.
   ============================================= */
html:not(.dark) .text-secondary\/40 { color: rgba(26, 43, 58, 0.35) !important; }
html:not(.dark) .text-secondary\/50 { color: rgba(26, 43, 58, 0.45) !important; }
html:not(.dark) .text-secondary\/60 { color: rgba(26, 43, 58, 0.52) !important; }
html:not(.dark) .text-secondary\/70 { color: rgba(26, 43, 58, 0.62) !important; }
html:not(.dark) .text-secondary\/80 { color: rgba(26, 43, 58, 0.72) !important; }
html:not(.dark) .text-secondary\/90 { color: rgba(26, 43, 58, 0.82) !important; }
html:not(.dark) .text-secondary { color: rgba(26, 43, 58, 0.88) !important; }

/* Keep text-white readable in light mode for non-overlay elements */
html:not(.dark) .text-white { color: var(--text-color) !important; }

/* Preserve white text on elements with dark/image backgrounds */
html:not(.dark) .bg-primary .text-white,
html:not(.dark) .bg-primary\/80 .text-white,
html:not(.dark) .bg-primary\/90 .text-white,
html:not(.dark) .bg-primary.text-white,
html:not(.dark) button.bg-primary,
html:not(.dark) .bg-red-500\/90,
html:not(.dark) .bg-black\/50,
html:not(.dark) .bg-black\/70,
html:not(.dark) .bg-black\/30,
html:not(.dark) .hero-slide .text-white,
html:not(.dark) .hero-slide h1,
html:not(.dark) .hero-slide p,
html:not(.dark) .hero-slide span,
html:not(.dark) .hero-slide button,
html:not(.dark) .hero-slide .text-secondary\/90,
html:not(.dark) .hero-slide .text-secondary,
html:not(.dark) .hero-slide .text-secondary\/70,
html:not(.dark) [class*="bg-gradient-to"] .absolute h3,
html:not(.dark) [class*="bg-gradient-to"] .absolute p,
html:not(.dark) [class*="bg-gradient-to"] .absolute span,
html:not(.dark) .bg-primary .material-icons,
html:not(.dark) .bg-primary .material-symbols-outlined,
html:not(.dark) .primary-glow .text-white { color: #ffffff !important; }

/* Fix hover states in light mode */
html:not(.dark) .hover\:text-white:hover { color: var(--primary-color) !important; }

/* Fix border-white variants in light mode */
html:not(.dark) .border-white\/5 { border-color: rgba(var(--primary-rgb), 0.06) !important; }
html:not(.dark) .border-white\/10 { border-color: rgba(var(--primary-rgb), 0.10) !important; }
html:not(.dark) .border-white\/20 { border-color: rgba(var(--primary-rgb), 0.15) !important; }
html:not(.dark) .border-white\/30 { border-color: rgba(var(--primary-rgb), 0.20) !important; }

/* Fix bg-white variants in light mode */
html:not(.dark) .bg-white\/5 { background-color: rgba(var(--primary-rgb), 0.05) !important; }
html:not(.dark) .bg-white\/10 { background-color: rgba(var(--primary-rgb), 0.08) !important; }
html:not(.dark) .bg-white\/20 { background-color: rgba(var(--primary-rgb), 0.12) !important; }

/* Fix bg-background-dark in light mode */
html:not(.dark) .bg-background-dark { background-color: var(--bg-body) !important; }
html:not(.dark) .from-background-dark { --tw-gradient-from: var(--bg-body) !important; }
html:not(.dark) .via-background-dark\/40 { --tw-gradient-via: rgba(var(--bg-body-rgb), 0.4) !important; }
html:not(.dark) .via-background-dark\/30 { --tw-gradient-via: rgba(var(--bg-body-rgb), 0.3) !important; }
html:not(.dark) .border-background-dark { border-color: var(--bg-body) !important; }

/* Fix placeholder text in light mode */
html:not(.dark) .placeholder\:text-secondary\/40::placeholder { color: rgba(26, 43, 58, 0.38) !important; }

/* =============================================
   Light Mode: Professional Enhancements
   ============================================= */

/* Body subtle pattern/texture for depth */
html:not(.dark) body {
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(ellipse at 20% 50%, rgba(var(--primary-rgb), 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(var(--primary-rgb), 0.02) 0%, transparent 50%);
}

/* Main content area: white card-like container feel */
html:not(.dark) main {
    position: relative;
}

/* Section alternating backgrounds for depth */
html:not(.dark) main > section:nth-child(odd) {
    position: relative;
}

/* Improved newsletter/CTA card in light mode */
html:not(.dark) .bg-primary\/10 {
    background-color: rgba(var(--primary-rgb), 0.06) !important;
}

/* Better looking subscribe button in light mode */
html:not(.dark) button.bg-primary,
html:not(.dark) .bg-primary {
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.25);
}

html:not(.dark) button.bg-primary:hover {
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.35);
}

/* Section padding backgrounds */
html:not(.dark) .section-divider {
    opacity: 0.8;
}

/* Enhanced glossy card images contrast in light mode */
html:not(.dark) .glossy-card img {
    filter: contrast(1.02) saturate(1.05);
}

/* Light mode: Public Pen / CTA section */
html:not(.dark) section > .bg-primary\/5 {
    background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.04) 0%, rgba(var(--primary-rgb), 0.08) 100%);
}

/* Better bg-white/5 and bg-white/10 in light mode for testimonial cards */
html:not(.dark) .bg-white\/5.backdrop-blur-md {
    background-color: rgba(var(--primary-rgb), 0.06) !important;
    border-color: rgba(var(--primary-rgb), 0.12) !important;
    box-shadow: 0 2px 12px rgba(var(--primary-rgb), 0.06);
}

/* Podcast subscribe CTA in light mode */
html:not(.dark) [class*="from-primary\/20"] {
    background: linear-gradient(to right, rgba(var(--primary-rgb), 0.08), rgba(var(--primary-rgb), 0.03)) !important;
}
html:not(.dark) [dir="rtl"] [class*="from-primary\/20"] {
    background: linear-gradient(to left, rgba(var(--primary-rgb), 0.08), rgba(var(--primary-rgb), 0.03)) !important;
}

/* Light mode: Active nav link */
html:not(.dark) .text-primary-800 {
    color: var(--primary-color);
}

/* Light mode: improved focus rings */
html:not(.dark) *:focus-visible {
    outline: 2px solid rgba(var(--primary-rgb), 0.4);
    outline-offset: 2px;
}

/* Light mode: input fields */
html:not(.dark) input[type="email"],
html:not(.dark) input[type="text"],
html:not(.dark) input[type="search"] {
    background-color: rgba(var(--primary-rgb), 0.04);
    border-color: rgba(var(--primary-rgb), 0.12);
}

html:not(.dark) input[type="email"]:focus,
html:not(.dark) input[type="text"]:focus,
html:not(.dark) input[type="search"]:focus {
    background-color: rgba(255, 255, 255, 0.9);
    border-color: rgba(var(--primary-rgb), 0.3);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.08);
}

/* Light mode: Sports live badge */
html:not(.dark) .animate-pulse.bg-white {
    box-shadow: 0 2px 8px rgba(var(--primary-rgb), 0.2);
}

/* Light mode: lang switcher enhancement */
html:not(.dark) .lang-switcher {
    background: rgba(var(--primary-rgb), 0.06);
    border-color: rgba(var(--primary-rgb), 0.12);
    box-shadow: inset 0 1px 2px rgba(var(--primary-rgb), 0.04);
}

/* Light mode: theme toggle enhancement */
html:not(.dark) .theme-toggle {
    background: rgba(var(--primary-rgb), 0.06);
    box-shadow: inset 0 1px 2px rgba(var(--primary-rgb), 0.04);
}

html:not(.dark) .theme-toggle:hover {
    background: rgba(var(--primary-rgb), 0.12);
}

/* Light mode: mobile menu panel */
html:not(.dark) .mobile-menu-panel {
    box-shadow: 0 25px 80px rgba(var(--primary-rgb), 0.15), 0 8px 24px rgba(var(--primary-rgb), 0.08);
}

/* Light mode: FAB button */
html:not(.dark) .fixed.bg-primary {
    box-shadow: 0 4px 16px rgba(var(--primary-rgb), 0.3), 0 8px 32px rgba(var(--primary-rgb), 0.15);
}

/* Light mode: CTA section */
html:not(.dark) .cta-section > .bg-primary\/5 {
    background: linear-gradient(180deg, rgba(var(--primary-rgb), 0.03) 0%, rgba(var(--primary-rgb), 0.07) 100%) !important;
}

/* Light mode: Footer enhancement */
html:not(.dark) .light-footer {
    background: linear-gradient(180deg, #ffffff 0%, #f0f3f7 100%);
    border-top: 1px solid rgba(var(--primary-rgb), 0.08);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), 0 -4px 16px rgba(var(--primary-rgb), 0.03);
}

/* Light mode: Footer bottom border */
html:not(.dark) .light-footer .border-t {
    border-color: rgba(var(--primary-rgb), 0.06) !important;
}

/* =============================================
   LTR-specific adjustments
   ============================================= */
[dir="ltr"] .space-x-reverse > :not(:last-child) {
    margin-right: 0;
    margin-left: -0.5rem;
}

[dir="ltr"] body {
    font-family: 'Work Sans', 'Tajawal', sans-serif;
}

/* RTL border adjustments for economy/health cards */
[dir="ltr"] .border-r-4 {
    border-right-width: 0 !important;
    border-left-width: 4px !important;
}

/* =============================================
   Article Page Typography
   ============================================= */
.article-content {
    font-size: 1.0625rem;
    line-height: 1.9;
}

.article-content h2 {
    margin-top: 2.5rem;
}

.article-content p {
    margin-bottom: 1.5rem;
}

/* Selection color */
.article-content ::selection {
    background: rgba(var(--primary-rgb), 0.2);
    color: var(--text-color);
}

/* Article images */
.article-content figure img {
    transition: transform 0.5s ease;
}

.article-content figure:hover img {
    transform: scale(1.02);
}

/* Blockquote styling */
.article-content blockquote {
    position: relative;
}

.article-content blockquote::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px;
}

/* Light mode article enhancements */
html:not(.dark) .article-content {
    color: #2a3a4a;
}

html:not(.dark) .article-content h2 {
    color: var(--text-color);
}

/* =============================================
   Reading Progress Bar (Article)
   ============================================= */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    z-index: 100;
}

.reading-progress .bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
    width: 0%;
    transition: width 0.1s linear;
}

[dir="rtl"] .reading-progress .bar {
    margin-left: auto;
    margin-right: 0;
}

/* =============================================
   Public Pen Sidebar
   ============================================= */

/* Floating badge icon pulse */
@keyframes penIconPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.pen-icon-pulse {
    animation: penIconPulse 2.5s ease-in-out infinite;
}

/* Notification dot pulse */
@keyframes penDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.4); }
}

.pen-dot-pulse {
    animation: penDotPulse 2s ease-in-out infinite;
}

/* Slider track */
#penSliderTrack {
    display: flex;
    flex-direction: column;
}

#penSliderTrack .pen-slide {
    flex: 0 0 100%;
}

/* Custom scrollbar for post excerpt */
.pen-scroll::-webkit-scrollbar {
    width: 3px;
}

.pen-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.pen-scroll::-webkit-scrollbar-thumb {
    background: rgba(var(--primary-rgb), 0.15);
    border-radius: 10px;
}

.pen-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.3);
}

/* Panel transition timing */
#penPanel {
    transition-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}

/* Badge transition */
#penFloatingBadge {
    transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Overlay transition */
#penOverlay {
    transition: opacity 0.4s ease;
}

/* =============================================
   Rich Text / Text Editor Content Defaults
   Applied inside #descriptionBox, .article-content
   Uses low specificity so inline styles from
   the text editor always win.
   ============================================= */
/* --- Video Description Box (smaller, compact) --- */
#descriptionBox .editor-content {
    font-size: 0.9375rem;
    line-height: 1.8;
    color: var(--text-muted);
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 640px) {
    #descriptionBox .editor-content {
        font-size: 1rem;
    }
}

/* --- Article Page (larger, reading-optimized) --- */
.article-content .editor-content {
    font-size: 1rem;
    line-height: 1.85;
    color: var(--text-muted);
    word-break: break-word;
    overflow-wrap: break-word;
}

@media (min-width: 640px) {
    .article-content .editor-content {
        font-size: 1.0625rem;
    }
}

@media (min-width: 1024px) {
    .article-content .editor-content {
        font-size: 1.125rem;
    }
}

/* Drop cap for the first paragraph in articles */
.article-content .editor-content > p:first-child::first-letter {
    font-size: 3.5em;
    font-weight: 900;
    color: var(--primary-color);
    float: left;
    line-height: 0.8;
    margin-right: 0.15em;
    margin-top: 0.05em;
}

[dir="rtl"] .article-content .editor-content > p:first-child::first-letter {
    float: right;
    margin-right: 0;
    margin-left: 0.15em;
}

/* Headings — Video Description */
#descriptionBox .editor-content h1 { font-size: 1.75rem; font-weight: 800; margin: 1.5em 0 0.6em; color: var(--text-color); line-height: 1.3; }
#descriptionBox .editor-content h2 { font-size: 1.5rem;  font-weight: 800; margin: 1.4em 0 0.5em; color: var(--text-color); line-height: 1.35; }
#descriptionBox .editor-content h3 { font-size: 1.25rem; font-weight: 700; margin: 1.3em 0 0.5em; color: var(--text-color); line-height: 1.4; }
#descriptionBox .editor-content h4 { font-size: 1.125rem;font-weight: 700; margin: 1.2em 0 0.4em; color: var(--text-color); line-height: 1.4; }
#descriptionBox .editor-content h5 { font-size: 1rem;    font-weight: 700; margin: 1.1em 0 0.4em; color: var(--text-color); line-height: 1.45; }
#descriptionBox .editor-content h6 { font-size: 0.875rem;font-weight: 700; margin: 1em 0 0.4em;   color: var(--text-color); line-height: 1.5; }

/* Headings — Article Page (bigger, more breathing room) */
.article-content .editor-content h1 { font-size: 2rem;     font-weight: 800; margin: 1.6em 0 0.6em; color: var(--text-color); line-height: 1.25; }
.article-content .editor-content h2 { font-size: 1.625rem; font-weight: 800; margin: 1.5em 0 0.5em; color: var(--text-color); line-height: 1.3; }
.article-content .editor-content h3 { font-size: 1.375rem; font-weight: 700; margin: 1.4em 0 0.5em; color: var(--text-color); line-height: 1.35; }
.article-content .editor-content h4 { font-size: 1.1875rem;font-weight: 700; margin: 1.3em 0 0.4em; color: var(--text-color); line-height: 1.4; }
.article-content .editor-content h5 { font-size: 1.0625rem;font-weight: 700; margin: 1.2em 0 0.4em; color: var(--text-color); line-height: 1.45; }
.article-content .editor-content h6 { font-size: 0.9375rem;font-weight: 700; margin: 1.1em 0 0.4em; color: var(--text-color); line-height: 1.5; }

/* Paragraphs — Video Description */
#descriptionBox .editor-content p {
    margin: 0 0 1em;
    line-height: 1.8;
}

/* Paragraphs — Article Page */
.article-content .editor-content p {
    margin: 0 0 1.35em;
    line-height: 1.85;
}

/* Links */
#descriptionBox .editor-content a,
.article-content .editor-content a {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease, opacity 0.2s ease;
}

#descriptionBox .editor-content a:hover,
.article-content .editor-content a:hover {
    opacity: 0.8;
}

/* Bold & Italic */
#descriptionBox .editor-content strong,
#descriptionBox .editor-content b,
.article-content .editor-content strong,
.article-content .editor-content b {
    font-weight: 700;
    color: var(--text-color);
}

#descriptionBox .editor-content em,
#descriptionBox .editor-content i,
.article-content .editor-content em,
.article-content .editor-content i {
    font-style: italic;
}

/* Lists */
#descriptionBox .editor-content ul,
.article-content .editor-content ul {
    list-style-type: disc;
    padding-inline-start: 1.5em;
    margin: 0.75em 0 1em;
}

#descriptionBox .editor-content ol,
.article-content .editor-content ol {
    list-style-type: decimal;
    padding-inline-start: 1.5em;
    margin: 0.75em 0 1em;
}

#descriptionBox .editor-content li,
.article-content .editor-content li {
    margin-bottom: 0.4em;
    line-height: 1.7;
}

#descriptionBox .editor-content li::marker,
.article-content .editor-content li::marker {
    color: var(--primary-color);
}

/* Blockquote — Video Description */
#descriptionBox .editor-content blockquote {
    border-inline-start: 3px solid var(--primary-color);
    padding: 0.75em 1.25em;
    margin: 1em 0;
    background: rgba(var(--primary-rgb), 0.05);
    border-radius: 0 0.5rem 0.5rem 0;
    font-style: italic;
    color: var(--text-muted);
}

[dir="rtl"] #descriptionBox .editor-content blockquote {
    border-radius: 0.5rem 0 0 0.5rem;
}

/* Blockquote — Article Page (more prominent) */
.article-content .editor-content blockquote {
    border-inline-start: 4px solid var(--primary-color);
    padding: 1em 1.5em;
    margin: 1.5em 0;
    background: rgba(var(--primary-rgb), 0.05);
    border-radius: 0 0.75rem 0.75rem 0;
    font-style: italic;
    color: var(--text-muted);
    position: relative;
}

[dir="rtl"] .article-content .editor-content blockquote {
    border-radius: 0.75rem 0 0 0.75rem;
}

.article-content .editor-content blockquote p {
    margin-bottom: 0.4em;
    font-weight: 600;
    font-size: 1.05em;
    line-height: 1.7;
}

.article-content .editor-content blockquote cite {
    display: block;
    font-size: 0.85em;
    font-style: normal;
    font-weight: 700;
    color: var(--primary-color);
    margin-top: 0.3em;
}

/* Images — Video Description */
#descriptionBox .editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 1em 0;
}

/* Images — Article Page */
.article-content .editor-content img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
    margin: 1.5em 0;
}

/* Tables */
#descriptionBox .editor-content table,
.article-content .editor-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 0.875rem;
}

#descriptionBox .editor-content th,
.article-content .editor-content th {
    background: rgba(var(--primary-rgb), 0.1);
    font-weight: 700;
    text-align: inherit;
    padding: 0.6em 0.8em;
    border: 1px solid var(--card-border);
    color: var(--text-color);
}

#descriptionBox .editor-content td,
.article-content .editor-content td {
    padding: 0.5em 0.8em;
    border: 1px solid var(--card-border);
}

/* Code */
#descriptionBox .editor-content code,
.article-content .editor-content code {
    background: rgba(var(--primary-rgb), 0.08);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.875em;
    font-family: 'Courier New', monospace;
}

#descriptionBox .editor-content pre,
.article-content .editor-content pre {
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid var(--card-border);
    border-radius: 0.5rem;
    padding: 1em 1.25em;
    overflow-x: auto;
    margin: 1em 0;
    font-size: 0.85rem;
    line-height: 1.6;
}

#descriptionBox .editor-content pre code,
.article-content .editor-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* Horizontal Rule */
#descriptionBox .editor-content hr,
.article-content .editor-content hr {
    border: none;
    height: 1px;
    background: var(--divider-color);
    margin: 1.5em 0;
}

/* Video / iframe embeds */
#descriptionBox .editor-content iframe,
#descriptionBox .editor-content video,
.article-content .editor-content iframe,
.article-content .editor-content video {
    max-width: 100%;
    border-radius: 0.75rem;
    margin: 1em 0;
}

/* Selection */
#descriptionBox .editor-content ::selection,
.article-content .editor-content ::selection {
    background: rgba(var(--primary-rgb), 0.2);
    color: var(--text-color);
}

/* Figures with captions — Video Description */
#descriptionBox .editor-content figure {
    margin: 1em 0;
}

#descriptionBox .editor-content figcaption {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-hint);
    margin-top: 0.5em;
}

/* Figures with captions — Article Page */
.article-content .editor-content figure {
    margin: 1.5em 0;
    border-radius: 0.75rem;
    overflow: hidden;
}

.article-content .editor-content figcaption {
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-hint);
    margin-top: 0.6em;
    padding: 0 0.5em;
}

/* Text alignment (from editor) */
#descriptionBox .editor-content .ql-align-center,
#descriptionBox .editor-content [style*="text-align: center"],
.article-content .editor-content .ql-align-center,
.article-content .editor-content [style*="text-align: center"] { text-align: center; }

#descriptionBox .editor-content .ql-align-right,
#descriptionBox .editor-content [style*="text-align: right"],
.article-content .editor-content .ql-align-right,
.article-content .editor-content [style*="text-align: right"] { text-align: right; }

#descriptionBox .editor-content .ql-align-justify,
#descriptionBox .editor-content [style*="text-align: justify"],
.article-content .editor-content .ql-align-justify,
.article-content .editor-content [style*="text-align: justify"] { text-align: justify; }
