/**
 * REFACTORED & OPTIMIZED Header & Footer Styles
 * Improvements include: CSS Custom Properties, Focus-Visible for accessibility, and mobile performance fixes.
 */

/* =================================================================
   GLOBAL VARIABLES & RESET - Linked to home.css colors
   ================================================================= */

:root {
    --primary-color: #FF9500;
    --primary-color-light: #FFA500;
    
    --text-light: #ffffff;
    --text-medium: #E2E8F0;
    --text-subtle: #94A3B8;
    --text-dark: #0A0E27; /* Updated to use from btn color */

    --bg-dark-1: rgba(28, 33, 40, 0.95); /* Header/Footer Dark BG */
    --bg-dark-2: rgba(20, 25, 32, 0.92); /* Header/Footer Dark BG Center */
    
    --border-color-subtle: rgba(255, 149, 0, 0.2);
    --border-color-focus: var(--primary-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    padding-top: 80px;
}

/* =================================================================
   HEADER & NAVIGATION STYLES
   ================================================================= */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    /* Background image with gradient overlay */
    background: 
        linear-gradient(
            135deg,
            var(--bg-dark-1) 0%,
            var(--bg-dark-2) 50%,
            var(--bg-dark-1) 100%
        ),
        url('https://amrfarag404.com/assets/images/690360d648b7c_1761829078.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* Enabled for Desktop */
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color-subtle);
    height: 80px;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4rem;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-light);
    text-decoration: none;
    display: flex;
    align-items: center;
    z-index: 1001;
    flex-shrink: 0;
}

.site-logo img {
    height: 50px;
    width: auto;
}

.site-logo span {
    color: var(--text-light);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 2.5rem;
    flex-grow: 1;
    justify-content: center;
}

.header-cta {
    flex-shrink: 0;
    margin-left: 2rem;
}

.nav-link {
    color: var(--text-medium);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 0; /* for focus ring padding */
}

/* Accessibility and Hover for Desktop Links */
.nav-link:hover, .nav-link:focus-visible {
    color: var(--primary-color);
    outline: none; /* Focus handled by color change */
}

