/* ===== Top bar controls (theme + language) ===== */

/* Top Header - Base Styles for All Pages */
.top-header {
    background-color: #0c2846;
    padding: 0.75rem 0;
    color: #ffffff;
    font-size: 0.9rem;
    position: sticky;
    top: 0;
    z-index: 1050;
    width: 100%;
    display: block;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 14px;
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-icon:hover {
    background: var(--wadinaa-yellow);
    color: #1f2933;
    transform: translateY(-2px);
}

/* سويتش اللغة كبيل صغير */

.lang-switcher {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 2px;
}

.lang-switcher .lang-pill {
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    cursor: pointer;
    min-width: 28px;
    font-weight: 700;
    transition: all 0.3s ease;
}

.lang-switcher .lang-pill:hover {
    color: #fff;
}

.lang-switcher .lang-pill.is-active {
    background: #ffb100;
    color: #1f2933;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

/* زر الثيم أيقونة صغيرة */

.theme-toggle-icon {
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.theme-toggle-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(15deg);
}

.theme-toggle-icon .icon-moon {
    display: none;
}

:root[data-theme="dark"] .theme-toggle-icon .icon-sun {
    display: none;
}

:root[data-theme="dark"] .theme-toggle-icon .icon-moon {
    display: inline-block;
}


/* ===== Light / Dark Theme ===== */

/* الثيم الافتراضي */
:root[data-theme="light"] {
    color-scheme: light;
}

/* الثيم الداكن */
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg-main: #050b18;
    --bg-section: #0b1222;
    --bg-card: #1e293b;
    --text-main: #f9fafb;
    --text-muted: #94a3b8;
    --border-color: #334155;

    /* Wadinaa Variables Overrides for Dark Mode */
    --text-dark: #f9fafb;
    --text-gray: #cbd5f5;
}

/* خلفية الصفحة والنص */
:root[data-theme="dark"] body {
    background-color: var(--bg-main);
    color: var(--text-main);
}

/* الهيدر / النافبار */
:root[data-theme="dark"] .main-navbar,
:root[data-theme="dark"] .top-bar,
:root[data-theme="dark"] .top-header,
:root[data-theme="dark"] .navbar {
    background: linear-gradient(135deg, #0f172a 0%, #020617 100%) !important;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.5) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

/* في الصفحة الرئيسية فقط - جعل التوب بار والهايدر شفافين 100% في الدارك مود */
:root[data-theme="dark"] body.homepage .top-header,
:root[data-theme="dark"] .homepage .top-header {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
}

:root[data-theme="dark"] body.homepage .navbar,
:root[data-theme="dark"] .homepage .navbar {
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
}

/* في الدارك مود - عند التمرير: جعل التوب بار والهايدر sticky مع خلفية شفافة */
:root[data-theme="dark"] body.homepage.scrolled .top-header,
:root[data-theme="dark"] .homepage.scrolled .top-header {
    position: sticky !important;
    top: 0 !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

:root[data-theme="dark"] body.homepage.scrolled .navbar,
:root[data-theme="dark"] .homepage.scrolled .navbar {
    position: sticky !important;
    top: 45px !important;
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3) !important;
}

:root[data-theme="dark"] .navbar-light .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

:root[data-theme="dark"] .navbar-light .navbar-nav .nav-link:hover,
:root[data-theme="dark"] .navbar-light .navbar-nav .nav-link.active {
    color: #FDB913;
}

/* =========================================
   Homepage Dark Mode Overrides
   ========================================= */

/* Hero Section */
:root[data-theme="dark"] .hero-section,
:root[data-theme="dark"] .about-hero-section {
    position: relative;
}

/* Dark Overlay for Hero */
:root[data-theme="dark"] .hero-section::before,
:root[data-theme="dark"] .about-hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(15, 23, 42, 0.3), transparent),
        linear-gradient(to bottom, rgba(5, 11, 24, 0.85), rgba(5, 11, 24, 0.95));
    opacity: 1;
    pointer-events: none;
    z-index: 1;
}

:root[data-theme="dark"] .hero-section>*,
:root[data-theme="dark"] .about-hero-section>* {
    position: relative;
    z-index: 2;
}

:root[data-theme="dark"] .hero-card {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border: none !important;
    box-shadow: none !important;
}

/* Sections Backgrounds */
:root[data-theme="dark"] section[style*="background: linear-gradient"],
:root[data-theme="dark"] section[style*="background: #ffffff"],
:root[data-theme="dark"] section[style*="background: #fff"],
:root[data-theme="dark"] .bg-light,
:root[data-theme="dark"] .bg-light-gradient,
:root[data-theme="dark"] .about-stats-section,
:root[data-theme="dark"] .about-section {
    background: var(--bg-main) !important;
}

:root[data-theme="dark"] section[style*="#f8fafc"],
:root[data-theme="dark"] .vision-mission-section,
:root[data-theme="dark"] .about-section.bg-light,
:root[data-theme="dark"] .about-journey-section {
    background: var(--bg-section) !important;
}

/* Cards (Feature, Product, Vision/Mission) */
:root[data-theme="dark"] .feature-card,
:root[data-theme="dark"] .product-card,
:root[data-theme="dark"] .vision-mission-card,
:root[data-theme="dark"] .about-stat-card,
:root[data-theme="dark"] .about-product-card,
:root[data-theme="dark"] .about-value-card {
    background: radial-gradient(circle at top left, rgba(248, 250, 252, 0.03), transparent), var(--bg-card) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

:root[data-theme="dark"] .feature-card:hover,
:root[data-theme="dark"] .product-card:hover,
:root[data-theme="dark"] .about-stat-card:hover,
:root[data-theme="dark"] .about-value-card:hover,
:root[data-theme="dark"] .about-product-card:hover {
    background-color: #263344 !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6) !important;
    border-color: rgba(253, 185, 19, 0.3) !important;
}

/* Icons in Cards */
:root[data-theme="dark"] .icon-wrapper,
:root[data-theme="dark"] .about-stat-icon {
    background: rgba(15, 23, 42, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Typography Overrides */
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4,
:root[data-theme="dark"] h5,
:root[data-theme="dark"] h6,
:root[data-theme="dark"] .h1,
:root[data-theme="dark"] .h2,
:root[data-theme="dark"] .h3,
:root[data-theme="dark"] .h4,
:root[data-theme="dark"] .h5,
:root[data-theme="dark"] .h6 {
    color: var(--text-main) !important;
}

:root[data-theme="dark"] p,
:root[data-theme="dark"] span,
:root[data-theme="dark"] li,
:root[data-theme="dark"] div {
    color: var(--text-muted);
}

/* Re-apply specific text colors */
:root[data-theme="dark"] .text-white {
    color: #fff !important;
}

:root[data-theme="dark"] .text-primary {
    color: #60a5fa !important;
}

:root[data-theme="dark"] .text-warning {
    color: #FDB913 !important;
}

/* Specific Section Titles & Subtitles */
:root[data-theme="dark"] [data-section*="title"],
:root[data-theme="dark"] .section-title,
:root[data-theme="dark"] .about-block-title,
:root[data-theme="dark"] .about-product-title,
:root[data-theme="dark"] .about-value-title,
:root[data-theme="dark"] .about-stat-title,
:root[data-theme="dark"] .about-hero-title,
:root[data-theme="dark"] .factory-preview-title,
:root[data-theme="dark"] .factory-preview-text-title {
    color: #f1f5f9 !important;
}

:root[data-theme="dark"] [data-section*="subtitle"],
:root[data-theme="dark"] [data-section*="description"],
:root[data-theme="dark"] .section-subtitle,
:root[data-theme="dark"] .about-block-text,
:root[data-theme="dark"] .about-product-text,
:root[data-theme="dark"] .about-value-text,
:root[data-theme="dark"] .about-stat-text,
:root[data-theme="dark"] .about-hero-subtitle,
:root[data-theme="dark"] .about-hero-subtitle-small,
:root[data-theme="dark"] .factory-preview-subtitle,
:root[data-theme="dark"] .factory-preview-text-body {
    color: #cbd5e1 !important;
}

/* Product Card Specifics */
:root[data-theme="dark"] .product-card h3 {
    color: #f1f5f9 !important;
}

:root[data-theme="dark"] .product-card p {
    color: #94a3b8 !important;
}

:root[data-theme="dark"] .product-card div[style*="background: #f7fafc"] {
    background: #1e293b !important;
}

/* Vision/Mission Specifics */
:root[data-theme="dark"] .vision-mission-card h2 {
    color: #f1f5f9 !important;
}

:root[data-theme="dark"] .vision-mission-card p {
    color: #cbd5f5 !important;
}

/* Factory Preview Section Specifics */
:root[data-theme="dark"] .factory-preview-section {
    background: radial-gradient(circle at top, rgba(30, 64, 175, 0.1), transparent), var(--bg-section) !important;
}

:root[data-theme="dark"] .factory-preview-list li {
    color: #cbd5f5 !important;
}

:root[data-theme="dark"] .factory-preview-list li::before {
    background-color: #FDB913;
}

/* Form Inputs in Dark Mode */
:root[data-theme="dark"] .form-control {
    background-color: #1e293b !important;
    border-color: #334155 !important;
    color: #f9fafb !important;
}

:root[data-theme="dark"] .form-control:focus {
    background-color: #1e293b !important;
    border-color: #4A90E2 !important;
    box-shadow: 0 0 0 0.25rem rgba(74, 144, 226, 0.25);
}

/* Footer */
:root[data-theme="dark"] footer,
:root[data-theme="dark"] .site-footer,
:root[data-theme="dark"] .footer-top {
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

:root[data-theme="dark"] .footer-bottom {
    background-color: #020617 !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* Buttons */
:root[data-theme="dark"] .btn-login {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

:root[data-theme="dark"] .btn-login:hover {
    background: #FDB913;
    color: #000;
    border-color: #FDB913;
}

/* About Page Specifics */
:root[data-theme="dark"] .about-hero-overlay {
    background: linear-gradient(120deg, rgba(2, 6, 23, 0.92), rgba(15, 23, 42, 0.88)) !important;
}

:root[data-theme="dark"] .about-circle-image {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5) !important;
}

:root[data-theme="dark"] .about-circle-image img {
    filter: brightness(0.95) contrast(1.05);
}

/* Fix specific text colors that are hardcoded in blade with style="" */
:root[data-theme="dark"] [style*="color: #2d3748"],
:root[data-theme="dark"] [style*="color: #4a5568"],
:root[data-theme="dark"] [style*="color: #64748b"] {
    color: #cbd5e1 !important;
}

:root[data-theme="dark"] [style*="color: #FDB913"] {
    color: #fbbf24 !important;
}

:root[data-theme="dark"] [style*="color: #4A90E2"] {
    color: #60a5fa !important;
}

/* Contact Page Dark Mode */
:root[data-theme="dark"] .contact-content-section {
    background: var(--bg-section) !important;
}

:root[data-theme="dark"] .contact-content-section .d-flex.rounded-4 {
    background-color: var(--bg-card) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4) !important;
}

:root[data-theme="dark"] .contact-content-section h3,
:root[data-theme="dark"] .contact-content-section h5 {
    color: #f1f5f9 !important;
}

:root[data-theme="dark"] .contact-content-section p {
    color: #cbd5e1 !important;
}

/* =========================================
   TODO: Mobile tweaks for Wadina hero/topbar/menu - 2025-11-26
   ========================================= */

/* ===== Mobile Hero Section Improvements ===== */
@media (max-width: 768px) {
    /* Hero Section - تقليل المسافات وتحسين التخطيط */
    .hero-section {
        padding-top: 90px !important; /* بحيث مايتغطاش الهيرو بالـ top bar */
        padding-bottom: 40px !important;
        min-height: auto !important;
    }

    .hero-card {
        padding: 2rem 1.5rem !important;
    }

    /* Hero Content Container */
    .hero-content {
        max-width: 100%;
        margin: 0 auto;
    }

    /* TODO: Mobile tweaks for Wadina hero/topbar/menu - 2025-11-26 */
    /* إخفاء جميع النصوص في Hero Section على الموبايل - ترك الأزرار فقط */
    .hero-kicker,
    .hero-content h6[data-section="hero_subtitle"],
    .hero-section h6,
    .hero-title,
    .hero-content h1[data-section="hero_title"],
    .hero-section h1,
    .hero-subtitle,
    .hero-content p[data-section="hero_description"],
    .hero-section p {
        display: none !important;
    }

    /* Hero Buttons - ترتيب عمودي */
    .hero-actions,
    .hero-buttons {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.8rem !important;
        align-items: stretch !important;
        width: 100%;
        max-width: 100%;
        margin-top: 2rem !important;
    }

    .hero-btn-primary,
    .hero-btn-secondary {
        width: 100% !important;
        padding: 0.9rem 1.5rem !important;
        font-size: 1rem !important;
    }
}

/* ===== Mobile Top Bar Improvements ===== */
@media (max-width: 768px) {
    /* Top Header - تقليل الحجم */
    .top-header {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
    }

    /* إخفاء النصوص الطويلة في التوب بار - الاكتفاء بالأيقونات */
    .top-header-contact-text {
        display: none !important;
    }

    /* تحسين روابط التوب بار على الموبايل - إظهار الأيقونة فقط */
    .top-header-contact-link {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 32px !important;
        height: 32px !important;
        padding: 0 !important;
        margin-left: 0.5rem !important;
        border-radius: 50% !important;
        background: rgba(255, 255, 255, 0.1) !important;
        transition: all 0.3s ease !important;
    }

    .top-header-contact-link:hover {
        background: rgba(253, 185, 19, 0.2) !important;
        transform: scale(1.1) !important;
    }

    .top-header-contact-link i {
        margin: 0 !important;
        font-size: 0.9rem !important;
    }

    /* تبسيط التوب بار - تقليل المسافات */
    .top-header .container .row {
        margin: 0;
    }

    .top-header .col-md-6 {
        padding: 0 8px;
    }

    /* Social Icons - تقليل الحجم */
    .top-header .social-icons a {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.85rem !important;
        margin-right: 0.4rem !important;
    }

    /* Language Switcher - تقليل الحجم */
    .top-header .lang-switcher {
        padding: 1px;
    }

    .top-header .lang-switcher .lang-pill {
        font-size: 10px !important;
        padding: 2px 6px !important;
        min-width: 24px !important;
    }

    /* Theme Toggle - تقليل الحجم */
    .top-header .theme-toggle-icon {
        width: 26px !important;
        height: 26px !important;
        font-size: 12px !important;
    }
}

/* ===== Mobile Navbar/Menu Improvements ===== */
@media (max-width: 768px) {
    /* Navbar - تقليل الحجم */
    .navbar {
        padding: 0.6rem 0 !important;
    }

    /* Navbar Brand - تقليل الحجم */
    .navbar-brand {
        font-size: 1rem !important;
    }

    .navbar-brand img {
        height: 35px !important;
    }

    /* Navbar Toggler - تحسين المظهر */
    .navbar-toggler {
        padding: 0.4rem 0.6rem !important;
        font-size: 1rem !important;
        border: 1px solid rgba(255, 255, 255, 0.3) !important;
    }

    /* Bootstrap Collapse Menu - تحسين القائمة الجانبية */
    .navbar-collapse {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        background: rgba(0, 0, 0, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        -webkit-backdrop-filter: blur(10px) !important;
        z-index: 9999 !important;
        padding: 80px 2rem 2rem !important;
        overflow-y: auto !important;
        transform: translateX(100%) !important;
        transition: transform 0.3s ease !important;
        max-width: 100vw !important;
    }

    /* حالة القائمة المفتوحة */
    .navbar-collapse.show,
    .navbar-collapse.collapsing {
        transform: translateX(0) !important;
    }

    /* منع scroll للصفحة عند فتح القائمة */
    body.menu-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }

    /* Nav Links داخل القائمة الجانبية */
    .navbar-collapse .navbar-nav {
        flex-direction: column !important;
        width: 100% !important;
    }

    .navbar-collapse .nav-link {
        display: block !important;
        font-size: 1.1rem !important;
        padding: 1rem 1.5rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        color: rgba(255, 255, 255, 0.9) !important;
        text-align: center !important;
        transition: all 0.3s ease !important;
    }

    .navbar-collapse .nav-link:hover,
    .navbar-collapse .nav-link.active {
        background: rgba(253, 185, 19, 0.15) !important;
        color: #FDB913 !important;
        padding-right: 2rem !important;
    }

    /* زر تسجيل الدخول داخل القائمة */
    .navbar-collapse .btn-login {
        margin: 1.5rem auto 0 !important;
        display: block !important;
        width: 90% !important;
        max-width: 280px !important;
        text-align: center !important;
    }

    /* زر إغلاق القائمة */
    .mobile-menu-close-btn {
        position: absolute !important;
        top: 20px !important;
        right: 20px !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border: none !important;
        color: #fff !important;
        font-size: 1.8rem !important;
        width: 40px !important;
        height: 40px !important;
        border-radius: 50% !important;
        cursor: pointer !important;
        z-index: 10001 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.3s ease !important;
    }

    .mobile-menu-close-btn:hover {
        background: rgba(253, 185, 19, 0.3) !important;
        transform: scale(1.1) !important;
    }

    /* زر إغلاق القائمة - إضافة overlay للخلفية */
    .navbar-collapse::after {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 9998;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .navbar-collapse.show::after,
    .navbar-collapse.collapsing::after {
        opacity: 1;
        pointer-events: all;
    }
}

/* إخفاء زر الإغلاق على الديسكتوب */
@media (min-width: 769px) {
    .mobile-menu-close-btn {
        display: none !important;
    }
}

/* Dark Mode - Mobile Menu */
@media (max-width: 768px) {
    :root[data-theme="dark"] .navbar-collapse {
        background: rgba(0, 0, 0, 0.98) !important;
    }
}