/* Global Light/Dark Theme for All Pages */
:root {
    --z-cart: 11000;
    --z-navigation: 10000;
    --z-mega-menu: 10001;
    --z-modal: 9999;
    --z-overlay: 100;
    --z-content: 10;
    --z-hero: 1;
}

:root[data-theme="dark"] {
    --bg-primary: #060911;
    --bg-secondary: #0a0e27;
    --bg-tertiary: #1a1f3a;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.7);
    --border-color: rgba(102, 126, 234, 0.2);
    --card-bg: rgba(102, 126, 234, 0.05);
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
}

:root[data-theme="light"] {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #1a1f3a;
    --text-secondary: #2c3e50;
    --text-muted: #6c757d;
    --border-color: rgba(102, 126, 234, 0.3);
    --card-bg: #ffffff;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
}

/* Apply theme to body and main containers */
body {
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Smooth transitions for theme changes */
section, .card, .product-card, .service-card, .feature-card, 
.tech-card, .pricing-card, .testimonial-card, .stat-card,
h1, h2, h3, h4, h5, h6, p, span, div, a {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Hero sections */
.hero, .product-hero {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%) !important;
}

/* Sections */
section {
    background: var(--bg-primary);
    color: var(--text-primary);
}

section:nth-child(even) {
    background: var(--bg-secondary);
}

/* Cards */
.card, .product-card, .service-card, .feature-card {
    background: var(--card-bg) !important;
    border-color: var(--border-color) !important;
    color: var(--text-primary) !important;
}

/* Text elements - Fix grey text contrast */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary) !important;
}

p, span:not(.gradient-text), li, a:not(.btn-primary):not(.btn-secondary) {
    color: var(--text-secondary) !important;
}

/* Force white text in dark mode for better readability */
:root[data-theme="dark"] p,
:root[data-theme="dark"] span:not(.gradient-text):not(.cart-count):not([style*="color"]),
:root[data-theme="dark"] li,
:root[data-theme="dark"] .hero-text,
:root[data-theme="dark"] .feature-item span,
:root[data-theme="dark"] .product-description,
:root[data-theme="dark"] .hero-subtitle,
:root[data-theme="dark"] .section-subtitle {
    color: rgba(255, 255, 255, 0.95) !important;
}

/* Specific elements that need bright white in dark mode */
:root[data-theme="dark"] .hero h1,
:root[data-theme="dark"] .hero-title {
    color: #ffffff !important;
}

/* Ensure dark text in light mode */
:root[data-theme="light"] p,
:root[data-theme="light"] span:not(.gradient-text):not(.cart-count):not([style*="color"]),
:root[data-theme="light"] li,
:root[data-theme="light"] .hero-text,
:root[data-theme="light"] .feature-item span,
:root[data-theme="light"] .hero-subtitle,
:root[data-theme="light"] .section-subtitle {
    color: #2c3e50 !important;
}

/* Headings in light mode need very dark text */
:root[data-theme="light"] h1,
:root[data-theme="light"] h2,
:root[data-theme="light"] h3,
:root[data-theme="light"] h4,
:root[data-theme="light"] h5,
:root[data-theme="light"] h6,
:root[data-theme="light"] .hero-title {
    color: #1a1f3a !important;
}

/* Navigation - Fixed z-index */
.navbar {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-color);
    z-index: var(--z-navigation) !important;
    position: sticky !important;
    top: 0;
}

.nav-link, .nav-link-mega {
    color: var(--text-primary) !important;
}

/* Cart Sidebar - HIGHEST z-index */
.cart-sidebar,
.floating-cart,
#cartSidebar {
    z-index: var(--z-cart) !important;
    position: fixed !important;
}

.cart-overlay {
    z-index: 9999 !important;
}

/* Mega menu */
.mega-menu-dropdown {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color);
}

.mega-menu-title {
    color: var(--text-primary) !important;
}

.mega-menu-list a {
    color: var(--text-secondary) !important;
}

.mega-menu-list a:hover {
    color: var(--gradient-start) !important;
    background: var(--card-bg) !important;
}

/* Footer */
footer {
    background: var(--bg-secondary) !important;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary) !important;
}