.nav-link.active {
    color: var(--primary-color);
    font-weight: 600;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.site-nav .btn {
    margin-left: 1rem;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
    z-index: 1001;
}

/* Accessibility and Hover for Toggle Button */
.mobile-menu-toggle:hover, .mobile-menu-toggle:focus-visible {
    color: var(--primary-color);
    outline: 2px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 4px;
}

.mobile-nav {
    display: none;
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    /* Mobile Background Overlay (can't disable blur without media query on main bg) */
    background: 
        linear-gradient(
            180deg,
            rgba(20, 25, 32, 0.98) 0%,
            rgba(28, 33, 40, 0.98) 100%
        ),
        url('https://amrfarag404.com/assets/images/690360d648b7c_1761829078.webp');
    background-size: cover;
    background-position: center;
    border-top: 1px solid var(--border-color-subtle);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
    z-index: 999;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.mobile-nav.active {
    max-height: 600px;
}

.mobile-nav-link {
    display: block;
    padding: 1.2rem 2rem;
    color: var(--text-medium);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Accessibility and Hover for Mobile Links */
.mobile-nav-link:hover, .mobile-nav-link:focus-visible {
    color: var(--primary-color);
    background: rgba(255, 149, 0, 0.05);
    padding-left: 2.5rem;
    outline: none; /* Focus handled by background change */
}

.mobile-nav-link.active {
    color: var(--primary-color);
    background: rgba(255, 149, 0, 0.1);
    border-left: 3px solid var(--primary-color);
}

.mobile-nav .btn {
    margin: 1.5rem 2rem;
    width: calc(100% - 4rem);
    text-align: center;
    display: block;
}

/* =================================================================
   FOOTER STYLES
   ================================================================= */

.site-footer {
    /* Background image with gradient overlay */
    background: 
        linear-gradient(
            135deg,
            rgba(28, 33, 40, 0.98) 0%,
            rgba(20, 25, 32, 0.95) 50%,
            rgba(28, 33, 40, 0.98) 100%
        ),
        url('https://amrfarag404.com/assets/images/690360d648b7c_1761829078.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* Enabled for Desktop */
    border-top: 1px solid var(--border-color-subtle);
    padding: 3rem 0 1.5rem;
    width: 100%;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.site-footer .container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 2rem;
    align-items: start;
}

.footer-brand {
    grid-column: span 1;
    text-align: center;
}

.footer-brand .footer-description {
    margin-left: auto;
    margin-right: auto;
}

.footer-brand .footer-social {
    justify-content: center;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-light);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 1rem;
}

.footer-logo img {
    height: 50px;
    width: auto;
}

.footer-description {
    color: var(--text-subtle);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
    max-width: 280px;
}

.footer-social {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(15, 20, 25, 0.8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
    font-size: 1.1rem;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color-subtle);
    backdrop-filter: blur(5px);
}

/* Accessibility and Hover for Social Links */
.social-link:hover, .social-link:focus-visible {
    background: var(--primary-color);
    color: var(--text-dark);
    transform: translateY(-2px);
    border-color: var(--border-color-focus);
    box-shadow: 0 8px 20px rgba(255, 149, 0, 0.3);
    outline: none; /* Focus handled by style change */
}

.footer-column {
    grid-column: span 1;
    text-align: center;
}

.footer-column .footer-links {
    align-items: center;
}

.footer-column .footer-link {
    justify-content: center;
}

.footer-column .footer-social {
    justify-content: center;
}

.footer-title {
    color: var(--text-light);
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.footer-link {
    color: var(--text-subtle);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-link i {
    color: var(--primary-color);
    font-size: 0.75rem;
    min-width: 14px;
}

/* Accessibility and Hover for Footer Links */
.footer-link:hover, .footer-link:focus-visible {
    color: var(--primary-color);
    padding-left: 0.5rem;
    outline: none; /* Focus handled by style change */
}

.footer-bottom {
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.footer-copyright {
    color: var(--text-subtle);
    font-size: 0.875rem;
}

/* =================================================================
   BUTTON STYLES
   ================================================================= */

.btn {
    display: inline-block;
    padding: 0.75rem 1.75rem;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-color-light) 100%);
    color: var(--text-dark);
    box-shadow: 0 4px 15px rgba(255, 149, 0, 0.3);
}

/* Accessibility and Hover for Primary Button */
.btn-primary:hover, .btn-primary:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 149, 0, 0.4);
    outline-offset: 3px;
    border-radius: 11px; /* To maintain rounded corner visual */
}

.btn-primary:active {
    transform: translateY(0);
}

/* =================================================================
   UTILITY CONTAINERS
   ================================================================= */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}


/* =================================================================
   MEDIA QUERIES - RESPONSIVENESS & MOBILE PERFORMANCE FIXES
   ================================================================= */

@media (max-width: 1024px) {
    .site-footer .container {
        padding: 0 2.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }
    
    .footer-brand {
        grid-column: span 2;
        order: 2; /* Move brand to center of two-column layout */
    }

    .footer-column {
        order: 1;
    }
}

@media (max-width: 768px) {
    /* MOBILE PERFORMANCE FIX */
    .site-header, .site-footer {
        background-attachment: scroll;
        /* Blur is still active but scroll improves dramatically */
    }

    .header-container {
        padding: 0 2rem;
    }
    
    .site-nav {
        display: none !important;
    }
    
    .header-cta {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: block !important;
    }
    
    .mobile-nav {
        display: block !important;
    }
    
    body {
        padding-top: 80px;
    }
    
    .container {
        padding: 0 1.5rem;
    }

    /* Footer Single Column */
    .site-footer {
        padding: 3rem 0 2rem;
    }
    
    .site-footer .container {
        padding: 0 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }
    
    .footer-brand, .footer-column {
        grid-column: span 1;
        text-align: center;
        order: initial;
    }

    .footer-column .footer-links, 
    .footer-column .footer-social {
        justify-content: center;
        align-items: center;
    }
    
    .footer-link {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 1rem;
    }
    
    .site-logo {
        font-size: 1.2rem;
    }
    
    .site-logo img {
        height: 40px;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .site-footer {
        padding: 2.5rem 0 1.5rem;
    }
    
    .site-footer .container {
        padding: 0 1rem;
    }
    
    .footer-content {
        gap: 2rem;
    }
    
    .social-link {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}