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

html {
    scroll-behavior: smooth;
}

body {
    line-height: 1.6;
    color: #333;
    font-family: 'Inter', sans-serif;
}

/* Arabic Font Support */
[dir="rtl"] {
    font-family: 'Tajawal', 'Inter', sans-serif;
}

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

[dir="rtl"] .text-center {
    text-align: center !important;
}

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

[dir="rtl"] .space-x-4 > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

[dir="rtl"] .space-x-8 > * + * {
    margin-left: 0;
    margin-right: 2rem;
}

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

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

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out;
}

.animate-slide-in-right {
    animation: slideInFromRight 0.8s ease-out;
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.8s ease-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* Language Toggle */
#languageToggle {
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#languageToggle:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* Header Styles */
header {
    backdrop-filter: blur(20px);
    background-color: rgba(255, 255, 255, 0.95);
    transition: all 0.3s ease;
}

header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

nav ul li a {
    position: relative;
    transition: all 0.3s ease;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    width: 0;
    height: 2px;
    background: #2563eb;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

nav ul li a:hover::after {
    width: 100%;
}

/* Hero Section */
.hero-gradient {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 50%, #1d4ed8 100%);
    position: relative;
    overflow: hidden;
}

.hero-gradient::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="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

/* Card Hover Effects */
.card-hover {
    transition: all 0.3s ease;
    transform: translateY(0);
}

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

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-accent {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    transition: all 0.3s ease;
}

.btn-accent:hover {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
}

/* Template Cards */
.template-card {
    transition: all 0.4s ease;
    border: 2px solid transparent;
}

.template-card:hover {
    border-color: #2563eb;
    transform: scale(1.02);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.template-card img {
    transition: all 0.4s ease;
}

.template-card:hover img {
    transform: scale(1.05);
}

/* Pricing Cards */
.pricing-card {
    transition: all 0.4s ease;
    position: relative;
}

.pricing-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
}

.pricing-card.featured {
    transform: scale(1.05);
    z-index: 10;
}

.pricing-card.featured:hover {
    transform: scale(1.08) translateY(-8px);
}

/* Testimonial Cards */
.testimonial-card {
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
}

.testimonial-card:hover {
    border-left-color: #2563eb;
    transform: translateX(5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Form Styles */
input, textarea, select {
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
}

input:focus, textarea:focus, select:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    outline: none;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Modal Styles */
.modal-backdrop {
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.modal-content {
    animation: slideInFromBottom 0.4s ease;
}

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

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Payment Form Styles */
.StripeElement {
    background-color: white;
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    transition: border-color 0.3s ease;
}

.StripeElement--focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.StripeElement--invalid {
    border-color: #ef4444;
}

/* Success Messages */
.success-message {
    animation: slideInFromRight 0.5s ease;
}

.error-message {
    background-color: #fef2f2;
    border-left: 4px solid #ef4444;
    color: #dc2626;
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1rem 0;
}

/* Scroll Animations */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Mobile Menu Animation */
#mobileMenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

#mobileMenu.active {
    max-height: 300px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.75rem;
    }

    .hero-gradient h1 {
        font-size: 2.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .md\:grid-cols-2 {
        grid-template-columns: 1fr;
    }

    .md\:grid-cols-3 {
        grid-template-columns: 1fr;
    }

    .md\:grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .pricing-card.featured {
        transform: none;
    }

    .pricing-card.featured:hover {
        transform: translateY(-8px);
    }

    /* RTL Mobile Adjustments */
    [dir="rtl"] .flex {
        flex-direction: column;
    }

    [dir="rtl"] .md\:flex-row {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero-gradient h1 {
        font-size: 2rem;
    }

    .hero-gradient p {
        font-size: 1rem;
    }

    .md\:grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .template-card,
    .pricing-card,
    .testimonial-card {
        margin-bottom: 1rem;
    }
}

/* Print Styles */
@media print {
    .fixed,
    header,
    #languageToggle,
    #paymentModal,
    #successMessage {
        display: none !important;
    }

    body {
        font-size: 12pt;
        line-height: 1.4;
    }

    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .no-print {
        display: none !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #1f2937;
        --text-color: #f9fafb;
        --border-color: #374151;
    }

    .dark-mode-support {
        background-color: var(--bg-color);
        color: var(--text-color);
        border-color: var(--border-color);
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus Styles for Better Accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .bg-primary { background-color: #000000 !important; }
    .text-primary { color: #000000 !important; }
    .border-primary { border-color: #000000 !important; }
}

/* Reduce Motion for Accessibility */
@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;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #2563eb;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1e40af;
}

/* Performance Optimizations */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Utility Classes */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur {
    backdrop-filter: blur(10px);
}

.gradient-text {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Advanced Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

.hover-scale {
    transition: transform 0.3s ease;
}

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

/* Loading Animations */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Image Optimization */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.lazy-load {
    opacity: 0;
    transition: opacity 0.3s;
}

.lazy-load.loaded {
    opacity: 1;
}

/* Form Validation Styles */
.field-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.field-success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

.error-text {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.success-text {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}