/* Buttons */
.btn-secondary {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* Forms */
input, textarea, select {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted) !important;
}

/* Theme Toggle Styles */
.theme-toggle-container {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 999;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle {
    position: relative;
    width: 50px;
    height: 26px;
}

.theme-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: 0.4s;
    border-radius: 26px;
}

.theme-slider:before {
    position: absolute;
    content: "🌙";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

input:checked + .theme-slider:before {
    content: "☀️";
    transform: translateX(24px);
}

/* Cart icon visibility and z-index fix */
.cart-icon,
.floating-cart-icon {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1001 !important;
}

/* Ensure cart appears above navigation */
.cart-sidebar-container,
.cart-wrapper {
    z-index: var(--z-cart) !important;
}

/* Video should be visible and not cut off */
#heroVideo, 
.hero-video,
video.hero-video {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 0 !important;
}

/* Ensure proper contrast in light mode */
:root[data-theme="light"] .hero-gradient {
    background: linear-gradient(135deg, rgba(248, 249, 250, 0.92) 0%, rgba(233, 236, 239, 0.88) 100%) !important;
}

:root[data-theme="light"] .gradient-orb {
    opacity: 0.3;
}

:root[data-theme="light"] .particle {
    opacity: 0.4;
}

/* Stats section in light mode */
:root[data-theme="light"] .stats {
    background: var(--bg-tertiary) !important;
}

/* Product pages specific */
:root[data-theme="light"] .product-hero {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
}

:root[data-theme="light"] .product-features,
:root[data-theme="light"] .product-benefits {
    background: var(--bg-primary) !important;
}

/* Ensure text visibility */
:root[data-theme="light"] .hero-title,
:root[data-theme="light"] .product-hero h1 {
    color: #1a1f3a !important;
}

:root[data-theme="light"] .hero-badge span,
:root[data-theme="light"] .product-category span {
    color: #667eea !important;
}

/* Smooth transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Override inline styles for theme support */
:root[data-theme="light"] [style*="background: linear-gradient"] {
    filter: brightness(1.2) !important;
}

:root[data-theme="light"] [style*="color: rgba(255,255,255"] {
    color: var(--text-secondary) !important;
}

/* Currency Display */
.currency-indicator {
    position: fixed;
    top: 100px;
    left: 20px;
    z-index: 999;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.currency-indicator i {
    color: var(--gradient-start);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .theme-toggle-container,
    .currency-indicator {
        top: auto;
        bottom: 20px;
        padding: 0.4rem 0.8rem;
    }
    
    .theme-toggle-container {
        right: 20px;
    }
    
    .currency-indicator {
        left: 20px;
        font-size: 0.85rem;
    }
}

/* Light Mode Button and Text Visibility Fixes */
:root[data-theme="light"] .btn-primary,
:root[data-theme="light"] button.btn-primary,
:root[data-theme="light"] .header-btn.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #ffffff !important;
    border: none;
}

:root[data-theme="light"] .btn-secondary,
:root[data-theme="light"] button.btn-secondary {
    background: #ffffff;
    color: #667eea !important;
    border: 2px solid #667eea;
}

:root[data-theme="light"] .btn-secondary:hover {
    background: #667eea;
    color: #ffffff !important;
}

/* Stripe Element Styles for Light Mode */
:root[data-theme="light"] #card-element {
    background: #ffffff !important;
    border: 2px solid #e9ecef !important;
    color: #1a1f3a !important;
}

:root[data-theme="light"] #card-errors {
    color: #e74c3c !important;
    background: #ffebee;
    padding: 10px;
    border-radius: 8px;
}

/* Stripe Modal in Light Mode */
:root[data-theme="light"] #stripePaymentModal > div {
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
}

:root[data-theme="light"] #stripePaymentModal h2,
:root[data-theme="light"] #stripePaymentModal label,
:root[data-theme="light"] #stripePaymentModal p {
    color: #1a1f3a !important;
}

/* Cart Modal Light Mode */
:root[data-theme="light"] .cart-content {
    background: #ffffff !important;
    border-left: 1px solid #e9ecef !important;
}

:root[data-theme="light"] .cart-item {
    background: #f8f9fa !important;
    border-color: #e9ecef !important;
}

