/* --- Variables & Global Styles --- */
:root {
    --bg-black: #000;
    --gold: #D4AF37;
    --gold-hover: #f4c842;
    --text-light: #f0f0f0;
    --border-color: #333;
}

* {
 max-width: 100%;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: var(--bg-black);
    color: var(--text-light);
    line-height: 1.6;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* --- Header --- */
.header {
    background: #111;
    padding: 1rem 0;
    border-bottom: 1px solid var(--gold);
    text-align: center;
}
.header .container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}
.logo-link {
    display: block;
}
.logo {
    height: 50px;
    width: auto;
}
.header h1 {
    color: var(--gold);
    font-size: 1.5rem;
    font-weight: 900;
}

/* --- Main Content & Controls --- */
.main-content {
    padding: 2rem 0;
    min-height: 60vh;
}
.controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
#search-input, #sort-select {
    width: 100%;
    padding: 0.8rem;
    background: #222;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    border-radius: 5px;
    font-size: 1rem;
}
#search-input::placeholder { color: #888; }

        /* --- Tabs --- */
        .tabs {
            display: flex;
            overflow-x: auto;
            gap: 0.5rem;
            margin-bottom: 2rem;
            border-bottom: 2px solid var(--border-color);
            padding-bottom: 0.5rem;
            scrollbar-width: thin;
            scrollbar-color: var(--gold) var(--bg-black);
        }
        .tabs::-webkit-scrollbar { height: 8px; }
        .tabs::-webkit-scrollbar-track { background: var(--bg-black); }
        .tabs::-webkit-scrollbar-thumb { background-color: var(--gold); border-radius: 4px; }

        .tab-button {
            background: transparent;
            border: none;
            color: #888;
            padding: 0.8rem 1.2rem;
            cursor: pointer;
            font-size: 1rem;
            font-family: 'Cairo', sans-serif;
            font-weight: 700;
            white-space: nowrap;
            transition: color 0.3s, border-bottom 0.3s;
            border-bottom: 3px solid transparent;
        }
        .tab-button.active {
            color: var(--gold);
            border-bottom-color: var(--gold);
        }
        /* --- نهاية الكود الذي قدمته --- */

        /* تنسيق حاوي المنتجات */
        .products-container {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
            gap: 20px;
        }

        /* تنسيق كل عنصر منتج */
        .product-item {
            background-color: #2a2a2a;
            padding: 20px;
            border-radius: 8px;
            border: 1px solid var(--border-color);
            text-align: center;
            transition: transform 0.3s, box-shadow 0.3s;
        }
        
        .product-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 5px 15px rgba(212, 175, 55, 0.2);
        }

        /* إخفاء العناصر التي لا تنتمي للفئة المحددة */
        .product-item.hide {
            display: none;
        }
/* --- Products Grid --- */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.5rem;
}
.product-card {
    background: #111;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative; /* Needed for positioning the badge */
}
.product-card:hover {
    transform: scale(1.03);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}
.product-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}
.product-card-body {
    padding: 1rem;
}
.product-card h3 {
    color: var(--gold);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}
.product-card p {
    font-size: 0.8rem;
    color: #bbb;
    margin-bottom: 0.8rem;
}
.product-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.product-price {
    font-weight: 700;
    color: var(--text-light);
}
.add-to-cart-btn {
    background: var(--gold);
    color: var(--bg-black);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 700;
    transition: background 0.3s;
}
.add-to-cart-btn:hover { background: var(--gold-hover); }

/* --- Discount Badge --- */
.discount-badge {
    position: absolute;
    top: 10px;
    left: 10px; /* Changed to left for RTL */
    background: #e74c3c;
    color: white;
    padding: 5px 10px;
    font-size: 0.8rem;
    font-weight: bold;
    border-radius: 5px;
    z-index: 1;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
.product-card .original-price {
    text-decoration: line-through;
    color: #888;
    font-size: 0.9rem;
    margin-left: 0.5rem;
}
.product-card .discount-price {
    color: var(--gold);
    font-weight: bold;
}

/* --- Floating Cart Button --- */
.floating-cart-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gold);
    color: var(--bg-black);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.3s, background 0.3s;
}
.floating-cart-btn:hover { background: var(--gold-hover); }
.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: red;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

/* --- Cart Sidebar --- */
.cart-sidebar {
    position: fixed;
    top: 0;
    left: -400px;
    width: 350px;
    height: 100%;
    background: #111;
    border-left: 1px solid var(--gold);
    box-shadow: -2px 0 10px rgba(0,0,0,0.5);
    transition: left 0.4s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}
