/* ==================== Variables ==================== */
:root {
    /* Colors - Light Mode */
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #14b8a6;
    --background: #ffffff;
    --surface: #f8fafc;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: rgba(0, 0, 0, 0.1);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    
    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    
    /* Transitions */
    --transition: all 0.3s ease;
}

/* Dark Mode Colors */
body.dark-mode {
    --background: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* ==================== Reset & Base ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    /* Removed: overflow-x: hidden; */
    max-width: 100%;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    transition: var(--transition);
    /* Removed: overflow-x: hidden; */
    max-width: 100vw;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

/* ==================== Container ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
    /* Removed: overflow-x: hidden; */
}

/* ==================== Buttons ==================== */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px var(--shadow);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1.25rem 3rem;
    font-size: 1.125rem;
}

/* ==================== Navigation ==================== */
.navbar {
    background: var(--background);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1000;
    will-change: transform; /* Optimization for sticky element */
    backdrop-filter: blur(10px);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-sm) 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.nav-menu {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-menu a {
    font-weight: 500;
    transition: var(--transition);
}

.nav-menu a:hover {
    color: var(--primary);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: var(--text);
    border-radius: 3px;
    transition: var(--transition);
}

.theme-toggle {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.25rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    transform: scale(1.1);
}

body.dark-mode .theme-toggle .sun {
    display: none;
}

body:not(.dark-mode) .theme-toggle .moon {
    display: none;
}

/* Mobile Navigation Adjustments */
@media (max-width: 768px) {
    .nav-content {
        /* Use grid to position elements precisely for mobile */
        display: grid;
        grid-template-columns: auto 1fr auto; /* Theme Toggle | Logo | Menu Toggle */
        align-items: center;
        justify-items: center;
    }

    .logo {
        grid-column: 2 / 3; /* Center the logo */
        justify-self: center;
    }

    .theme-toggle {
        grid-column: 1 / 2; /* Place theme toggle on the right (start in RTL) */
        justify-self: start;
    }

    .menu-toggle {
        grid-column: 3 / 4; /* Place menu toggle on the left (end in RTL) */
        justify-self: end;
    }
}

/* ==================== Hero Section ==================== */
.hero {
    padding: var(--spacing-xl) 0;
    background: linear-gradient(135deg, var(--surface), var(--background));
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.hero-title {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
}

.gradient-text {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

.typing-container {
    height: 60px;
    margin-bottom: var(--spacing-md);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--secondary);
}

.cursor {
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.hero-description {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.hero-stats {
    display: flex;
    gap: var(--spacing-lg);
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.hero-image {
    position: relative;
}

.hero-image img {
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px var(--shadow);
    will-change: transform, box-shadow; /* Optimization for image with shadow */
}

.floating-icons {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
}

.icon {
    position: absolute;
    font-size: 2rem;
    will-change: transform; /* Optimization for animation */
    animation: float 3s ease-in-out infinite;
}

.icon-1 { top: 10%; right: -10%; animation-delay: 0s; }
.icon-2 { top: 30%; left: -10%; animation-delay: 0.5s; }
.icon-3 { bottom: 30%; right: -10%; animation-delay: 1s; }
.icon-4 { bottom: 10%; left: -10%; animation-delay: 1.5s; }

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

/* ==================== Section Header ==================== */
.section-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.section-header h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.section-header p {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

/* ==================== Features Section ==================== */
.features {
    padding: var(--spacing-xl) 0;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-lg);
}

.feature-card {
    background: var(--surface);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: var(--transition);
    text-align: center;
    will-change: transform, box-shadow; /* Optimization for hover effect */
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px var(--shadow);
}

.feature-image {
    margin-bottom: var(--spacing-md);
    border-radius: var(--radius-md);
    overflow: hidden;
}

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

.feature-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
}

.feature-card h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-sm);
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* ==================== Pricing Section ==================== */
.pricing {
    padding: var(--spacing-xl) 0;
    background: var(--surface);
}

.pricing-card {
    max-width: 800px;
    margin: 0 auto;
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    border: 2px solid var(--primary);
    box-shadow: 0 20px 60px var(--shadow);
}

.pricing-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.pricing-header h3 {
    font-size: 2rem;
    margin-bottom: var(--spacing-md);
}

.price {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.currency, .period {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.price-note {
    color: var(--text-secondary);
    font-size: 1rem;
}

.features-list {
    margin-bottom: var(--spacing-lg);
}

.features-list li {
    padding: var(--spacing-sm);
    font-size: 1.125rem;
    border-bottom: 1px solid var(--border);
}

.pricing-buttons {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
}

.pricing-faq {
    margin-top: var(--spacing-xl);
    text-align: center;
}

.pricing-faq h3 {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
}

.faq-item {
    background: var(--background);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}

.faq-item h4 {
    margin-bottom: var(--spacing-sm);
    color: var(--primary);
}

.faq-item p {
    color: var(--text-secondary);
}

/* ==================== Screenshots Section ==================== */
.screenshots {
    padding: var(--spacing-xl) 0;
}

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: var(--spacing-lg);
}

.screenshot-item {
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 10px 30px var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    will-change: transform, box-shadow; /* Optimization for hover effect */
}

.screenshot-item:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px var(--shadow);
}

.screenshot-item img {
    width: 100%;
    height: auto;
    transition: var(--transition);
    will-change: transform; /* Optimization for hover effect */
}

.screenshot-item img:hover {
    transform: scale(1.1);
}

/* ==================== About Section ==================== */
.about {
    padding: var(--spacing-xl) 0;
    background: linear-gradient(135deg, var(--surface), var(--background));
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    align-items: center;
}

.about-text h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-md);
}

.about-text p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: var(--spacing-lg);
}

