:root { --miami-black: #1a1a1a; --miami-green: #8cbd42; --bg-gray: #f4f5f7; --white: #ffffff; --text: #333; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Tajawal', sans-serif; }
body { background-color: var(--bg-gray); color: var(--text); padding-bottom: 80px; }

/* Header & Basics */
.miami-header { width: 100%; background-color: var(--white); position: sticky; top: 0; z-index: 1000; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.top-bar { background-color: var(--miami-black); color: #ccc; font-size: 0.8rem; padding: 8px 0; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.top-bar-content { display: flex; justify-content: space-between; }
.top-links a { color: #eee; text-decoration: none; margin-left: 15px; }
.main-bar { background-color: var(--miami-black); padding: 15px 0; border-top: 1px solid #333; }
.main-bar-content { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.miami-logo { max-height: 45px; filter: brightness(0) invert(1); }
.search-section-miami { flex: 1; max-width: 600px; position: relative; display: flex; }
.search-section-miami input { width: 100%; padding: 12px 20px 12px 50px; border-radius: 50px; border: none; outline: none; }
.search-section-miami button { position: absolute; left: 5px; top: 5px; background: var(--miami-black); color: white; border: none; width: 35px; height: 35px; border-radius: 50%; }
.icons-section { display: flex; gap: 25px; color: white; }
.icon-item { display: flex; flex-direction: column; align-items: center; position: relative; cursor: pointer; }
#cartCount { position: absolute; top: -8px; right: -8px; background: var(--miami-green); width: 18px; height: 18px; border-radius: 50%; display: flex; justify-content: center; align-items: center; font-size: 0.7rem; color: white; }

.hero-banner { background: white; padding: 20px 0; text-align: center; border-bottom: 1px solid #eee; }
.hero-banner h2 { color: var(--miami-black); }

/* Sticky Category Bar */
.category-sticky-bar { background: white; padding: 15px 0; margin-bottom: 20px; border-bottom: 1px solid #eee; box-shadow: 0 2px 10px rgba(0,0,0,0.05); position: sticky; top: 76px; z-index: 900; }
.category-scroll-container { display: flex; justify-content: center; gap: 30px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.category-scroll-container::-webkit-scrollbar { display: none; }
.cat-item { display: flex; flex-direction: column; align-items: center; cursor: pointer; min-width: 80px; transition: 0.3s; opacity: 0.7; }
.cat-item:hover { opacity: 1; transform: translateY(-3px); }
.cat-item.active { opacity: 1; font-weight: bold; color: var(--miami-black); }
.cat-icon { width: 60px; height: 60px; background: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid #eee; margin-bottom: 8px; transition: 0.3s; overflow: hidden; padding: 5px; }
.cat-item.active .cat-icon { border-color: var(--miami-green); border-width: 2px; box-shadow: 0 0 10px rgba(140, 189, 66, 0.2); }
.cat-icon img { width: 100%; height: 100%; object-fit: contain; }

/* Layout & Filter Sidebar */
.main-layout-advanced { display: flex; gap: 20px; align-items: flex-start; }

.right-sidebar { 
    width: 260px; 
    background: white; 
    padding: 20px; 
    border-radius: 15px; 
    border: 1px solid #eee; 
    position: sticky; 
    top: 200px; 
    flex-shrink: 0;
    transition: 0.3s;
}

.filter-box { margin-bottom: 25px; }
.filter-box h4 { font-size: 1rem; margin-bottom: 15px; color: var(--miami-black); border-bottom: 1px solid #f0f0f0; padding-bottom: 8px; }
.filter-label { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; cursor: pointer; color: #555; font-size: 0.9rem; transition: 0.2s; }
.filter-label:hover { color: var(--miami-green); }
.filter-label input[type="checkbox"] { accent-color: var(--miami-green); width: 16px; height: 16px; cursor: pointer; }

/* إخفاء عناصر الموبايل في الكمبيوتر */
.mobile-filter-btn-container { display: none; }
.mobile-sidebar-header { display: none; }
.sidebar-overlay { display: none; }
.apply-filter-btn-mobile { display: none; }

/* المنتجات */
.products-grid { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 15px; }
.product-card { background: #fff; border-radius: 20px; padding: 15px; position: relative; text-align: right; box-shadow: 0 2px 10px rgba(0,0,0,0.05); transition: 0.3s; cursor: pointer; }
.product-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.1); }
.p-img { width: 100%; height: 180px; object-fit: contain; margin-bottom: 15px; }
.p-title { font-size: 0.95rem; font-weight: 700; height: 40px; overflow: hidden; margin-bottom: 5px; }
.p-price { font-size: 1.2rem; font-weight: 900; color: var(--miami-black); }
.discount-badge { position: absolute; top: 15px; left: 15px; background: var(--miami-black); color: white; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 0.8rem; }

/* باقي العناصر */
.product-details-page { max-width: 1200px; margin: 20px auto; padding: 20px; }
.details-layout { display: flex; gap: 40px; background: white; padding: 30px; border-radius: 20px; }
.details-img-box img { max-width: 100%; max-height: 400px; object-fit: contain; }
.details-info-box { flex: 1; }
.specs-section { background: white; padding: 30px; border-radius: 20px; margin-top: 30px; }
.specs-table { width: 100%; border-collapse: collapse; }
.specs-table th, .specs-table td { padding: 15px; text-align: right; border-bottom: 1px solid #f0f0f0; }
.specs-table th { width: 30%; background-color: #f9f9f9; }

/* Modal */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 2000; justify-content: center; align-items: center; }
.modal-content { background: white; width: 95%; max-width: 450px; padding: 25px; border-radius: 20px; max-height: 90vh; overflow-y: auto; }
.close-modal { float: left; font-size: 1.5rem; cursor: pointer; }
.checkout-btn { width: 100%; background: #25D366; color: white; border: none; padding: 15px; border-radius: 50px; margin-top: 15px; font-weight: bold; cursor: pointer; }
.add-cart-btn-large { width: 100%; padding: 15px; background: var(--miami-green); color: white; border: none; border-radius: 50px; cursor: pointer; margin-top: 10px; }
.m-btn { padding: 10px; border: 1px solid #ddd; background: white; flex: 1; cursor: pointer; }
.m-btn.active { background: var(--miami-black); color: white; }
.months-selector { display: flex; gap: 10px; margin: 15px 0; }
.embedded-calc { background: #f0f8ff; padding: 20px; border-radius: 15px; margin-top: 20px; }
.calc-input { width: 100%; padding: 10px; margin-bottom: 10px; text-align: center; }
.user-form input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ddd; }
.bottom-nav { display: none; }

/* 📱📱📱 تحسينات الموبايل (Filter Bottom Sheet) 📱📱📱 */
@media (max-width: 768px) {
    .top-bar, .top-links, .icon-label { display: none; }
    .miami-header { padding-bottom: 5px; }
    .main-bar-content { flex-wrap: nowrap; gap: 10px; padding-top: 5px; }
    .logo-section { width: 40px; overflow: hidden; }
    .search-section-miami { width: 100%; margin: 0; order: 2; }
    .icons-section { display: none; }
    .category-sticky-bar { top: 60px; padding: 10px 0; margin-bottom: 15px; }
    .category-scroll-container { justify-content: flex-start; padding: 0 10px; }
    .main-layout-advanced { flex-direction: column; }
    .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 0 10px; }
    .product-card { padding: 10px; }
    .p-img { height: 130px; }
    .p-title { font-size: 0.9rem; }

    /* إظهار زر الفلتر في الموبايل */
    .mobile-filter-btn-container { display: block; padding: 0 10px; margin-bottom: 10px; }
    .mobile-filter-btn {
        width: 100%;
        padding: 10px;
        background: white;
        border: 1px solid #ddd;
        border-radius: 8px;
        font-weight: bold;
        color: #555;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    /* تحويل السايد بار لقائمة منزلقة (Bottom Sheet) */
    .right-sidebar {
        position: fixed;
        bottom: -100%; /* مخفي تحت */
        left: 0;
        width: 100%;
        top: auto;
        height: 70vh; /* يغطي 70% من الشاشة */
        border-radius: 20px 20px 0 0;
        z-index: 3000;
        box-shadow: 0 -5px 50px rgba(0,0,0,0.2);
        padding-bottom: 80px;
        overflow-y: auto;
    }
    
    .right-sidebar.active { bottom: 0; } /* لما يفتح */

    .mobile-sidebar-header {
        display: flex; justify-content: space-between; align-items: center;
        border-bottom: 1px solid #eee; padding-bottom: 15px; margin-bottom: 20px;
    }
    .mobile-sidebar-header span { font-size: 2rem; cursor: pointer; color: #999; line-height: 20px; }

    /* زر تطبيق الفلاتر */
    .apply-filter-btn-mobile {
        display: block;
        width: 100%;
        background: var(--miami-green);
        color: white;
        border: none;
        padding: 15px;
        border-radius: 50px;
        font-weight: bold;
        margin-top: 20px;
    }

    /* الخلفية المظلمة */
    .sidebar-overlay {
        position: fixed; top: 0; left: 0; width: 100%; height: 100%;
        background: rgba(0,0,0,0.5); z-index: 2500;
        display: none;
    }
    .sidebar-overlay.active { display: block; }

    .bottom-nav { display: flex; position: fixed; bottom: 0; left: 0; width: 100%; background: white; height: 60px; box-shadow: 0 -2px 10px rgba(0,0,0,0.05); z-index: 2000; justify-content: space-around; align-items: center; border-top: 1px solid #eee; }
    .nav-item { display: flex; flex-direction: column; align-items: center; color: #999; text-decoration: none; font-size: 0.75rem; width: 20%; }
    .nav-item i { font-size: 1.2rem; margin-bottom: 3px; }
    .nav-item.active { color: var(--miami-black); font-weight: bold; }
    .nav-cart-badge { position: relative; }
    .nav-cart-count { position: absolute; top: -5px; right: -5px; background: var(--miami-green); color: white; border-radius: 50%; padding: 2px 5px; font-size: 0.6rem; }

    .details-layout { flex-direction: column; padding: 15px; }
}