/* CSS Variables for theming */
:root {
    /* Golden ratio based spacing and sizing */
    --golden-ratio: 1.618;
    --golden-section: calc(100% / var(--golden-ratio));
    --golden-complement: calc(100% - var(--golden-section));

    /* Primary color */
    --primary-color: #007fff;
    --primary-hover: #0056b3;

    /* Light mode colors */
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;
    --border-color: #dee2e6;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

    /* Typography - Golden Ratio Type Scale */
    --font-family: 'Alexandria', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --line-height-en: 1.5;
    --line-height-ar: 1.6;
    --golden-ratio: 1.618;

    /* Base sizes following golden ratio */
    --font-size-xs: 0.75rem;                    /* 12px */
    --font-size-sm: 0.875rem;                   /* 14px */
    --font-size-base: 1rem;                     /* 16px */
    --font-size-lg: 1.125rem;                   /* 18px */
    --font-size-xl: 1.25rem;                    /* 20px */
    --font-size-2xl: 1.5rem;                    /* 24px */
    --font-size-3xl: 1.875rem;                  /* 30px */
    --font-size-4xl: 2.25rem;                   /* 36px */
    --font-size-5xl: 3rem;                      /* 48px */

    /* Paragraph sizes based on golden ratio from headings */
    --font-size-p-from-5xl: calc(var(--font-size-5xl) / var(--golden-ratio)); /* ~29.7px */
    --font-size-p-from-4xl: calc(var(--font-size-4xl) / var(--golden-ratio)); /* ~22.2px */
    --font-size-p-from-3xl: calc(var(--font-size-3xl) / var(--golden-ratio)); /* ~18.5px */
    --font-size-p-from-2xl: calc(var(--font-size-2xl) / var(--golden-ratio)); /* ~14.8px */
    --font-size-p-from-xl: calc(var(--font-size-xl) / var(--golden-ratio));   /* ~12.3px */
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --text-primary: #ffffff;
    --text-secondary: #b8d4f0;
    --text-muted: #6b9bd1;
    --border-color: #3a3a3a;
    --shadow: 0 4px 6px rgba(0, 127, 255, 0.1);
}

[dir="rtl"] {
    --line-height: var(--line-height-ar);
    font-size: 1.05em; /* Slightly larger for Arabic readability */
}

[dir="ltr"] {
    --line-height: var(--line-height-en);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: var(--line-height);
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    padding: 1rem 0;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: 500;
    font-size: var(--font-size-base);
}

.nav-link:hover {
    color: var(--primary-color);
}

.theme-toggle, .lang-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: var(--font-size-lg);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover, .lang-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(0, 127, 255, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(0, 127, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.hero-text {
    animation-delay: 0.5s;
}

.hero-image {
    animation-delay: 0.8s;
}

.hero-text {
    padding-right: 2rem;
}

[dir="rtl"] .hero-text {
    padding-right: 0;
    padding-left: 2rem;
}

.hero-title {
    font-size: clamp(var(--font-size-2xl), 7vw, var(--font-size-4xl));
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: var(--line-height);
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1rem; /* Exactly 16px as requested */
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: var(--line-height);
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-base);
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
}

.hero-image {
    position: relative;
    width: 320px; /* Fixed width to match image max-width */
    justify-self: end; /* Align to the right in the grid */
}

.hero-image img {
    width: 100%;
    max-width: 320px; /* Made smaller for better proportions */
    height: auto;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Features Section */
.features {
    padding: 5rem 0;
    background: var(--bg-secondary);
}

.section-title {
    text-align: center;
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.section-subtitle {
    text-align: center;
    font-size: var(--font-size-p-from-4xl); /* Golden ratio from section title (4xl) */
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 127, 255, 0.05), transparent);
    transition: left 0.6s ease;
}

.feature-card:hover::before {
    left: 100%;
}

.feature-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0, 127, 255, 0.15);
    border-color: var(--primary-color);
}

/* Additional card style variations */
.card-style-elevated {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-style-gradient {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border: 1px solid rgba(0, 127, 255, 0.2);
}

.card-style-outline {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-primary);
}

.card-style-outline:hover {
    border-color: var(--primary-color);
    background: rgba(0, 127, 255, 0.05);
}

.card-style-glow {
    position: relative;
    overflow: hidden;
}

.card-style-glow::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary-color), transparent, var(--primary-color));
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card-style-glow:hover::before {
    opacity: 1;
}

/* Different card layout styles for variety */
.card-style-horizontal {
    display: flex;
    align-items: center;
    text-align: left;
    gap: 1.5rem;
}

.card-style-horizontal .feature-icon {
    flex-shrink: 0;
    margin: 0;
}

.card-style-horizontal .feature-content {
    flex: 1;
}

.card-style-compact {
    padding: 1.5rem;
    text-align: center;
}

.card-style-compact .feature-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 1rem;
}

.card-style-featured {
    background: linear-gradient(135deg, var(--bg-primary), rgba(0, 127, 255, 0.05));
    border: 2px solid var(--primary-color);
    box-shadow: 0 8px 32px rgba(0, 127, 255, 0.2);
}

.card-style-accent {
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(90deg, var(--bg-primary) 0%, rgba(0, 127, 255, 0.03) 100%);
}

.card-style-minimal {
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: var(--bg-secondary);
}

.card-style-3d {
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-style-3d:hover {
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15), 0 16px 32px rgba(0, 127, 255, 0.2);
}

/* Interactive icon animations */
.feature-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 8px 16px rgba(0, 127, 255, 0.3));
}

