/* CSS Reset and Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    width: 100%;
    max-width: 100vw;
}

body {
    font-family: 'Cairo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #2d3748;
    background-color: #ffffff;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    /* Additional fixes for horizontal scroll */
    position: relative;
    min-height: 100vh;
}

/* CSS Variables for Taleek Brand Colors - Updated to match current design */
:root {
    /* Primary warm brown/beige colors from current Taleek design */
    --primary-color: #b8860b;  /* Dark golden brown for main elements */
    --primary-light: #daa520;  /* Golden yellow for accents */
    --primary-dark: #8b7355;   /* Darker brown for depth */
    
    /* Secondary warm tones */
    --secondary-color: #cd853f;  /* Peru/sandy brown */
    --secondary-light: #f4a460;  /* Sandy brown light */
    --secondary-dark: #a0522d;   /* Sienna */
    
    /* Accent colors */
    --accent-color: #daa520;     /* Goldenrod */
    --accent-light: #ffd700;     /* Gold */
    --accent-warm: #f5deb3;      /* Wheat color for backgrounds */
    
    /* Neutral warm tones */
    --beige-lightest: #faf6f0;   /* Very light warm beige */
    --beige-light: #f5f1e8;      /* Light warm beige */
    --beige-medium: #e8dcc0;     /* Medium warm beige */
    --beige-dark: #d2b48c;       /* Tan */
    --brown-light: #deb887;      /* Burlywood */
    --brown-medium: #bc9a6a;     /* Medium brown */
    --brown-dark: #8b7355;       /* Dark brown */
    
    /* Status colors with warm tint */
    --success-color: #228b22;    /* Forest green */
    --warning-color: #ff8c00;    /* Dark orange */
    --error-color: #dc143c;      /* Crimson */
    --info-color: #4682b4;       /* Steel blue */
    
    /* Text colors */
    --text-primary: #3c2f2f;     /* Dark warm brown */
    --text-secondary: #5d4e37;   /* Medium brown */
    --text-muted: #8b7355;       /* Light brown */
    --text-light: #a0522d;       /* Lighter brown for less important text */
    
    /* Background colors */
    --bg-primary: #ffffff;       /* White */
    --bg-secondary: #faf6f0;     /* Very light warm beige */
    --bg-accent: #f5f1e8;        /* Light warm beige */
    --bg-warm: #f5deb3;          /* Wheat */
    --bg-card: #fefcf7;          /* Warm white for cards */
    
    /* Border colors */
    --border-color: #e8dcc0;     /* Medium warm beige */
    --border-light: #f5f1e8;     /* Light warm beige */
    --border-dark: #d2b48c;      /* Tan */
    
    /* Shadows with warm tint */
    --shadow-sm: 0 1px 2px 0 rgba(139, 115, 85, 0.15);
    --shadow-md: 0 4px 6px -1px rgba(139, 115, 85, 0.2), 0 2px 4px -1px rgba(139, 115, 85, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(139, 115, 85, 0.2), 0 4px 6px -2px rgba(139, 115, 85, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(139, 115, 85, 0.25), 0 10px 10px -5px rgba(139, 115, 85, 0.1);
    --shadow-warm: 0 4px 20px rgba(218, 165, 32, 0.15);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #daa520, #b8860b);
    --gradient-warm: linear-gradient(135deg, #f5deb3, #e8dcc0);
    --gradient-hero: linear-gradient(135deg, #faf6f0, #f5f1e8);
    
    /* Border radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    
    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); /* Reduced from 0.3s */
    --transition-fast: all 0.1s ease-out; /* Reduced from 0.15s */
    --transition-slow: all 0.3s ease-out; /* Reduced from 0.5s */
}

/* Accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 1000;
    transition: var(--transition);
}

.skip-link:focus {
    top: 6px;
}

/* Focus styles for better accessibility */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
    /* Prevent horizontal overflow */
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

@media (min-width: 640px) {
    .container {
        padding: 0 2rem;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 900;
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    font-weight: 700;
}

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    min-height: 48px; /* Accessibility touch target */
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary-color));
    box-shadow: var(--shadow-warm);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: white;
    border-color: var(--secondary-color);
    box-shadow: var(--shadow-md);
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--secondary-light), var(--secondary-color));
    box-shadow: var(--shadow-warm);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    border-radius: var(--radius-xl);
}

/* Navigation styles are now in navigation.css */

