:root {
    --primary-bg: #1B4332; /* اللون الأخضر الغامق الخلفية */
    --card-bg: #2d5a45;    /* لون خلفية الأيقونات */
    --text-white: #ffffff;
    --accent-green: #3a6d56;
    --light-green-btn: #4CAF50; /* For action button */
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Tajawal', sans-serif;
    background-color: var(--primary-bg);
    color: var(--text-white);
    overflow-x: hidden; /* Prevent horizontal scroll from layout shifts */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Utility classes */
.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--primary-bg); /* Ensure header has a background when sticky */
}

.header-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-white);
    flex-grow: 1;
    text-align: center;
    margin: 0 10px; /* Add some margin to not stick to icons */
}

/* Categories Section (Scrollable) */
.categories-wrapper {
    overflow-x: auto; /* Enable horizontal scrolling */
    -webkit-overflow-scrolling: touch; /* For smoother scrolling on iOS */
    padding: 10px 0;
    margin-bottom: 10px;
    scrollbar-width: none; /* Hide scrollbar for Firefox */
}
.categories-wrapper::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Chrome, Safari, Opera */
}

.categories {
    display: flex;
    gap: 10px;
    padding: 0 15px; /* Add horizontal padding for cards */
}

.category-card {
    flex: 0 0 auto; /* Prevent cards from shrinking */
    width: 100px; /* Fixed width for each card */
    height: auto; /* Fixed height */
    background-color: transparent;
    border-radius: 0;
    padding: 0;
    text-align: center;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    color: var(--text-white);
    cursor: pointer;
    transition: transform 0.2s ease;
}
.category-card:hover {
    background-color: transparent;
    transform: translateY(-5px);
}

.category-card img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 8px;
    filter: none; /* إظهار الألوان الأصلية للصورة */
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Hero Banner Slider */
.hero-banner-container {
    width: 95%;
    margin: 15px auto;
    position: relative;
    border-radius: 15px;
    overflow: hidden;
}

.hero-slider {
    display: flex;
    transition: transform 0.5s ease-in-out;
    width: 100%; /* Ensure slider takes full width */
}

.hero-slide {
    min-width: 100%; /* Each slide takes full container width */
    box-sizing: border-box;
}

.hero-slide img {
    width: 100%;
    height: auto;
    aspect-ratio: 16/9; /* نسبة عرض إلى ارتفاع متجاوبة */
    object-fit: cover;
    display: block;
}

.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.dot.active {
    background-color: var(--text-white);
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; /* Two columns */
    gap: 15px;
    padding: 0 15px 20px; /* Add padding to bottom */
}

.product-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    color: #333;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
}
.product-card:hover {
    transform: translateY(-3px);
}

.product-img {
    width: 100%;
    height: 120px; /* Adjusted height for products */
    object-fit: contain;
    background: #f8f8f8;
    padding: 10px 5px;
}

.product-info {
    background-color: #264d3b; /* Darker green for product footer */
    color: white;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* Align text to the right */
    line-height: 1.4;
}

.product-name {
    font-size: 0.9rem;
    font-weight: bold;
}
.product-price {
    font-size: 0.8rem;
    margin-top: 2px;
    opacity: 0.9;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px;
    font-size: 0.8rem;
    opacity: 0.7;
    background-color: var(--primary-bg); /* Ensure footer has background */
    margin-top: 30px;
}

/* 404 Error Page Styles */
#error-page {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    text-align: center;
    background-color: var(--primary-bg);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 2000;
}
#main-content {
    transition: opacity 0.3s ease;
}

/* Bottom Sheet Styles (لوحة الأقسام السفلية) */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.bottom-sheet-overlay.active {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 85vh;
    background-color: var(--card-bg);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    z-index: 2000;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.bottom-sheet.active {
    transform: translateY(0);
}

.sheet-header {
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--accent-green);
    flex-shrink: 0;
}

.sheet-header h3 {
    margin: 0;
    color: var(--text-white);
}

.sheet-content {
    padding: 20px;
    overflow-y: auto;
}

.sheet-categories-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.sheet-category-card {
    text-align: center;
    cursor: pointer;
    color: var(--text-white);
    font-size: 0.9rem;
}