:root[data-theme="light"] .cart-item-name,
:root[data-theme="light"] .cart-item-category,
:root[data-theme="light"] .cart-item-price {
    color: #1a1f3a !important;
}

/* Form Elements Light Mode */
:root[data-theme="light"] input,
:root[data-theme="light"] textarea,
:root[data-theme="light"] select {
    background: #ffffff !important;
    color: #1a1f3a !important;
    border: 2px solid #e9ecef !important;
}

:root[data-theme="light"] input::placeholder,
:root[data-theme="light"] textarea::placeholder {
    color: #6c757d !important;
}

:root[data-theme="light"] input:focus,
:root[data-theme="light"] textarea:focus,
:root[data-theme="light"] select:focus {
    border-color: #667eea !important;
    outline: none;
}

/* Product Card Light Mode Fixes */
:root[data-theme="light"] .product-card {
    background: #ffffff !important;
    border: 2px solid #e9ecef !important;
}

:root[data-theme="light"] .product-card:hover {
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.15) !important;
}

:root[data-theme="light"] .product-card h3,
:root[data-theme="light"] .product-card h4 {
    color: #1a1f3a !important;
}

:root[data-theme="light"] .product-card p,
:root[data-theme="light"] .product-card li {
    color: #2c3e50 !important;
}

/* Navigation Light Mode */
:root[data-theme="light"] .site-header {
    background: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid #e9ecef !important;
}

:root[data-theme="light"] .nav-link {
    color: #1a1f3a !important;
}

:root[data-theme="light"] .nav-link:hover {
    color: #667eea !important;
}

/* Dropdown Light Mode */
:root[data-theme="light"] .nav-dropdown {
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1) !important;
}

:root[data-theme="light"] .dropdown-item {
    color: #1a1f3a !important;
}

:root[data-theme="light"] .dropdown-item:hover {
    background: #f8f9fa !important;
}

/* Footer Light Mode */
:root[data-theme="light"] footer,
:root[data-theme="light"] .site-footer {
    background: #f8f9fa !important;
    border-top: 1px solid #e9ecef !important;
}

:root[data-theme="light"] footer a,
:root[data-theme="light"] .site-footer a {
    color: #1a1f3a !important;
}

:root[data-theme="light"] footer a:hover,
:root[data-theme="light"] .site-footer a:hover {
    color: #667eea !important;
}

/* Tables Light Mode */
:root[data-theme="light"] table {
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
}

:root[data-theme="light"] th {
    background: #f8f9fa !important;
    color: #1a1f3a !important;
    border-bottom: 2px solid #e9ecef !important;
}

:root[data-theme="light"] td {
    color: #2c3e50 !important;
    border-bottom: 1px solid #e9ecef !important;
}

/* Pricing Cards Light Mode */
:root[data-theme="light"] .pricing-card {
    background: #ffffff !important;
    border: 2px solid #e9ecef !important;
}

:root[data-theme="light"] .pricing-card.featured {
    border-color: #667eea !important;
    box-shadow: 0 15px 50px rgba(102, 126, 234, 0.2) !important;
}

/* Testimonial Cards Light Mode */
:root[data-theme="light"] .testimonial-card {
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
}

/* Badge Light Mode */
:root[data-theme="light"] .badge {
    background: #f8f9fa !important;
    color: #667eea !important;
    border: 1px solid #e9ecef !important;
}

/* Alert Messages Light Mode */
:root[data-theme="light"] .alert {
    background: #ffffff !important;
    border: 1px solid #e9ecef !important;
    color: #1a1f3a !important;
}

:root[data-theme="light"] .alert-success {
    background: #d4edda !important;
    border-color: #c3e6cb !important;
    color: #155724 !important;
}

:root[data-theme="light"] .alert-error {
    background: #f8d7da !important;
    border-color: #f5c6cb !important;
    color: #721c24 !important;
}

/* Search Bar Light Mode */
:root[data-theme="light"] #searchInput,
:root[data-theme="light"] .search-input {
    background: #ffffff !important;
    color: #1a1f3a !important;
    border: 2px solid #e9ecef !important;
}

