:root {
    /* Dark Mode Palette */
    --primary-yellow: #FFD700;
    --primary-red: #FF4500;
    --bg-dark: #121212;
    --bg-card: #1E1E1E;
    --text-light: #E0E0E0;
    --text-muted: #A0A0A0;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.5);

    /* Fonts */
    --font-main: 'Cairo', 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
    direction: rtl;
    /* Default Arabic */
}

h1,
h2,
h3 {
    font-family: var(--font-main);
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.container {
    width: 95%;
    /* Increased for better mobile real estate */
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 700;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    font-family: var(--font-main);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 15px var(--primary-red);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-red), #ff6b6b);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.9rem;
    background-color: var(--primary-yellow);
    color: #000;
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid var(--primary-yellow);
    color: var(--primary-yellow);
}

.btn-secondary:hover {
    background-color: var(--primary-yellow);
    color: #000;
}

/* Splash Screen */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease;
    animation: hideSplash 1s ease 3.5s forwards;
    /* Failsafe: Hide after 3.5s */
    pointer-events: none;
    /* Ensure clicks pass through if opacity is 0 */
}

@keyframes hideSplash {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

.splash-content {
    text-align: center;
    animation: float 3s ease-in-out infinite;
}

/* Navbar */
.navbar {
    backdrop-filter: blur(15px);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--primary-yellow);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-links a {
    font-weight: 600;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: var(--primary-yellow);
}

.cart-icon {
    position: relative;
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.cart-icon:hover {
    transform: scale(1.1);
}

#cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-red);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    font-weight: bold;
}

/* Language Toggle */
#lang-toggle {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-light);
    padding: 5px 10px;
    border-radius: 15px;
    cursor: pointer;
    margin-left: 15px;
    /* Adjust based on RTL/LTR */
    font-family: var(--font-main);
}

/* Hero Section */
.hero-section {
    padding: 140px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    /* Fluid typography */
    margin-bottom: 20px;
    color: var(--white);
    line-height: 1.2;
}

.emoji-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Sections */
.section {
    padding: 60px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    /* Fluid typography */
    color: var(--primary-yellow);
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 4px;
    background: var(--primary-red);
    margin: 10px auto 0;
    border-radius: 2px;
}

/* Products */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 50px;
}

#search-bar {
    padding: 12px 25px;
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border: 1px solid #333;
    border-radius: 30px;
    color: white;
    font-family: var(--font-main);
    outline: none;
    transition: border-color 0.3s;
}

#search-bar:focus {
    border-color: var(--primary-yellow);
}

.categories {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-btn {
    padding: 8px 20px;
    border: 1px solid #333;
    background: var(--bg-card);
    color: var(--text-muted);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: var(--font-main);
}

.filter-btn.active,
.filter-btn:hover {
    background: var(--primary-yellow);
    color: #000;
    border-color: var(--primary-yellow);
}

.product-grid {
    display: grid;
    /* Responsive Grid breaks: 
       L: 4-5 col, 
       M: 3 col, 
       S: 2 col, 
       XS: 1 col (Wider) 
    */
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 25px;
}

.product-card {
    background: rgba(30, 30, 30, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 15px;
    /* Reduced for larger image area */
    text-align: center;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-10px);
    border-color: var(--primary-yellow);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.15);
}

.show-more-container {
    display: flex;
    justify-content: center;
    margin-top: 40px;
}

.product-title {
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.product-img-wrapper {
    width: 100%;
    aspect-ratio: 1 / 1;
    /* Force square for consistency */
    background: radial-gradient(circle, #2a2a2a 0%, #1a1a1a 100%);
    border-radius: 18px;
    margin-bottom: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    font-size: 3.5rem;
}

.product-img-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 50%);
    pointer-events: none;
}

.admin-thumb-frame {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    background: #1a1a1a;
    padding: 5px;
    display: block;
}

.product-img {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 10px;
    transition: transform 0.3s ease;
}

.product-card:hover .product-img-wrapper img {
    transform: scale(1.1);
}

.product-price {
    color: var(--primary-yellow);
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.old-price {
    text-decoration: line-through;
    color: #888;
    font-size: 0.9rem;
    margin-right: 8px;
    font-weight: 400;
}

.offer-badge {
    position: absolute;
    top: 15px;
    left: 15px;
    background: var(--primary-red);
    color: white;
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 800;
    z-index: 5;
    box-shadow: 0 4px 15px rgba(255, 69, 0, 0.4);
    animation: badge-pulse 2s infinite;
}

@keyframes badge-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
    }
}

/* Services */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
}

.service-card:hover {
    transform: translateY(-5px);
}