.cart-sidebar.open { left: 0; }
.cart-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cart-header h2 { color: var(--gold); }
.close-cart-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 2rem;
    cursor: pointer;
}
.cart-items {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
}
.cart-item {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #222;
    padding-bottom: 1rem;
}
.cart-item img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
}
.cart-item-details {
    flex-grow: 1;
}
.cart-item-details h4 { color: var(--gold); font-size: 0.9rem; }
.cart-item-details p { color: #bbb; font-size: 0.8rem; }
.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.cart-item-actions input {
    width: 40px;
    text-align: center;
    background: #222;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    padding: 0.2rem;
}
.cart-item-actions button {
    background: #444;
    color: var(--text-light);
    border: none;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
}
.cart-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
}
.cart-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
}
.checkout-btn {
    width: 100%;
    background: var(--gold);
    color: var(--bg-black);
    border: none;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 5px;
    transition: background 0.3s;
}
.checkout-btn:hover { background: var(--gold-hover); }

/* --- Shipping Selector --- */
.shipping-selector {
    margin-bottom: 1rem;
}
.shipping-selector label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--gold);
    font-weight: 700;
}
.shipping-selector select {
    width: 100%;
    padding: 0.8rem;
    background: #222;
    border: 1px solid var(--border-color);
    color: var(--text-light);
    border-radius: 5px;
    font-size: 1rem;
}

/* --- Promo Banner --- */
.promo-banner {
    position: relative;
    width: 100%;
    background: #111;
    text-align: center;
    display: none; /* Hidden by default */
    animation: slideDown 0.5s ease-out;
}
.promo-banner img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
}
.close-banner-btn {
    position: absolute;
    top: 10px;
    left: 10px; /* RTL */
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    z-index: 1004;
}
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* --- Modal --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1002;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}
.modal-content {
    position: relative;
    background-color: #111;
    margin: 5% auto;
    padding: 0;
    border: 1px solid var(--gold);
    width: 90%;
    max-width: 600px;
    border-radius: 8px;
    animation: pop 0.4s;
    overflow: hidden;
}
.close-modal-btn {
    position: absolute;
    top: 15px;
    right: 25px;
    color: var(--text-light);
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1003;
}
.modal-slider {
    position: relative;
    width: 100%;
    height: 300px;
}
.modal-slider img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.slider-prev, .slider-next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -22px;
    color: white;
    font-weight: bold;
    font-size: 24px;
    transition: 0.6s ease;
    user-select: none;
    background-color: rgba(0,0,0,0.5);
}
.slider-next { right: 0; border-radius: 3px 0 0 3px; }
.slider-prev { left: 0; border-radius: 0 3px 3px 0; }
.modal-info {
    padding: 2rem;
}
.modal-info h2 { color: var(--gold); margin-bottom: 1rem; }
.modal-info p { margin-bottom: 1rem; }
.modal-info #modal-price { font-size: 1.5rem; font-weight: bold; color: var(--text-light); }
.modal-stock { color: #888; margin-bottom: 1.5rem; }
.modal-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    overflow: hidden;
}
.quantity-selector button {
    background: #222;
    border: none;
    color: var(--text-light);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1.2rem;
}
.quantity-selector input {
    width: 50px;
    text-align: center;
    border: none;
    background: #222;
    color: var(--text-light);
    padding: 0.5rem;
}
.modal-actions .add-to-cart-btn {
    flex-grow: 1;
    padding: 0.8rem;
    font-size: 1rem;
}

/* --- Footer --- */
.footer {
    background: #111;
    color: var(--gold);
    text-align: center;
    padding: 1.5rem 0;
    border-top: 1px solid var(--gold);
    margin-top: 3rem;
}
.footer a { color: var(--gold); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* --- Animations --- */
@keyframes pop {
    0% { transform: scale(0.8); opacity: 0; }
    80% { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}
.shake { animation: shake 0.5s; }

/* --- Responsive Design --- */
@media (min-width: 768px) {
    .controls { flex-direction: row; }
    #search-input { flex-grow: 1; }
    #sort-select { width: 250px; }
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .cart-sidebar { width: 400px; left: -400px; }
}

@media (min-width: 992px) {
    .products-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
}
/* --- NEW: Promo Banner --- */
.promo-banner {
    position: relative;
    width: 100%;
    background: #111;
    text-align: center;
    display: none; /* Hidden by default */
    animation: slideDown 0.5s ease-out;
}
.promo-banner img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
}
.close-banner-btn {
    position: absolute;
    top: 10px;
    left: 10px; /* RTL */
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    z-index: 1004;
}
@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}
