/* CSS Variables */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #e67e22;
    --accent-color: #3498db;
    --background-light: #f8f9fa;
    --background-dark: #2c3e50;
    --text-primary: #2c3e50;
    --text-secondary: #7f8c8d;
    --white: #ffffff;
    --border-radius: 12px;
    --shadow-light: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 5px 20px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-arabic: 'Amiri', serif;
    --font-latin: 'Inter', sans-serif;
}

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

body {
    font-family: var(--font-latin);
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Geometric Pattern Background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(52, 152, 219, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(230, 126, 34, 0.1) 0%, transparent 50%),
        linear-gradient(45deg, transparent 40%, rgba(44, 62, 80, 0.05) 50%, transparent 60%);
    background-size: 400px 400px, 300px 300px, 100px 100px;
    background-position: 0 0, 200px 200px, 50px 50px;
    animation: float 20s ease-in-out infinite;
    z-index: -2;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-20px) rotate(1deg); }
    66% { transform: translateY(10px) rotate(-1deg); }
}

/* RTL Support */
[dir="rtl"] {
    font-family: var(--font-arabic);
}

[dir="rtl"] * {
    text-align: right;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navigation */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 15px 0;
    box-shadow: var(--shadow-light);
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-menu {
    display: flex;
    gap: 30px;
}

.nav-link {
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-color);
    transition: var(--transition);
}

.nav-link:hover::after {
    width: 100%;
}

.language-switcher {
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.8);
    padding: 5px;
    border-radius: 25px;
    box-shadow: var(--shadow-light);
}

.lang-btn {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
    transition: var(--transition);
}

.lang-btn.active {
    background: var(--secondary-color);
    color: var(--white);
    box-shadow: var(--shadow-light);
}

/* Language Selection Section */
.language-selection {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 0 50px;
    position: relative;
}

.main-title {
    text-align: center;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    margin-bottom: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 1s ease-out 0.2s forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.language-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
}

.lang-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
    background: var(--white);
    border-radius: var(--border-radius);
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.2rem;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(50px);
    animation: slideInUp 0.8s ease-out forwards;
}

.lang-button:nth-child(1) { animation-delay: 0.3s; }
.lang-button:nth-child(2) { animation-delay: 0.5s; }
.lang-button:nth-child(3) { animation-delay: 0.7s; }

@keyframes slideInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lang-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: var(--transition);
}

.lang-button:hover::before {
    left: 100%;
}

.lang-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.flag-icon {
    font-size: 3rem;
    margin-bottom: 15px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Key Terms Section */
.key-terms {
    padding: 80px 0;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.section-title {
    text-align: center;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 700;
    margin-bottom: 60px;
    color: var(--primary-color);
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, var(--secondary-color), var(--accent-color));
    border-radius: 2px;
}

.terms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 40px;
    margin-top: 50px;
}

.term-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    transition: var(--transition);
    opacity: 0;
    transform: translateY(50px);
}

.term-card.animate-in {
    animation: fadeInUp 0.8s ease-out forwards;
}

.term-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.term-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: var(--transition);
}

.term-card:hover .term-image {
    transform: scale(1.05);
}

.term-content {
    padding: 30px;
}

.term-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--primary-color);
}

.term-description {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95rem;
}

/* Contact Section */
.contact-section {
    padding: 80px 0;
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
}

.contact-section .section-title {
    color: var(--white);
}

.contact-text {
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    opacity: 0.9;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .nav-menu {
        gap: 20px;
    }
    
    .language-selection {
        padding: 120px 0 30px;
    }
    
    .language-buttons {
        grid-template-columns: 1fr;
        max-width: 400px;
    }
    
    .terms-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .term-card {
        margin: 0 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .nav-container {
        padding: 0 15px;
    }
    
    .lang-button {
        padding: 30px 20px;
    }
    
    .flag-icon {
        font-size: 2.5rem;
    }
    
    .term-content {
        padding: 20px;
    }
}

/* RTL Specific Styles */
[dir="rtl"] .nav-link::after {
    right: 0;
    left: auto;
}

[dir="rtl"] .section-title::after {
    right: 50%;
    left: auto;
    transform: translateX(50%);
}

[dir="rtl"] .term-title,
[dir="rtl"] .term-description {
    text-align: right;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.lang-button:focus,
.lang-btn:focus,
.nav-link:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Loading Animation */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.fade-transition {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.fade-transition.show {
    opacity: 1;
}