:root {
    /* Brand Colors */
    --primary: #0056b3;
    --primary-light: #2d89ef;
    --primary-hover: #004494;
    --secondary: #f72585;

    /* Light Theme Defaults */
    --bg-body: #ffffff;
    --bg-surface: #f8f9fa;
    --text-main: #2b2d42;
    --text-muted: #6c757d;
    --border: #e9ecef;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --modal-bg: rgba(0, 0, 0, 0.5);
    --logo-filter: none;

    /* Fonts */
    --font-en: 'IBM Plex Sans', sans-serif;
    --font-ar: 'IBM Plex Sans Arabic', sans-serif;
}

[data-theme="dark"] {
    --bg-body: #0f1014;
    --bg-surface: #1b1e26;
    --text-main: #f8f9fa;
    --text-muted: #a0a0a0;
    --border: #2d3038;
    --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    --modal-bg: rgba(0, 0, 0, 0.8);
    --primary: #3a86ff;
    --logo-filter: brightness(0) invert(1);
    /* White logo in dark mode */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, filter 0.3s ease;
}

body {
    font-family: var(--font-en);
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
}

/* RTL and Language Switching Logic */
html[dir="rtl"] body {
    font-family: var(--font-ar);
    line-height: 1.8;
    /* Increased line height for Arabic */
}

.loading-spinner i {
    font-size: 16px;
}

html[dir="rtl"] .hero h1 {
    line-height: 1.5;
}

[data-lang="ar"] {
    display: none;
}

html[dir="rtl"] [data-lang="en"] {
    display: none;
}

html[dir="rtl"] [data-lang="ar"] {
    display: inline-block;
}

/* Block level elements that need to switch */
html[dir="rtl"] h1[data-lang="ar"],
html[dir="rtl"] h2[data-lang="ar"],
html[dir="rtl"] h3[data-lang="ar"],
html[dir="rtl"] p[data-lang="ar"],
html[dir="rtl"] div[data-lang="ar"],
html[dir="rtl"] option[data-lang="ar"] {
    display: block;
}

/* Reusable Components */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    /* Desktop padding */
}

.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px rgba(0, 86, 179, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: var(--primary);
    color: white;
}

[data-theme="dark"] .btn-outline {
    color: white;
    border-color: white;
}

[data-theme="dark"] .btn-outline:hover {
    background-color: white;
    color: var(--bg-body);
}

.section-padding {
    padding: 100px 0;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mb-20 {
    margin-bottom: 20px;
}

.mb-50 {
    margin-bottom: 50px;
}

/* Navigation */
nav {
    position: sticky;
    top: 0;
    background-color: var(--bg-body);
    z-index: 100;
    padding: 12px 0;
}

.nav-wrapper {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    font-family: inherit;
    font-weight: 600;
}

.icon-btn:hover {
    background-color: var(--bg-surface);
}

/* Hero Section */
.hero {
    padding: 60px 0 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero-logo img {
    height: 120px;
    width: auto;
    display: block;
    margin-bottom: 40px;
    filter: var(--logo-filter);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
    max-width: 800px;
}

.hero h1 span {
    color: var(--primary);
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin-bottom: 40px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    margin-bottom: 60px;
}

.stats-bar {
    display: flex;
    gap: 60px;
    padding: 30px;
    background-color: var(--bg-surface);
    border-radius: 16px;
    border: 1px solid var(--border);
}

.stat h3 {
    font-size: 2rem;
    color: var(--primary);
    font-weight: 700;
}

.stat span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
}

.card {
    background-color: var(--bg-surface);
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--card-shadow);
}

.card-icon {
    width: 50px;
    height: 50px;
    background-color: rgba(0, 86, 179, 0.1);
    color: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 24px;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 12px;
    font-weight: 600;
}

.card p {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Formats Section */
.formats-section {
    background-color: var(--bg-surface);
}

.format-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.format-item {
    text-align: center;
    padding: 40px 20px;
    border-radius: 16px;
    background-color: var(--bg-body);
    border: 1px solid var(--border);
}

.format-item i {
    font-size: 3rem;
    color: var(--secondary);
    margin-bottom: 20px;
}

/* Download Section */
.store-badges {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 40px;
}

.store-btn {
    background-color: #000;
    color: #fff;
    padding: 10px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    transition: transform 0.2s;
}

[data-theme="dark"] .store-btn {
    background-color: #333;
}

.store-btn:hover {
    transform: translateY(-3px);
}

.store-btn i {
    font-size: 1.8rem;
}

/* RTL support for store buttons */
html[dir="rtl"] .store-btn i {
    margin-left: 12px;
    margin-right: 0;
}

.store-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.store-text span {
    font-size: 0.7rem;
}

.store-text strong {
    font-size: 1.1rem;
    line-height: 1.2;
}

/* Pricing */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    align-items: flex-end;
}

.pricing-card {
    background-color: var(--bg-surface);
    padding: 40px;
    border-radius: 20px;
    border: 1px solid var(--border);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.pricing-card.popular {
    border: 2px solid var(--primary);
    background-color: var(--bg-body);
    transform: scale(1.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    z-index: 2;
}

.badge-popular {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    white-space: nowrap;
}

.plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-main);
}

.savings-badge {
    display: inline-block;
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
}

.features-list {
    list-style: none;
    margin: 20px 0 30px;
    text-align: left;
    flex-grow: 1;
}

html[dir="rtl"] .features-list {
    text-align: right;
}

.features-list li {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.features-list li i {
    color: #10b981;
    margin-top: 3px;
}

/* Footer */
footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border);
    padding: 60px 0;
    text-align: center;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--primary);
}

.company-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Modal / Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background-color: var(--bg-body);
    padding: 40px;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s ease;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

html[dir="rtl"] .close-modal {
    right: auto;
    left: 20px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

html[dir="rtl"] .form-group {
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background-color: var(--bg-surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.1);
}

/* Responsive Breakpoints */
@media (max-width: 768px) {

    /* Force 16px padding on container */
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    /* Responsive Buttons */
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
        text-align: center;
    }

    .stats-bar {
        flex-direction: column;
        gap: 30px;
        width: 100%;
    }

    .format-list {
        grid-template-columns: 1fr;
    }

    .pricing-card.popular {
        transform: none;
        margin: 20px 0;
    }

    .hero-logo img {
        height: 90px;
    }
}