@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&family=Noto+Sans+Arabic:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #7c2ae8;
    --primary-dark: #5e1cb3;
    --primary-light: #9d5cf7;
    --accent-color: #7c2ae8; /* Reverted to purple for original branding consistency */
    --bg-dark: #f8f9fa;      /* Main background */
    --bg-surface: #ffffff;   /* Surface/Card background */
    --bg-card: rgba(124, 42, 232, 0.05);
    --text-main: #1a1a2e;    /* Very dark blue/black for main text */
    --text-muted: #5e5e6e;   /* Gray text */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --glass: rgba(255, 255, 255, 0.85); /* More opaque for light mode over shadows */
    --glass-border: rgba(124, 42, 232, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Theme Support */
body.dark-theme {
    --bg-dark: #0f111a;
    --bg-surface: #1a1d2e;
    --bg-card: rgba(124, 42, 232, 0.1);
    --text-main: #f8f9fa;
    --text-muted: #a0a0b8;
    --glass: rgba(26, 29, 46, 0.85);
    --glass-border: rgba(124, 42, 232, 0.2);
}

[dir="rtl"] {
    font-family: 'Noto Sans Arabic', sans-serif;
    text-align: right;
}

[dir="rtl"] * {
    font-family: 'Noto Sans Arabic', sans-serif;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

/* Glassmorphism */
.glass {
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
}

/* Layout Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

section {
    padding: 80px 0;
}

/* Typography */
h1 { font-size: 4rem; font-weight: 700; line-height: 1.1; margin-bottom: 1.5rem; }
h2 { font-size: 2.5rem; font-weight: 600; margin-bottom: 2rem; text-align: center; }
h3 { font-size: 1.5rem; font-weight: 600; margin-bottom: 1rem; }
p { color: var(--text-muted); font-size: 1.1rem; }

.gradient-text {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Blog Article Specific Typography */
.blog-content h1 { font-size: 2.2rem; margin-top: 1rem; }
.blog-content h2 { font-size: 1.6rem; text-align: left; margin-top: 2.5rem; margin-bottom: 1.2rem; }
.blog-content h3 { font-size: 1.3rem; margin-top: 2rem; margin-bottom: 1rem; }
.blog-content h4 { font-size: 1.1rem; color: var(--primary-color); }

/* Buttons */
.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
    border: none;
    font-size: 1.1rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 10px 20px rgba(124, 42, 232, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(124, 42, 232, 0.5);
}

.btn-glass-outline {
    background: rgba(124, 42, 232, 0.05);
    color: var(--text-main);
    border: 1px solid var(--primary-color);
}

.btn-glass-outline:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(124, 42, 232, 0.3);
}

body.dark-theme .btn-glass-outline {
    color: #ffffff;
}

/* Nav */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 0.8rem 0;
    transition: var(--transition);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--glass-border);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Three Zones for Desktop */
@media (min-width: 769px) {
    .nav-content {
        display: grid;
        grid-template-columns: 250px 1fr 250px;
        align-items: center;
    }
}

.nav-brand {
    display: flex;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    white-space: nowrap;
}

.logo img {
    height: 36px;
    border-radius: 8px;
}

.nav-main {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.nav-main a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
}

.nav-main a:hover {
    color: var(--primary-color);
    background: var(--bg-card);
}

.nav-main i {
    width: 18px;
    height: 18px;
}

.nav-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.action-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 12px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.action-btn:hover {
    color: var(--primary-color);
    background: var(--bg-card);
    border-color: var(--glass-border);
}

.menu-toggle {
    display: none; /* Only mobile */
}

/* RTL Adjustments */
[dir="rtl"] .logo { flex-direction: row; }
[dir="rtl"] .nav-actions { justify-content: flex-start; }
[dir="rtl"] .nav-main { direction: rtl; }

@media (max-width: 768px) {
    .nav-main {
        display: none;
    }
    .nav-content {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 0.5rem;
    }
    .menu-toggle {
        display: flex;
    }
    .nav-brand {
        flex: 1;
        justify-content: flex-start;
    }
    .logo {
        font-size: 1.2rem;
    }
    .logo img {
        height: 30px;
    }
    .nav-actions {
        gap: 0.5rem;
    }
    .lang-switch {
        padding: 4px 10px;
        font-size: 0.75rem;
    }
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100%;
    background: var(--bg-surface);
    z-index: 2001;
    transition: var(--transition);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: -10px 0 30px rgba(0,0,0,0.1);
}

[dir="rtl"] .mobile-menu {
    right: auto;
    left: -300px;
    box-shadow: 10px 0 30px rgba(0,0,0,0.1);
}

.mobile-menu-overlay.active .mobile-menu {
    right: 0;
}

[dir="rtl"] .mobile-menu-overlay.active .mobile-menu {
    left: 0;
}

.close-menu {
    align-self: flex-end;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-main);
}

.mobile-menu .nav-main {
    display: flex !important;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.mobile-menu .nav-main a {
    width: 100%;
    font-size: 1.2rem;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    padding: 120px 0 60px;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 40%;
    height: 60%;
    background: radial-gradient(circle, rgba(124, 42, 232, 0.15) 0%, transparent 70%);
    z-index: -1;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    align-items: center;
}

.hero-img img {
    width: 100%;
    border-radius: 30px;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

.hero-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

/* Features */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    padding: 2.5rem;
    transition: var(--transition);
}

.feature-card:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-10px);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: rgba(124, 42, 232, 0.1);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    font-size: 2.5rem;
    color: var(--primary-color);
}