/* Staggered hover effects */
.feature-card:nth-child(1):hover .feature-icon { animation-delay: 0.1s; }
.feature-card:nth-child(2):hover .feature-icon { animation-delay: 0.15s; }
.feature-card:nth-child(3):hover .feature-icon { animation-delay: 0.2s; }
.feature-card:nth-child(4):hover .feature-icon { animation-delay: 0.25s; }
.feature-card:nth-child(5):hover .feature-icon { animation-delay: 0.3s; }
.feature-card:nth-child(6):hover .feature-icon { animation-delay: 0.35s; }

/* Alternative card styles for variety */
.feature-card.featured {
    background: linear-gradient(135deg, var(--bg-primary), rgba(0, 127, 255, 0.05));
    border: 2px solid var(--primary-color);
    box-shadow: 0 8px 32px rgba(0, 127, 255, 0.2);
}

.feature-card.featured:hover {
    transform: translateY(-12px) scale(1.03);
    box-shadow: 0 24px 48px rgba(0, 127, 255, 0.25);
}

.feature-card.large {
    padding: 2.5rem;
    grid-column: span 2;
}

.feature-card.compact {
    padding: 1.5rem;
}

/* Interactive elements */
.feature-card .feature-description {
    transition: all 0.3s ease;
}

.feature-card:hover .feature-description {
    transform: translateY(-2px);
    color: var(--text-primary);
}

/* Pulse animation for important cards */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.feature-card.pulse {
    animation: pulse 3s ease-in-out infinite;
}

.feature-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: white;
}

.feature-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.feature-description {
    color: var(--text-secondary);
    line-height: var(--line-height);
    font-size: var(--font-size-p-from-xl); /* Golden ratio from feature title (xl) */
}

/* Pricing Section */
.pricing {
    padding: 5rem 0;
    background: var(--bg-primary);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    max-width: 900px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
}

.pricing-card.featured {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.pricing-card.featured::before {
    content: 'Most Popular';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

.pricing-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    margin-bottom: 1rem;
}

.pricing-price {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.pricing-price span {
    font-size: var(--font-size-base);
    font-weight: 400;
    color: var(--text-secondary);
}

.pricing-features {
    list-style: none;
    margin: 2rem 0;
    text-align: left;
}

.pricing-features li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--font-size-sm); /* Small but readable for list items */
}

.pricing-features li::before {
    content: '✓';
    color: var(--primary-color);
    font-weight: bold;
}

/* Pricing Tabs */
.pricing-tabs-container {
    margin-top: 3rem;
}

.pricing-tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pricing-tab {
    padding: 0.75rem 2rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.pricing-tab::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.pricing-tab:hover::before {
    left: 100%;
}

.pricing-tab:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 127, 255, 0.2);
}

.pricing-tab.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 127, 255, 0.3);
    transform: translateY(-2px);
}

.pricing-tab.active::before {
    display: none;
}

.pricing-tab-content {
    display: none;
    animation: fadeInUp 0.5s ease;
}

.pricing-tab-content.active {
    display: block;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* CTA Section */
.cta {
    padding: 5rem 0;
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    text-align: center;
    color: white;
}

.cta-title {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    margin-bottom: 1rem;
}

.cta-subtitle {
    font-size: var(--font-size-p-from-4xl); /* Golden ratio from CTA title (4xl) */
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

/* Footer */
footer {
    background: var(--bg-tertiary);
    padding: 3rem 0 1rem;
    text-align: center;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-size: var(--font-size-lg);
}

.footer-section p, .footer-section a {
    color: var(--text-secondary);
    text-decoration: none;
    line-height: var(--line-height);
    font-size: var(--font-size-sm); /* Slightly smaller than base for footer */
}

.footer-section a:hover {
    color: var(--primary-color);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    color: var(--text-muted);
}

/* Modern Animations and Effects */
.fade-in {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    animation: modernFadeInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-play-state: paused;
}

@keyframes modernFadeInUp {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.hero-text {
    /* Hero text is visible by default, animation is enhancement */
    animation: modernFadeInUp 1s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
    animation-play-state: paused;
}

.hero-image {
    opacity: 1; /* Hero image should be visible by default */
    animation: float 8s ease-in-out infinite; /* Keep the floating animation */
}

/* Floating animation for hero elements */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

        /* Initially visible cards with animation ready */
        .feature-card, .pricing-card {
            /* Elements are visible by default, animation is enhancement */
        }

/* Modern button styles with micro-interactions */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #0056b3);
    box-shadow: 0 4px 15px rgba(0, 127, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 127, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0px);
    transition: all 0.1s ease;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Modern cursor and interaction effects */
* {
    cursor: default;
}

a, button, .nav-link, .btn {
    cursor: pointer;
}

.btn, .theme-toggle, .lang-toggle {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle:hover, .lang-toggle:hover {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.1);
}

/* Modern selection styles */
::selection {
    background: rgba(0, 127, 255, 0.3);
    color: var(--text-primary);
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

/* Focus states with modern styling */
.btn:focus, .theme-toggle:focus, .lang-toggle:focus, .nav-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 127, 255, 0.3);
    border-radius: 6px;
}

/* Page Loader */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.page-loader.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
    color: var(--text-primary);
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loader-text {
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: 10px;
}

.loader-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    opacity: 0.8;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .loader-spinner {
        animation: none;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }

    .hero-text {
        padding-right: 0;
    }

    .hero-buttons {
        justify-content: center;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}
