/**
 * Main Stylesheet
 * Classic Light Theme (White and Black) with RTL Support
 * Arabic E-commerce Website - Optimized for Mobile Clarity
 * FOOTER FIXED: Corrected to appear at the bottom of the page content.
 * ANIMATION ADDITIONS: Added simple and elegant animations for small and large screens.
 */
@media (max-width: 768px) {
    .site-header {
        height: 48px; /* الارتفاع المحدد */
        /* ... */
    }
    /* ... */
}
/* -------------------------------------------------- */
        /* CSS تعويض ارتفاع الهيدر في محتوى الصفحة الرئيسي */
        /* -------------------------------------------------- */
        .main-content {
            /* تعويض ارتفاع الهيدر على شاشات سطح المكتب */
            /* استخدم قيمة تقديرية (60px) بناءً على تصميمك */
            padding-top: 60px; 
            min-height: 100vh; /* لضمان أن الصفحة تملأ الشاشة */
        }

        @media (max-width: 768px) {
            .main-content {
                /* تعويض ارتفاع الهيدر على شاشات الموبايل */
                /* نفس القيمة المحددة للهيدر (48px) */
                padding-top: 48px; 
            }
        }
/* ===== CSS Variables (UPDATED FOR LIGHT THEME) ===== */
:root {
    --primary-color: #000000; /* Primary Dark Text/Accent (Black) */
    --secondary-color: #333333; /* Secondary Text/Darker Text */
    --dark-accent: #e8e8e8; /* Light Accent (Light Grey) */
    --light-background: #ffffff; /* Primary Background (White) */
    --card-background: #f8f8f8; /* Card/Menu Background */
    --white: #ffffff; /* Used for background on dark elements */
    --text-primary: #000000; /* Primary Text Color */
    --text-secondary: #333333; /* Secondary Text Color */
    --border-color: #000000; /* Black Border */
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;

    --font-primary: 'Cairo', 'Arial', sans-serif;
    --transition: all 0.3s ease;
    --border-radius: 4px;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-accent: 0 4px 10px rgba(0, 0, 0, 0.15);
    /* 🌟 NEW: Animation variables */
    --hover-scale-small: scale(1.05); /* Small scale up on hover */
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background-color: var(--light-background);
    color: var(--text-primary);
    line-height: 1.6;
    direction: rtl;
    padding-top: 80px; /* Space for fixed header */
    padding-bottom: 50px; /* Space for mobile navigation (will be overridden on desktop) */
}

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

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-color);
    margin-bottom: 0.8rem;
    font-weight: 700;
}

h1 { font-size: 2.2rem; }
h2 { font-size: 1.8rem; }
h3 { font-size: 1.3rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition); /* 🌟 Existing transition maintained */
}

a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.gold-text {
    color: var(--primary-color);
    font-weight: 700;
}

/* ===== Header Styles ===== */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--light-background);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 0.75rem 0;
    transition: var(--transition); /* 🌟 Added: Smooth transition for header changes (e.g., scrolling effects) */
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.logo h1 { font-size: 1.3rem; margin: 0; color: var(--primary-color); }
.logo a { color: var(--primary-color); }
.logo a:hover { color: var(--secondary-color); }

/* Search Bar */
.search-container { flex: 1; max-width: 450px; position: relative; }
.search-form { display: flex; position: relative; width: 100%; }