.feature-icon svg {
    width: 48px;
    height: 48px;
    stroke-width: 1.5;
    color: var(--primary-color);
}

/* Info Table */
.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 2rem;
}

.info-table td {
    padding: 1.2rem;
    border-bottom: 1px solid var(--glass-border);
}

.info-table td:first-child {
    font-weight: 600;
    color: var(--primary-light);
    width: 40%;
}

/* Blog Preview */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.blog-card {
    overflow: hidden;
    transition: var(--transition);
}

.blog-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.blog-card-content {
    padding: 1.5rem;
}

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

/* Responsive */
[dir="rtl"] .hero-grid {
    direction: rtl;
}

[dir="rtl"] .nav-links {
    flex-direction: row-reverse;
}

[dir="rtl"] .logo {
    flex-direction: row-reverse;
}

[dir="rtl"] h2, [dir="rtl"] .info-table, [dir="rtl"] footer {
    text-align: right;
}

[dir="rtl"] .btn {
    direction: rtl;
}

[dir="rtl"] .feature-icon {
    margin-left: 0;
    margin-right: 0;
}

[dir="rtl"] .info-table td:first-child {
    text-align: right;
}

/* Language Switcher */
.lang-switch {
    background: rgba(124, 42, 232, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--primary-color);
    padding: 6px 14px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.lang-switch:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 992px) {
    h1 { font-size: 3rem; }
    .hero-grid {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 3rem;
    }
    .hero-img img {
        max-width: 500px;
        margin: 0 auto;
    }
}

/* RTL Alignment Fixes */
[dir="rtl"] .nav-content {
    flex-direction: row; /* Default row in RTL puts first child on the right */
}

[dir="rtl"] .nav-left {
    margin-left: 0;
    margin-right: 0;
}

[dir="rtl"] .logo {
    margin-right: auto; /* Push logo to the left in RTL */
    margin-left: 0;
}

[dir="rtl"] .nav-links {
    margin-right: 2rem;
}

/* --- TOTAL MOBILE REBUILD --- */
@media (max-width: 768px) {
    /* Global Overrides */
    section { padding-top: 40px; padding-bottom: 40px; }
    .container { padding-left: 1rem; padding-right: 1rem; }
    
    /* Navigation: Clean & Simple */
    nav {
        position: fixed !important;
        background: var(--bg-surface) !important;
        padding: 0.6rem 0 !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.05) !important;
    }

    .nav-content {
        flex-direction: row !important; /* BACK TO ROW */
        gap: 0.5rem !important;
    }

    .logo {
        width: auto !important;
        justify-content: flex-start !important;
    }

    /* Hero Section: Vertical Stack */
    .hero {
        height: auto !important;
        min-height: 100vh;
        padding: 100px 0 40px !important; /* Reduced top padding as nav is now 1 line */
        display: block !important;
    }

    .hero-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 2rem !important;
        text-align: center !important;
    }

    .hero-img {
        order: -1; /* Image always on top */
        width: 100% !important;
    }

    .hero-img img {
        max-width: 280px !important;
        margin: 0 auto;
        border: none !important;
        box-shadow: none !important;
    }

    h1 {
        font-size: 1.5rem !important;
        line-height: 1.3 !important;
        margin-bottom: 1rem !important;
    }

    .blog-content h1 {
        font-size: 1.4rem !important;
    }
    
    .blog-content h2 {
        font-size: 1.25rem !important;
    }

    .hero-text p {
        font-size: 1rem !important;
    }

    .hero-buttons {
        flex-direction: column !important;
        gap: 1rem !important;
        margin-top: 2rem !important;
    }

    /* Grid Fixes */
    .features-grid, .blog-grid {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

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

    /* Buttons Fix */
    .btn {
        width: 100% !important;
        display: block !important;
        padding: 1rem !important;
        text-align: center !important;
        font-size: 1rem !important;
    }

    .btn.glass {
        background: var(--bg-dark) !important;
        color: var(--primary-color) !important;
        border: 1px solid var(--primary-color) !important;
    }

    /* Table Fix */
    .info-table {
        display: block !important;
        width: 100% !important;
        overflow-x: auto !important;
    }

    .info-table td {
        white-space: nowrap;
        padding: 1rem 0.5rem !important;
    }
}

@media (max-width: 480px) {
    .hero { padding-top: 180px !important; }
}

/* Professional Footer */
.footer-area {
    background: var(--bg-surface);
    border-top: 1px solid var(--glass-border);
    padding: 80px 0 30px;
    margin-top: 60px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 3rem;
    margin-bottom: 3rem;
}

.footer-about .logo {
    display: inline-flex;
    margin-bottom: 1.5rem;
}

.footer-about p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    max-width: 350px;
}

.footer-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.footer-column ul {
    list-style: none;
    padding: 0;
}

.footer-column li {
    margin-bottom: 0.8rem;
}

.footer-column a {
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-column a:hover {
    color: var(--primary-color);
    transform: translateX(5px);
}

[dir="rtl"] .footer-column a:hover {
    transform: translateX(-5px);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--glass-border);
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-bottom p {
    font-size: 0.9rem;
    margin: 0;
    color: var(--text-muted);
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    .footer-about .logo {
        justify-content: center;
    }
    .footer-about p {
        margin: 0 auto;
    }
    .footer-column a {
        justify-content: center;
    }
    .footer-column a:hover {
        transform: translateY(-2px);
    }
    .footer-bottom {
        justify-content: center;
    }
}
