/* Use the preloaded fonts from HTML */
/* @import url removed for performance */

:root {
    --primary-green: #4CAF50;
    --secondary-green: #81C784;
    --light-green: #C8E6C9;
    --dark-green: #2E7D32;
    --cream: #F5F5DC;
    --light-cream: #FFF8E1;
    --dark-cream: #F0EAD6;
    --brown: #D8CAB8;
    --light-brown: #E5D9C6;
    --dark-brown: #C4B7A5;
    --light-gray: #C0C0C0;
    --dark-gray: #8B8B8B;
    --light-navy: #34495E;
    --yellow: #FFE5B4;
    --light-yellow: #FFEDC2;
    --dark-yellow: #F5D99F;
    --text-dark: #2C3E50;
    --text-light: #546E7A;
    --accent: #FFB74D;
    --shadow: rgba(0, 0, 0, 0.1);
    
    /* Performance variables */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body {
    font-family: 'Cairo', sans-serif;
    background: linear-gradient(to bottom, var(--light-cream), var(--cream), var(--brown));
    min-height: 100vh;
    color: var(--navy);
    margin: 0;
    will-change: opacity;
}

html {
    scroll-behavior: smooth;
}

/* Optimize all animations for GPU acceleration */
.animate__animated,
.section-content,
.product-card,
.btn-primary:hover,
.nav-link,
.header,
.social-icon,
.contact-link {
    will-change: transform, opacity;
}

/* General image optimizations */
img {
    max-width: 100%;
    height: auto;
    display: block;
    
    /* Add width and height attributes to all images in HTML */
    /* This prevents layout shifts during loading */
}

/* Optimize image rendering */
img[src$=".jpg"], img[src$=".jpeg"], img[src$=".png"] {
    image-rendering: auto;
}

.section {
    min-height: 100vh;
    width: 95%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50px;
    margin: 20px auto;
    color: var(--navy);
}

.section-content {
    text-align: center;
    padding: 2rem;
    width: 100%;
    max-width: 1200px;
}

.section h2 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--navy);
    background: linear-gradient(to right, var(--brown), var(--yellow));
    -webkit-background-clip: text;
    background-clip: text;
    margin-bottom: 1.5rem;
    position: relative;
}

.section h3, .section h4 {
    position: relative;
    margin-bottom: 1.5rem;
}

.section h2[data-title="تواصل معنا"],
.section h2[data-title="فيديو"],
.section h2[data-title="منتجاتنا"] {
    position: relative;
}

.section h2[data-title="تواصل معنا"]::after,
.section h2[data-title="فيديو"]::after,
.section h2[data-title="منتجاتنا"]::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--primary-green);
}

main p {
    font-size: 1.125rem;
    color: var(--gray);
    padding: 0.5rem;
    border-radius: 8px;
    max-width: 800px;
    margin: 0 auto;
}

.banner-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
}

.banner-img {
    width: 50%;
    max-width: 700px;
    height: auto;
    margin: 0 auto;
    margin-top: 250px;
}

/* Optimize button transitions */
.btn-primary {
    background: var(--yellow);
    border: none;
    padding: 0.75rem 2rem;
    color: var(--navy);
    border-radius: 8px;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.btn-primary:hover {
    background: var(--brown);
    transform: scale(1.05);
}

/* Optimize product card animations */
.product-card {
    background: var(--cream);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    border: 1px solid var(--brown);
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 5px 15px var(--shadow);
}

.product-img {
    width: 100%;
    max-height: 200px;
    height: auto;
    object-fit: contain;
    border-radius: 5px;
    margin-bottom: 1rem;
}

.product-filter .form-control {
    max-width: 300px;
    margin: 0 auto;
    border-radius: 8px;
    border: 1px solid var(--gray);
}

.nav-tabs .nav-link {
    color: var(--gray);
    border: none;
    font-weight: 500;
    transition: color var(--transition-fast), border-bottom var(--transition-fast);
}

.nav-tabs .nav-link.active {
    color: var(--navy);
    border-bottom: 2px solid var(--yellow);
}

.footer {
    background: var(--navy);
    color: var(--cream);
    padding: 4rem 0 2rem;
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--yellow), transparent);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 2rem;
    margin-bottom: 3rem;
}

