/* ============================================
   BASE STYLES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color var(--transition-speed) ease,
        color var(--transition-speed) ease,
        border-color var(--transition-speed) ease,
        box-shadow var(--transition-speed) ease;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for fixed navbar */
}

/* Enhanced scrolling experience */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 6px;
    border: 2px solid var(--bg-secondary);
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-secondary);
}

body {
    font-family: 'Poppins', 'Tajawal', 'Segoe UI', Tahoma, Geneva, Verdana, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
}

h3 {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

h4 {
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
}

p {
    margin-bottom: 1rem;
    font-size: clamp(0.9rem, 2vw, 1rem);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

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

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

/* Section Titles */
.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--secondary-color);
}

.section-subtitle {
    font-size: 1.1rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

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

.btn-full {
    width: 100%;
    justify-content: center;
}

.btn-icon {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.btn:hover .btn-icon {
    transform: translateX(3px);
}

/* Success Popup */
.success-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px var(--shadow-dark);
    z-index: 2000;
    display: none;
    animation: popupSlideIn 0.3s ease-out;
}

.popup-content {
    text-align: center;
}

.popup-icon {
    font-size: 3rem;
    color: var(--accent-success);
    margin-bottom: 1rem;
}

.success-popup h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.success-popup p {
    color: var(--text-secondary);
    margin: 0;
}

/* Popup Animation */
@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

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

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

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Scroll-triggered animation classes */
.scroll-animate {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Override scroll animations for navbar elements */
.navbar .scroll-animate,
.navbar .scroll-animate-left,
.navbar .scroll-animate-right,
.navbar .scroll-animate-scale {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
}

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

/* Ensure navbar elements are always visible even when animated */
.navbar .scroll-animate.animate-in,
.navbar .scroll-animate-left.animate-in,
.navbar .scroll-animate-right.animate-in,
.navbar .scroll-animate-scale.animate-in {
    opacity: 1 !important;
    transform: none !important;
}

.scroll-animate-left {
    opacity: 0;
    transform: translateX(-30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-left.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.scroll-animate-right {
    opacity: 0;
    transform: translateX(30px);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-right.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.scroll-animate-scale {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-animate-scale.animate-in {
    opacity: 1;
    transform: scale(1);
}

/* Staggered animation delays */
.scroll-animate:nth-child(1) { transition-delay: 0.1s; }
.scroll-animate:nth-child(2) { transition-delay: 0.2s; }
.scroll-animate:nth-child(3) { transition-delay: 0.3s; }
.scroll-animate:nth-child(4) { transition-delay: 0.4s; }
.scroll-animate:nth-child(5) { transition-delay: 0.5s; }
.scroll-animate:nth-child(6) { transition-delay: 0.6s; }

/* Smooth scroll to top button */
.scroll-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 4px 20px rgba(107, 142, 35, 0.3);
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 6px 25px rgba(107, 142, 35, 0.4);
}

/* Progress bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    z-index: 9999;
    transition: width 0.1s ease;
}

/* Show/Hide Popup */
.success-popup.show {
    display: block;
}

/* ============================================
   FORM ERROR STYLES
   ============================================ */

.error {
    border-color: #e74c3c !important;
    background-color: rgba(231, 76, 60, 0.05);
}

.error-message {
    color: #e74c3c;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.loading {
    opacity: 0.8;
    cursor: not-allowed;
}

.loading .btn-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}