.about-stats {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

.about-image img {
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px var(--shadow);
}

/* ==================== Contact Section ==================== */
.contact {
    padding: var(--spacing-xl) 0;
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
}

.contact-info {
    background: var(--surface);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.contact-info h3 {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.contact-info p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.contact-info a {
    display: block;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.contact-form {
    background: var(--background);
    padding: var(--spacing-xl);
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px var(--shadow);
}

.contact-form h3 {
    font-size: 2rem;
    margin-bottom: var(--spacing-lg);
}

.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: var(--spacing-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

/* ==================== Footer ==================== */
.footer {
    background: var(--surface);
    padding: var(--spacing-xl) 0 var(--spacing-md);
    border-top: 1px solid var(--border);
}

.footer-content {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.footer-about h3 {
    font-size: 1.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--primary);
}

.footer-about p {
    color: var(--text-secondary);
    line-height: 1.8;
}

.footer-links h4 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
}

.footer-links ul li {
    margin-bottom: var(--spacing-sm);
}

.footer-links ul li a {
    color: var(--text-secondary);
}

.footer-links ul li a:hover {
    color: var(--primary);
}

.footer-contact h4 {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-md);
}

.footer-contact p {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.footer-contact a {
    color: var(--primary);
    font-weight: 600;
}

.footer-bottom {
    text-align: center;
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* ==================== Scroll to Top Button ==================== */
#scrollTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
}

#scrollTop.visible {
    opacity: 1;
    visibility: visible;
}

/* ==================== Responsive Design ==================== */

/* Tablet (max-width: 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 0 var(--spacing-lg);
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-text {
        order: 2;
    }
    
    .hero-image {
        order: 1;
        margin-bottom: var(--spacing-xl);
    }
    
    .hero-buttons {
        justify-content: center;
    }
    
    .hero-stats {
        justify-content: center;
    }
    
    .about-content {
        grid-template-columns: 1fr;
    }
    
    .about-image {
        margin-bottom: var(--spacing-xl);
    }
    
    .contact-content {
        grid-template-columns: 1fr;
    }
    
    .contact-info {
        order: 2;
    }
    
    .contact-form {
        order: 1;
        margin-bottom: var(--spacing-xl);
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
}

/* Mobile (max-width: 768px) */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .typing-container {
        font-size: 1.25rem;
    }
    
    .hero-buttons {
        flex-direction: column;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: var(--spacing-md);
    }
    
    .stat {
        flex-direction: row;
        justify-content: space-between;
        padding: var(--spacing-sm);
        background: var(--surface);
        border-radius: var(--radius-md);
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .nav-menu {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 100%;
        right: 0;
        width: 100%;
        background: var(--background);
        border-top: 1px solid var(--border);
        padding: var(--spacing-md) 0;
        box-shadow: 0 10px 30px var(--shadow);
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-menu li {
        padding: var(--spacing-sm) var(--spacing-md);
        text-align: center;
    }
    
    .menu-toggle {
        display: flex;
    }
    
    .theme-toggle {
        margin-right: var(--spacing-md);
    }
    
    .footer-content {
        grid-template-columns: 1fr;
    }
}

/* Mobile Small (max-width: 480px) */
@media (max-width: 480px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .section-header h2 {
        font-size: 2rem;
    }
    
    .screenshots-grid {
        grid-template-columns: 1fr;
    }
}

/* Lightbox Styles (Added by JS, but included here for completeness) */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 1rem;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    left: 10px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    transform: scale(1.2);
}