.footer-section {
    flex: 1;
    min-width: 250px;
}

.footer h4 {
    color: var(--yellow);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-link {
    color: var(--cream);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all var(--transition-fast);
    padding: 0.5rem;
    border-radius: 8px;
}

.contact-link:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.contact-link i {
    font-size: 1.2rem;
    color: var(--yellow);
    width: 24px;
    text-align: center;
}

.social-icons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.social-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.social-icon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transform: scale(0);
    transition: transform var(--transition-normal);
    border-radius: 50%;
}

.social-icon:hover::before {
    transform: scale(1.2);
}

.social-icon i {
    font-size: 1.2rem;
    position: relative;
    z-index: 1;
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

/* Responsive media queries - optimized and grouped */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        gap: 2rem;
    }
    
    .footer-section {
        width: 100%;
    }
    
    .social-icons {
        justify-content: center;
    }
    
    #videos {
        min-height: 50vh;
        height: 50vh;
    }
    
    .section h2 {
        font-size: 2rem;
    }

    main p {
        font-size: 1rem;
    }

    .banner-img {
        max-width: 300px;
    }

    .section {
        border-radius: 10px;
        margin: 10px auto;
    }

    .floating-ingredient {
        width: 186px;
        margin: -70px;
    }
}

/* Combine media queries for better performance */
@media (max-width: 767.98px) {
    .floating-ingredient:nth-child(1) {
        bottom: 40% !important;
        left: 0;
        transform: translateY(50px);
    }

    .floating-ingredient:nth-child(2) {
        bottom: 40% !important;
        right: 0;
        transform: translateY(50px);
    }

    .floating-ingredient:nth-child(3) {
        top: 15% !important;
        left: 0;
        transform: translateY(-50px);
    }

    .floating-ingredient:nth-child(4) {
        top: 15% !important;
        right: 0;
        transform: translateY(-50px);
    }
}

@media (max-width: 575.98px) {
    .banner-img {
        width: 380px !important;
        margin-top: 350px;
    }

    .product-img {
        height: 280px;
        object-fit: cover;
    }
    
    .floating-ingredient {
        max-width: 200px;
    }
}

/* Ultra-small screens */
@media (max-width: 319.98px) {
    .banner-img {
        max-width: 200px;
    }
    
    .floating-ingredient {
        max-width: 220px;
    }
}

/* Floating ingredient styles */
.floating-ingredient {
    position: absolute;
    opacity: 0;
    z-index: 1;
    will-change: transform, opacity;
    transition: transform 0.5s ease-out, opacity 0.5s ease-out;
    width: 186px;
}

/* Add specific style for the videos section */
#videos {
    min-height: 80vh;
    display: flex;
    align-items: center;
}

/* Add print styles to save ink */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .section {
        box-shadow: none !important;
        background: white !important;
        margin: 0 !important;
        padding: 1em 0 !important;
        min-height: auto !important;
    }
    
    .header, .footer, .social-icons, .banner-container {
        display: none !important;
    }
}

/* Make the site more accessible */
a:focus, button:focus, input:focus, textarea:focus {
    outline: 2px solid var(--primary-green) !important;
    outline-offset: 2px !important;
}

/* Hide elements without using display:none which can be problematic for accessibility */
.hidden-accessible {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Fix for sidebar visibility */
.hamburger-menu {
    display: none;
    cursor: pointer;
    padding: 10px;
    z-index: 9999999 !important;
}

.hamburger-menu span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--navy);
    margin: 5px 0;
    transition: 0.3s;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 300px;
    height: 100vh;
    background-color: var(--cream);
    box-shadow: 5px 0 15px var(--shadow);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    z-index: 9999999;
    padding: 20px;
    overflow-y: auto;
    transform: translateX(-100%);
    opacity: 0;
}

.sidebar.active {
    transform: translateX(0);
    opacity: 1;
    display: block !important;
}

.sidebar .nav-link {
    display: block;
    padding: 15px 0;
    margin: 10px 0;
    border-bottom: 1px solid var(--light-brown);
    text-align: right;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999998;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 767.98px) {
    .hamburger-menu {
        display: block;
    }
}