.sheet-category-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 15px;
    margin-bottom: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* --- تنسيقات لوحة التحكم الجديدة (Admin Panel) --- */
.admin-dashboard {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    color: #333;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: #f1f3f5;
    padding: 5px;
    border-radius: 12px;
}

.admin-tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    font-weight: bold;
    color: #666;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

.admin-tab.active {
    background: white;
    color: var(--primary-bg);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.admin-section {
    animation: fadeIn 0.4s ease;
}

.item-list {
    margin-top: 20px;
    border: 1px solid #eee;
    border-radius: 12px;
    overflow: hidden;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    background: white;
    transition: background 0.2s;
}

.item-row:last-child {
    border-bottom: none;
}

.item-row:hover {
    background: #f8f9fa;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Product Modal Styles */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8); /* خلفية أغمق للتركيز */
    z-index: 9999; /* التأكد من ظهورها فوق كل العناصر */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
    backdrop-filter: blur(8px); /* تأثير ضبابي للخلفية */
}

.product-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.product-modal-content {
    background-color: var(--card-bg);
    color: var(--text-white);
    border-radius: 20px;
    width: 100%;
    max-width: 450px;
    max-height: 85vh; /* ارتفاع مناسب للشاشات */
    overflow: hidden; /* لإخفاء أي محتوى يتجاوز الحواف الدائرية، مهم للتصميم الجديد */
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* تأثير حركي ناعم */
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); /* ظل قوي للبروز */
    border: 1px solid rgba(255,255,255,0.1);
}

.product-modal-overlay.active .product-modal-content {
    transform: scale(1);
}

.product-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border: 1px solid rgba(255,255,255,0.2);
    cursor: pointer;
    transition: background-color 0.2s;
}
.product-modal-close:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.product-modal-img {
    width: 100%;
    height: 300px; /* صورة أكبر وأوضح */
    object-fit: cover;
    display: block; /* لإزالة أي مسافات إضافية أسفل الصورة */
    flex-shrink: 0;
}

.product-modal-info {
    padding: 25px;
    overflow-y: auto; /* جعل هذا الجزء فقط هو الذي يتم تمريره */
    flex-grow: 1; /* السماح له بأخذ المساحة المتبقية */
}

.product-modal-name { font-size: 1.8rem; margin: 0 0 15px 0; }
.product-modal-desc p { font-size: 0.95rem; line-height: 1.7; opacity: 0.9; margin: 0 0 20px 0; }
.product-modal-desc h4, .product-modal-sizes h4 { font-size: 1rem; color: var(--text-white); opacity: 0.8; margin-bottom: 10px; border-bottom: 1px solid var(--accent-green); padding-bottom: 5px; }
.product-modal-sizes ul { list-style: none; padding: 0; margin: 0; }
.product-modal-sizes li { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--accent-green); font-size: 1rem; }
.product-modal-sizes li:last-child { border-bottom: none; }
.product-modal-sizes .size-price { font-weight: bold; color: var(--text-white); }

.product-modal-price-main {
    font-size: 2rem;
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
    color: var(--text-white);
}

/* --- تحسينات للهواتف (Mobile Enhancements) --- */
@media (max-width: 500px) {
    .product-modal-overlay {
        /* في الهواتف، نجعل اللوحة تظهر من الأسفل لتجربة استخدام أفضل */
        align-items: flex-end;
        padding: 0; /* إزالة الهوامش لتتمدد اللوحة على كامل العرض */
    }

    .product-modal-content {
        /* تعديل التصميم ليناسب الظهور من الأسفل */
        max-width: 100%; /* عرض كامل */
        max-height: 90vh; /* السماح بارتفاع أكبر */
        border-radius: 25px 25px 0 0; /* حواف دائرية علوية فقط */
        
        /* تغيير حركة الظهور لتكون انزلاق من الأسفل */
        transform: translateY(100%);
        transition: transform 0.35s ease-out;
    }

    .product-modal-overlay.active .product-modal-content {
        /* إظهار اللوحة عند تفعيلها */
        transform: translateY(0);
    }

    .product-modal-img {
        height: 240px; /* تعديل ارتفاع الصورة لتناسب شاشات الهواتف */
    }

    .product-modal-name {
        font-size: 1.6rem; /* تصغير حجم العنوان قليلاً */
    }
}