/* Main Content */
main {
    padding-top: 70px; /* Account for fixed header height */
    /* Ensure proper scrolling */
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    /* Enable smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch;
}

/* Hero Section */
.hero {
    padding: 3rem 0;
    background: var(--gradient-hero);
    overflow: hidden;
    position: relative;
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    /* Fix for mobile scrolling issues */
    height: auto;
    min-height: calc(100vh - 70px);
    /* Ensure proper viewport handling on mobile */
    -webkit-overflow-scrolling: touch;
    /* Performance optimization: Enable hardware acceleration */
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="%23daa520" opacity="0.1"/><circle cx="60" cy="60" r="1" fill="%23b8860b" opacity="0.1"/><circle cx="90" cy="30" r="1" fill="%23cd853f" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
    opacity: 0.3;
    pointer-events: none;
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
    position: relative;
    z-index: 1;
    width: 100%;
    /* Prevent horizontal overflow */
    max-width: 100%;
    box-sizing: border-box;
}

.hero-title {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-title .highlight {
    color: var(--primary-color);
    position: relative;
}

.hero-title .highlight::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

.hero-description {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.hero-trust {
    display: flex;
    gap: 2rem;
}

.trust-item {
    text-align: center;
}

.trust-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--primary-color);
}

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

.hero-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-mockup {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    /* Performance optimization: Remove heavy 3D transforms */
    /* transform: perspective(1000px) rotateY(-5deg) rotateX(5deg); */
    /* Use lighter transform for better performance */
    transform: translateY(0);
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
    /* Enable hardware acceleration */
    will-change: transform;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.app-mockup:hover {
    /* Lighter hover effect */
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl), 0 20px 40px rgba(139, 115, 85, 0.2);
}

@media (max-width: 768px) {
    .hero {
        padding: 2rem 0;
        /* Mobile-specific viewport fixes */
        min-height: calc(100vh - 70px);
        height: auto;
        /* Ensure proper touch scrolling */
        -webkit-overflow-scrolling: touch;
        overflow-x: hidden;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
        /* Prevent mobile overflow */
        width: 100%;
        max-width: 100%;
        padding: 0 1rem;
        box-sizing: border-box;
    }
    
    .hero-cta {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .hero-trust {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    /* Fix for mobile viewport issues */
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
    }
    
    .container {
        padding: 0 1rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* Section Styles */
section {
    padding: 4rem 0;
    /* Prevent horizontal overflow */
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Grid layouts */
.languages-grid,
.features-grid,
.testimonials-grid,
.stats-grid {
    display: grid;
    gap: 2rem;
    /* Prevent horizontal overflow */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}

.section-title {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

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

/* About Section */
.about {
    background: var(--bg-secondary);
    position: relative;
}

.about::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-warm);
    opacity: 0.3;
    pointer-events: none;
}

/* Languages Section */
.language-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.language-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent 70%, var(--accent-warm) 100%);
    opacity: 0.5;
    pointer-events: none;
}

.language-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.language-icon {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.language-icon img {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.language-title {
    color: var(--text-primary);
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.language-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.language-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.stat {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--bg-accent);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
}

/* Statistics Section */
.statistics {
    background: var(--gradient-primary);
    color: white;
    position: relative;
    overflow: hidden;
}

.statistics::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 70%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(205, 133, 63, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

.statistics .section-title {
    color: white;
    position: relative;
    z-index: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    position: relative;
    z-index: 1;
}

.hero-stats {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: rgba(139, 115, 85, 0.9);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(139, 115, 85, 0.3);
    position: relative;
    z-index: 1;
    min-width: 120px;
    box-shadow: var(--shadow-md);
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: 0.5rem;
    color: var(--accent-light);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.stat-label {
    font-size: 1rem;
    color: var(--beige-lightest);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Features Section */
.features {
    background: var(--bg-accent);
    position: relative;
}

.features::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-warm);
    opacity: 0.2;
    pointer-events: none;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    text-align: center;
    transition: var(--transition);
    border: 1px solid var(--border-light);
    position: relative;
    z-index: 1;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.feature-icon {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.feature-title {
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.feature-description {
    color: var(--text-secondary);
}

/* Testimonials Section */
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.testimonial-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-light);
    position: relative;
}

.testimonial-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.testimonial-content {
    margin-bottom: 1.5rem;
}

.testimonial-text {
    font-size: 1.125rem;
    color: var(--text-secondary);
    font-style: italic;
    position: relative;
}

.testimonial-text::before {
    content: '"';
    font-size: 3rem;
    color: var(--primary-color);
    position: absolute;
    top: -1rem;
    right: -0.5rem;
    line-height: 1;
}

.testimonial-author {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.author-avatar img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
}

.author-name {
    color: var(--text-primary);
    font-size: 1.125rem;
    margin-bottom: 0.25rem;
}

.author-title {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0;
}

/* CTA Section */
.cta {
    background: linear-gradient(135deg, var(--secondary-color), var(--secondary-dark));
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 20% 80%, rgba(255, 215, 0, 0.15) 0%, transparent 50%),
                radial-gradient(circle at 80% 20%, rgba(244, 164, 96, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.cta-title {
    color: white;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
}

.cta-description {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.9);
    position: relative;
    z-index: 1;
}

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-brand {
    grid-column: span 1;
}

.footer-logo {
    margin-bottom: 1rem;
    width: 120px;
    height: 40px;
    object-fit: contain;
    object-position: center;
}

.footer-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

.footer-title {
    color: white;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .footer-logo {
        width: 100px;
        height: 33px;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes countUp {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Intersection Observer animations */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(20px); /* Reduced from 30px for faster appearance */
    transition: all 0.4s ease-out; /* Reduced from 0.6s for faster animation */
    will-change: transform, opacity;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Performance optimization: Reduce animation delays */
.language-card,
.feature-card,
.testimonial-card {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease-out; /* Faster transitions */
    will-change: transform, opacity;
}

.language-card.animated,
.feature-card.animated,
.testimonial-card.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Performance optimizations */
.hero-image,
.language-card,
.feature-card,
.testimonial-card {
    will-change: transform;
}

/* Languages Section */
.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    /* Prevent horizontal overflow */
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}


/* Mobile Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
}

/* Print styles */
@media print {
    .header,
    .footer,
    .cta {
        display: none;
    }
    
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #000000;
        --text-secondary: #000000;
        --border-color: #000000;
    }
}

/* Reduced motion */
@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;
    }
}