.search-input {
    flex: 1; width: 100%; padding: 0.6rem 3rem 0.6rem 0.8rem;
    border: 1px solid var(--border-color); background: var(--light-background);
    color: var(--text-primary); border-radius: var(--border-radius);
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.search-input:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.search-btn {
    position: absolute; left: 0.5rem; top: 50%; transform: translateY(-50%);
    background: transparent; border: none; cursor: pointer; padding: 0.3rem;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: var(--transition);
}

.search-btn:hover { 
    background: var(--dark-accent); 
    transform: translateY(-50%) var(--hover-scale-small); /* 🌟 Improved: Scale on hover */
}

.search-icon { font-size: 1rem; color: var(--primary-color); }

/* Cart Icon */
.cart-icon-container { position: relative; }

.cart-icon-link {
    display: flex; align-items: center; justify-content: center;
    width: 45px; height: 45px; background: var(--light-background);
    border: 1px solid var(--border-color); border-radius: 50%;
    transition: var(--transition);
}

.cart-icon-link:hover { 
    background: var(--dark-accent); 
    transform: var(--hover-scale-small); /* 🌟 Added: Scale up on hover */
}

.cart-icon { font-size: 1.3rem; color: var(--primary-color); }

.cart-badge {
    position: absolute; top: -5px; left: -5px; background: var(--danger);
    color: var(--white); border-radius: 50%; width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; font-weight: bold; animation: pulse 2s infinite; /* 🌟 Existing: Pulse animation for attention */
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* User Profile Container */
.user-profile-container { display: flex; align-items: center; }

/* WhatsApp Button */
.whatsapp-btn-container { margin-left: 1rem; }
.whatsapp-btn {
    display: flex; align-items: center; justify-content: center;
    width: 45px; height: 45px; background: #25d366; border-radius: 50%;
    transition: var(--transition); box-shadow: 0 2px 5px rgba(37, 211, 102, 0.3);
}
.whatsapp-btn:hover { transform: var(--hover-scale-small); } /* 🌟 Improved: Use variable for small scale */
.whatsapp-icon { font-size: 1.3rem; }

/* ===== Main Content (Adjusted padding to ensure footer is visible) ===== */
.main-content {
    min-height: calc(100vh - 80px); /* Adjusting minimal height */
    padding: 2rem 0;
}

/* ===== Product Grid ===== */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.product-card {
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: var(--shadow);
    /* 🌟 Added: Smooth appearance animation for new products */
    animation: fadeInUp 0.5s ease; 
}

.product-card:hover {
    transform: translateY(-5px); /* 🌟 Existing: Slight lift on hover */
    border-color: var(--primary-color);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

/* 🌟 Keyframe for smooth product entry */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-image { 
    width: 100%; height: 200px; object-fit: cover; background: var(--dark-accent);
    transition: var(--transition); /* 🌟 Added: Transition for image interaction */
}

.product-image:hover {
    transform: scale(1.02); /* 🌟 Added: Slight zoom on image hover */
}

.product-info { padding: 1rem; text-align: right; }
.product-name { font-size: 1rem; color: var(--text-primary); margin-bottom: 0.25rem; font-weight: 600; }
.product-description {
    color: var(--text-secondary); font-size: 0.85rem; margin-bottom: 0.6rem;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-price { font-size: 1.2rem; color: var(--primary-color); font-weight: bold; margin-bottom: 0.5rem; }
.product-stock { font-size: 0.75rem; margin-bottom: 0.6rem; }
.in-stock { color: var(--success); }
.out-of-stock { color: var(--danger); }

/* ===== Button Styles (Black/White Frame) ===== */
.btn {
    display: inline-block; padding: 0.7rem 1.4rem;
    border: 1px solid var(--border-color); /* Black Border (Frame) */
    border-radius: var(--border-radius);
    background: transparent; /* Empty inside */
    color: var(--primary-color); /* Black text */
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    cursor: pointer; transition: var(--transition); text-align: center; text-decoration: none;
}

.btn-primary { background: var(--primary-color); color: var(--white); width: 100%; }
.btn-primary:hover { 
    background: var(--secondary-color); 
    transform: translateY(-1px); /* 🌟 Improved: Simple 'jump' effect on hover */
    box-shadow: var(--shadow); 
}
.btn-primary:disabled {
    background: var(--dark-accent); color: var(--text-secondary);
    cursor: not-allowed; border-color: var(--dark-accent); transform: none;
}
.btn-secondary { background: transparent; color: var(--primary-color); border: 1px solid var(--primary-color); }
.btn-secondary:hover { background: var(--primary-color); color: var(--white); transform: translateY(-1px); } /* 🌟 Added: Simple 'jump' effect on hover */
.btn-danger { background: var(--danger); color: var(--white); border: 1px solid var(--danger); }
.btn-danger:hover { background: #d32f2f; transform: translateY(-1px); } /* 🌟 Added: Simple 'jump' effect on hover */

/* ===== Page Title ===== */
.page-title {
    text-align: center; margin-bottom: 2rem; padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

/* ===== Cart & Invoice Styles (Updated Colors) ===== */
.cart-table {
    width: 100%; border-collapse: collapse; margin: 2rem 0;
    background: var(--card-background); border-radius: var(--border-radius);
    overflow: hidden;
}
.cart-table th { background: var(--dark-accent); color: var(--text-primary); font-weight: 600; }
.cart-table th, .cart-table td { padding: 1rem; text-align: right; border-bottom: 1px solid var(--dark-accent); }
.cart-table tr:hover { 
    background: var(--dark-accent); 
    transform: scale(1.01); /* 🌟 Added: Very slight scale on row hover for cart/invoice */
    box-shadow: var(--shadow);
}

.cart-summary {
    background: var(--card-background); padding: 2rem;
    border-radius: var(--border-radius); border: 1px solid var(--border-color);
    margin-top: 2rem;
    transition: var(--transition); /* 🌟 Added: Transition for potential hover/active states */
}
.cart-total { font-size: 1.5rem; color: var(--primary-color); font-weight: bold; margin-bottom: 1rem; }
.quantity-input {
    width: 60px; padding: 0.5rem; text-align: center;
    border: 1px solid var(--border-color); background: var(--light-background);
    color: var(--text-primary); border-radius: var(--border-radius);
    transition: var(--transition); /* 🌟 Added: Transition for focus effect */
}

/* ===== Form Styles (Updated Colors) ===== */
.form-group { margin-bottom: 1.5rem; }
.form-label { display: block; margin-bottom: 0.5rem; color: var(--text-primary); font-weight: 600; }
.form-input, .form-textarea, .form-select {
    width: 100%; padding: 0.75rem; border: 1px solid var(--border-color);
    background: var(--light-background); color: var(--text-primary);
  font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 1rem; transition: var(--transition);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2); /* 🌟 Improved: Clearer focus shadow */
}
.form-textarea { resize: vertical; min-height: 100px; }

/* ===== Invoice Styles (White Paper Look) ===== */
.invoice-container {
    max-width: 800px; margin: 2rem auto; background: var(--white);
    color: var(--text-primary); padding: 2rem; border-radius: var(--border-radius);
    box-shadow: var(--shadow-accent);
    /* 🌟 Added: Initial fade-in for the invoice page */
    animation: fadeIn 0.8s ease-out; 
}

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

.invoice-header { text-align: center; border-bottom: 2px solid var(--primary-color); padding-bottom: 1rem; margin-bottom: 2rem; }
.invoice-details { margin-bottom: 2rem; }
.invoice-table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.invoice-table th, .invoice-table td {
    padding: 0.75rem; border: 1px solid var(--dark-accent);
    text-align: right; color: var(--text-primary);
}
.invoice-table th { background: var(--dark-accent); color: var(--text-primary); }

/* ===== Mobile Categories Navigation (Fixed Bottom) ===== */
.mobile-categories-nav {
    display: none; position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--light-background); border-top: 1px solid var(--border-color);
    padding: 0.5rem 0; z-index: 1000; box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
    /* 🌟 Added: Smooth slide-up appearance for mobile nav */
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0.5; }
    to { transform: translateY(0); opacity: 1; }
}

.mobile-categories-nav ul {
    list-style: none; display: flex; justify-content: space-around;
    align-items: center; margin: 0; padding: 0; overflow-x: auto;
    scrollbar-width: none; -ms-overflow-style: none;
}
.mobile-categories-nav ul::-webkit-scrollbar { display: none; }
.mobile-categories-nav li { flex: 0 0 auto; text-align: center; }

.mobile-categories-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.5rem; color: var(--text-secondary); text-decoration: none;
    transition: var(--transition); border-radius: var(--border-radius); min-width: 60px;
}

.mobile-categories-nav a:hover,
.mobile-categories-nav a.active {
    color: var(--primary-color); 
    background: var(--dark-accent);
    transform: translateY(-2px); /* 🌟 Added: Slight lift on active/hover */
}

.mobile-categories-nav .category-icon { font-size: 1.3rem; }
.mobile-categories-nav .category-name { font-size: 0.65rem; font-weight: 600; }

/* ===== Footer Styles (UNFIXED - At bottom of content) ===== */
.site-footer {
    /* REMOVED position: fixed; */
    bottom: 0; left: 0; right: 0;
    background: var(--light-background);
    border-top: 1px solid var(--border-color);
    padding: 2rem 0 1rem;
    z-index: 999;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Adjusted width for more compact look */
    gap: 2rem;
    margin-bottom: 1rem;
}

.footer-title { color: var(--primary-color); margin-bottom: 1rem; font-size: 1.1rem; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 0.5rem; }
.footer-links a { color: var(--text-secondary); transition: var(--transition); }
.footer-links a:hover { 
    color: var(--primary-color); 
    padding-right: 0.5rem; /* 🌟 Added: Subtle slide-in effect */
}

.social-links { display: flex; flex-direction: column; gap: 0.5rem; }
.social-link { color: var(--text-secondary); }
.social-link:hover { color: var(--primary-color); transform: var(--hover-scale-small); } /* 🌟 Added: Scale on social link hover */

.footer-bottom {
    text-align: center; padding-top: 1rem;
    border-top: 1px solid var(--dark-accent);
    color: var(--text-secondary); font-size: 0.85rem;
}

/* ===== Admin Styles (Updated Colors) ===== */
.admin-container { max-width: 1200px; margin: 2rem auto; }
.admin-nav {
    background: var(--card-background); padding: 1rem;
    border-radius: var(--border-radius); margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}
.admin-nav ul { list-style: none; display: flex; gap: 1rem; flex-wrap: wrap; }
.admin-nav a {
    padding: 0.5rem 1rem; background: var(--dark-accent);
    border-radius: var(--border-radius); transition: var(--transition);
}
.admin-nav a:hover { 
    background: var(--primary-color); 
    color: var(--white);
    transform: scale(1.05); /* 🌟 Added: Scale up on hover for admin links */
}

.alert { 
    padding: 1rem; border-radius: var(--border-radius); margin-bottom: 1rem; font-size: 0.95rem; 
    /* 🌟 Added: Slide in/fade in for alerts */
    animation: slideInFromTop 0.5s ease-out; 
}

@keyframes slideInFromTop {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert-success { background: rgba(76, 175, 80, 0.1); border: 1px solid var(--success); color: var(--success); }
.alert-error { background: rgba(244, 67, 54, 0.1); border: 1px solid var(--danger); color: var(--danger); }
.alert-info { background: rgba(33, 150, 243, 0.1); border: 1px solid #2196f3; color: #2196f3; }

/* ===== Responsive Design (SMALLER, CLEARER ELEMENTS) ===== */
@media (max-width: 1024px) {
    .container { padding: 0 15px; }
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
        padding-bottom: 60px; /* Space for mobile categories nav */
    }

    /* === Mobile Header Resizing === */
    .site-header { padding: 0.5rem 0; }
    .logo, .whatsapp-btn-container { display: none; }
    .header-content { gap: 0.5rem; flex-wrap: nowrap; }

    .search-input { padding: 0.5rem 2.5rem 0.5rem 0.8rem; font-size: 0.85rem; }
    .search-btn { left: 0.4rem; width: 24px; height: 24px; }
    .search-btn:hover { transform: translateY(-50%) scale(1.1); } /* 🌟 Override scale on mobile search button */
    .cart-icon-link { width: 38px; height: 38px; border-radius: 4px; }
    .cart-icon-link:hover { transform: scale(1.05); } /* 🌟 Override scale on mobile cart icon */
    .cart-icon { font-size: 1.1rem; }
    .cart-badge { width: 18px; height: 18px; font-size: 0.65rem; top: -4px; left: -4px; }
    .user-profile-container .btn { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
    .user-profile-container .user-name-text { display: none; }

    /* === Product Grid (FULL WIDTH AS REQUESTED) === */
    .products-grid {
        /* Makes each product take nearly full width (one column) */
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .product-image { height: 220px; }
    .product-name { font-size: 1.1rem; }
    .product-price { font-size: 1.3rem; }
    .product-card .btn { padding: 0.5rem 1rem; font-size: 0.9rem; }
    .product-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); } /* 🌟 Reduced lift effect on mobile */

    /* === Typography === */
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
    h3 { font-size: 1.1rem; }

    /* === Footer/Navigation Toggles === */
    .site-footer { display: none; } /* Hide footer on mobile */
    .mobile-categories-nav { display: block; } /* Show mobile nav */

    /* === Tables (Stacked) === */
    .cart-table th:nth-child(5), .cart-table td:nth-child(5) { display: none; }
    .cart-table thead { display: none; }
    .cart-table tr {
        display: block; margin-bottom: 1rem;
        border: 1px solid var(--border-color); background: var(--card-background);
        padding: 0.8rem;
    }
    .cart-table td {
        display: block; padding: 0.4rem 0; border: none;
        border-bottom: 1px solid var(--dark-accent); text-align: right !important;
        position: relative; padding-right: 35%;
    }
    .cart-table td:before {
        content: attr(data-label); position: absolute; right: 0;
        font-weight: 600; min-width: 100px; color: var(--secondary-color);
        font-size: 0.85rem;
    }

    /* === Grid Overrides === */
    .form-grid-2, .product-detail-grid, .checkout-grid, .order-info-grid {
        grid-template-columns: 1fr !important;
    }
    .invoice-container { margin: 1rem; padding: 1.5rem; }

    .footer-content { grid-template-columns: 1fr; gap: 1.5rem; }
    .admin-nav ul { flex-direction: column; gap: 0.5rem; }
    .admin-nav a { width: 100%; text-align: center; }
}

@media (max-width: 480px) {
    .container { padding: 0 10px; }
    .product-image { height: 180px; }
    .product-name { font-size: 1rem; }
    .product-price { font-size: 1.2rem; }

    .search-input { font-size: 0.8rem; padding: 0.4rem 2rem 0.4rem 0.6rem; }
    .search-btn { width: 20px; height: 20px; left: 0.3rem; }
    .search-icon { font-size: 0.8rem; }

    .cart-icon-link { width: 35px; height: 35px; }
    .cart-icon { font-size: 1rem; }

    .user-profile-container .btn { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
    .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
    .page-title { font-size: 1.5rem; padding: 0.5rem 0; }
}

/* Extra small devices */
@media (max-width: 360px) {
    .container { padding: 0 10px; }
    .search-input { padding: 0.5rem 2rem 0.5rem 0.6rem; font-size: 0.85rem; }
    .product-image { height: 130px; }
}

/* ===== Additional Layouts (No Animation Changes) ===== */
.product-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; margin-top: 2rem; }
.checkout-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 2rem; margin-top: 2rem; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.order-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-bottom: 2rem; }

/* ===== Loading Animation (Existing spin, but now defined globally) ===== */
.loading {
    display: inline-block; width: 20px; height: 20px;
    border: 3px solid var(--dark-accent); border-top-color: var(--primary-color);
    border-radius: 50%; animation: spin 1s linear infinite;
}

/* 🌟 Keyframe for loading spin */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Empty State (Added subtle animation) ===== */
.empty-state {
    text-align: center; padding: 3rem;
    color: var(--text-secondary);
    /* 🌟 Added: Subtle bounce/pop-in effect for empty states */
    animation: popIn 0.5s ease-out;
}
.empty-state-icon { font-size: 4rem; margin-bottom: 1rem; }

@keyframes popIn {
    0% { opacity: 0; transform: scale(0.9); }
    80% { opacity: 1; transform: scale(1.02); }
    100% { transform: scale(1); }
}