.service-card h3 {
    color: var(--primary-yellow);
    margin-bottom: 15px;
}

/* Footer */
footer {
    background: #000;
    color: var(--text-muted);
    padding: 60px 0 30px;
    text-align: center;
    border-top: 1px solid #333;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 25px;
    width: 90%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #333;
    color: var(--text-light);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 25px;
    /* Adjust for RTL */
    font-size: 1.8rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: var(--primary-red);
}

/* Cart Items */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #333;
}

.cart-total {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 30px 0;
    text-align: right;
    /* Adjust for RTL */
    color: var(--primary-yellow);
}

#checkout-form input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    background: #121212;
    border: 1px solid #333;
    border-radius: 10px;
    color: white;
    font-family: var(--font-main);
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.animate-fade-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeUp 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.delay-1 {
    animation-delay: 0.2s;
}

.delay-2 {
    animation-delay: 0.4s;
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Slider */
.slider-container {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 20px;
    -webkit-overflow-scrolling: touch;
}

.slider-track {
    display: flex;
    gap: 20px;
    padding: 0 10px;
}

.offer-card {
    min-width: 300px;
    padding: 20px 30px;
    background: var(--bg-card);
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.offer-card:hover {
    transform: scale(1.05);
}

/* Splash Screen Brand Name */
.brand-name {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-light);
    text-align: center;
    line-height: 1.4;
}

.brand-name span {
    display: inline-block;
}

.highlight-yellow {
    color: var(--primary-yellow);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.stars {
    font-size: 2rem;
    margin-top: 20px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Scroll Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.animate-on-scroll.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Social Icons */
.social-icons {
    display: flex;
    gap: 15px;
    justify-content: center;
    /* Center icons */
    margin-top: 10px;
}

.social-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
    padding: 12px;
}

.social-icon svg {
    fill: var(--text-light);
    width: 100%;
    height: 100%;
    transition: fill 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-5px);
    background: white;
}

.social-icon.whatsapp:hover svg {
    fill: #25D366;
}

.social-icon.whatsapp:hover {
    box-shadow: 0 0 20px rgba(37, 211, 102, 0.5);
}

.social-icon.facebook:hover svg {
    fill: #1877F2;
}

.social-icon.facebook:hover {
    box-shadow: 0 0 20px rgba(24, 119, 242, 0.5);
}

/* Responsive */
/* Responsive Breaking Points */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-direction: column;
        gap: 15px;
        padding-bottom: 5px;
    }

    .nav-links {
        display: flex;
        gap: 12px;
        font-size: 0.85rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero-section {
        padding-top: 140px;
        padding-bottom: 40px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .product-card {
        padding: 10px;
    }

    .product-img-wrapper {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 columns on mobile */
        gap: 5px;
        /* Tighter gap for small screens */
    }

    .product-card {
        padding: 5px;
        /* Minimal padding */
        border-radius: 8px;
    }

    .product-title {
        font-size: 0.75rem;
        /* Small font for 3 cols */
        height: 2.2em;
        overflow: hidden;
        margin-bottom: 5px;
    }

    .product-price {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }

    .product-img-wrapper {
        font-size: 1.8rem;
        margin-bottom: 5px;
        padding: 5px;
    }

    .btn-small {
        padding: 3px 6px;
        font-size: 0.7rem;
        border-radius: 4px;
    }

    .logo {
        font-size: 1rem;
    }
}

@media (max-width: 768px) {
    .brand-name {
        font-size: 2rem;
    }

    .slider-track {
        gap: 10px;
    }

    .offer-card {
        min-width: 220px;
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    /* Force visibility on mobile to fix scroll issue */
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* All Categories Section */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    /* Responsive Grid */
    gap: 15px;
    margin-top: 30px;
    margin-bottom: 20px;
}

.category-card {
    background: #222;
    border: 1px solid #333;
    border-radius: 15px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 140px;
    /* Fixed height for consistency */
}

.category-card:hover {
    transform: translateY(-5px);
    background: #333;
    border-color: var(--primary-yellow);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.category-card .cat-icon {
    font-size: 3rem;
    margin-bottom: 5px;
}

.category-card .cat-name {
    color: #eee;
    font-weight: 600;
    font-size: 1rem;
}

/* Mobile Adjustments for Categories */
@media (max-width: 600px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns on mobile */
        gap: 10px;
    }

    .category-card {
        height: 120px;
        padding: 15px 5px;
    }

    .category-card .cat-icon {
        font-size: 2.5rem;
    }

    .category-card .cat-name {
        font-size: 0.9rem;
    }
}