@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --primary-color: #e65100; /* Orange from logo */
    --secondary-color: #1a365d; /* Navy blue from logo */
    --accent-color: #e53e3e;
    --bg-main: #f7f7fa;
    --bg-white: #ffffff;
    --text-dark: #2d3748;
    --text-muted: #718096;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 16px rgba(0,0,0,0.08);
    --transition: all 0.2s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-dark);
    direction: rtl;
    text-align: right;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* ---------- Header ---------- */
.store-header {
    background-color: var(--secondary-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    color: #fff;
}

.top-bar {
    background-color: #112440;
    padding: 6px 5%;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #cbd5e0;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.top-bar a {
    color: #fff;
    font-weight: 600;
}
.top-bar a:hover { color: var(--primary-color); }

.main-header {
    padding: 12px 5%;
    display: flex;
    align-items: center;
    gap: 20px;
    background-color: var(--secondary-color);
}

.logo-container {
    display: flex;
    align-items: center;
}
.logo-container img {
    height: 38px;
}

.header-location {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    cursor: pointer;
    min-width: fit-content;
}
.location-text {
    display: flex;
    flex-direction: column;
    font-size: 12px;
}
.location-text .deliver-to {
    opacity: 0.8;
}
.location-text .city {
    font-weight: 700;
    font-size: 14px;
}

.search-form {
    flex-grow: 1;
    display: flex;
    position: relative;
    max-width: 900px;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}
.search-input {
    width: 100%;
    padding: 10px 45px 10px 15px;
    border: none;
    font-size: 14px;
    outline: none;
    color: var(--text-dark);
}
.search-btn {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 40px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
    font-weight: 700;
    color: #fff;
}
.action-link {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #fff;
    white-space: nowrap;
}
.action-link:hover { color: var(--primary-color); }
.action-link i { font-size: 18px; }
.action-text { font-weight: 700; }
.lang-link { font-weight: 800; font-family: sans-serif; }

.divider {
    width: 1px;
    height: 20px;
    background-color: rgba(255,255,255,0.2);
}

.cart-btn {
    position: relative;
}
.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    background-color: var(--primary-color);
    color: #fff;
    font-size: 11px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.category-nav {
    background-color: var(--bg-white);
    padding: 0 5%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.category-nav ul {
    list-style: none;
    display: flex;
    gap: 30px;
    overflow-x: auto;
}
.category-nav li a {
    display: block;
    padding: 15px 0;
    font-weight: 700;
    font-size: 14px;
    color: var(--text-dark);
    border-bottom: 3px solid transparent;
}
.category-nav li a:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ---------- Hero Section ---------- */
.hero-wrapper {
    padding: 20px 5%;
}
.hero-banner {
    background-color: #1a202c; /* Dark elegant background */
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 300px;
    position: relative;
    box-shadow: var(--shadow-md);
}
.hero-content {
    padding: 40px;
    color: #fff;
    flex: 1;
    z-index: 2;
}
.hero-tag {
    background-color: var(--accent-color);
    color: #fff;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    display: inline-block;
    margin-bottom: 15px;
}
.hero-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 15px;
}
.hero-desc {
    font-size: 16px;
    color: #cbd5e0;
    margin-bottom: 25px;
    max-width: 400px;
}
.hero-btn {
    background-color: var(--bg-white);
    color: #1a202c;
    padding: 10px 24px;
    font-weight: 800;
    border-radius: 4px;
    display: inline-block;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.hero-image {
    width: 40%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05));
    position: relative;
}
.slider-container {
    overflow: hidden;
}
.slider-track {
    display: flex;
    width: 200%;
    height: 100%;
    animation: auto-slide 10s infinite ease-in-out;
}
.slide-img {
    width: 50%;
    height: 90%;
    margin-top: 5%;
    object-fit: contain;
}

@keyframes auto-slide {
    0%, 45% { transform: translateX(0); }
    50%, 95% { transform: translateX(50%); }
    100% { transform: translateX(0); }
}

/* ---------- Sections ---------- */
.section-container {
    padding: 0 5%;
    margin-bottom: 40px;
}
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.section-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-dark);
}

/* ---------- Category Grid ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}
.category-card {
    background-color: var(--bg-white);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}
.category-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}
.category-icon-wrapper {
    width: 70px;
    height: 70px;
    margin: 0 auto 10px;
    background-color: #f0f4f8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.category-icon-wrapper img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}
.category-card-name {
    font-weight: 700;
    font-size: 15px;
    color: var(--text-dark);
}

/* ---------- Product Grid / Slider ---------- */
.product-grid {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 20px; /* Space for scrollbar */
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.product-grid::-webkit-scrollbar {
    height: 8px;
}
.product-grid::-webkit-scrollbar-track {
    background: #f1f1f1; 
    border-radius: 4px;
}
.product-grid::-webkit-scrollbar-thumb {
    background: #cbd5e0; 
    border-radius: 4px;
}
.product-grid::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color); 
}
.product-card {
    flex: 0 0 calc(25% - 15px);
    min-width: 220px;
    scroll-snap-align: start;
    background-color: var(--bg-white);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    box-shadow: var(--shadow-hover);
}
.badge-discount {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--bg-white);
    color: var(--accent-color);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 800;
    z-index: 10;
}
.product-image-wrapper {
    height: 200px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #fff;
}
.product-image-wrapper img {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
}
.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-name {
    font-size: 14px;
    color: var(--text-dark);
    margin-bottom: 10px;
    height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-price-wrapper {
    margin-top: auto;
    margin-bottom: 15px;
}
.product-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-dark);
}
.product-price-old {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-right: 8px;
}
.add-to-cart-btn {
    width: 100%;
    background-color: var(--bg-white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}
.add-to-cart-btn:hover {
    background-color: var(--primary-color);
    color: var(--bg-white);
}
.add-to-cart-btn.btn-solid {
    background-color: var(--primary-color);
    color: var(--bg-white);
}

/* ---------- Product Details ---------- */
.product-detail-container {
    background-color: var(--bg-white);
    border-radius: 8px;
    padding: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    border: 1px solid var(--border-color);
}
.detail-gallery {
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
}
.detail-gallery img {
    max-height: 100%;
    object-fit: contain;
}
.detail-name {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 15px;
}
.detail-price-box {
    margin: 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
}
.detail-price {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-dark);
}
.detail-desc {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-muted);
    margin-bottom: 25px;
}
.qty-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    height: 40px;
}
.qty-btn {
    width: 40px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
}
.qty-input {
    width: 50px;
    height: 100%;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    font-weight: 700;
}

/* ---------- Cart & Checkout ---------- */
.cart-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}
.cart-items-wrapper, .cart-summary {
    background-color: var(--bg-white);
    border-radius: 8px;
    padding: 25px;
    border: 1px solid var(--border-color);
}
.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
}
.cart-item-img {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 5px;
}
.cart-summary .summary-title {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}
.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-weight: 600;
}
.summary-row.total {
    font-size: 20px;
    font-weight: 800;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}
.checkout-btn {
    display: block;
    width: 100%;
    text-align: center;
    background-color: var(--primary-color);
    color: var(--bg-white);
    padding: 15px;
    border-radius: 4px;
    font-weight: 800;
    font-size: 16px;
    margin-top: 20px;
    border: none;
    cursor: pointer;
}

/* ---------- Forms ---------- */
.form-group {
    margin-bottom: 15px;
}
.form-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
}
.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}
.form-control:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* ---------- Footer ---------- */
.store-footer {
    background-color: var(--bg-white);
    border-top: 1px solid var(--border-color);
    padding: 40px 5% 20px;
    margin-top: auto;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 30px;
}
.footer-col h4 {
    font-size: 16px;
    margin-bottom: 15px;
    font-weight: 800;
}
.footer-col ul {
    list-style: none;
}
.footer-col li {
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--text-muted);
}
.footer-bottom {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-muted);
}

/* Product Grid Wrap (used for Category and Wishlist pages) */
.product-grid-wrap {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.product-grid-wrap .product-card {
    flex: unset;
    min-width: unset;
    width: 100%;
}

@media (max-width: 1024px) {
    .product-grid-wrap {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

/* Mobile Menu Drawer */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 5px;
    align-items: center;
    justify-content: center;
}

.mobile-drawer {
    position: fixed;
    top: 0;
    right: -300px;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-white);
    color: var(--text-dark);
    z-index: 2000;
    box-shadow: -4px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.mobile-drawer.open {
    right: 0;
}

.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.drawer-header h3 {
    font-size: 18px;
    font-weight: 800;
    color: var(--secondary-color);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-dark);
    font-size: 22px;
    cursor: pointer;
}

.drawer-content {
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.drawer-content ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.drawer-content li {
    text-align: right;
}

.drawer-content li a, .drawer-content li button {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-dark);
    padding: 8px 0;
    width: 100%;
    text-align: right;
    border: none;
    background: none;
    cursor: pointer;
}

.drawer-content li a:hover, .drawer-content li button:hover {
    color: var(--primary-color);
}

.drawer-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 10px 0;
}

.drawer-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 800;
    margin-bottom: 5px;
    display: block;
}

/* Mobile */
@media (max-width: 768px) {
    .hidden-mobile {
        display: none !important;
    }
    
    .top-bar {
        flex-direction: column;
        gap: 6px;
        text-align: center;
        padding: 8px 15px;
    }
    
    .main-header {
        flex-wrap: wrap;
        padding: 12px 15px;
        gap: 12px 10px;
    }
    
    .mobile-menu-toggle {
        display: flex;
        order: 1;
    }
    
    .logo-container {
        order: 2;
        margin-left: auto;
    }
    
    .logo-container img {
        height: 32px;
    }
    
    .header-actions {
        order: 3;
        gap: 12px;
    }
    
    .search-form {
        order: 4;
        width: 100%;
        max-width: 100%;
        margin-top: 5px;
    }
    
    .category-nav {
        display: none;
    }
    
    .hero-banner {
        flex-direction: column;
        height: auto;
        text-align: center;
        padding: 30px 15px;
    }
    
    .hero-content {
        padding: 0;
        margin-bottom: 20px;
    }
    
    .hero-title {
        font-size: 24px;
    }
    
    .hero-desc {
        font-size: 14px;
        margin-bottom: 20px;
    }
    
    .hero-image {
        width: 100%;
        height: 150px;
    }
    
    .product-detail-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }
    
    .detail-gallery-wrapper {
        height: auto;
    }
    
    .main-image-container {
        height: 280px !important;
    }
    
    .cart-layout {
        grid-template-columns: 1fr;
    }
    
    /* Cart Item responsive styles */
    .cart-item {
        display: grid !important;
        grid-template-columns: 80px 1fr 40px;
        grid-template-rows: auto auto;
        gap: 10px 15px;
        padding: 15px 0;
        align-items: center;
    }
    
    .cart-item-img {
        grid-column: 1;
        grid-row: 1 / span 2;
        width: 80px;
        height: 80px;
    }
    
    .cart-item-details {
        grid-column: 2 / span 2;
        grid-row: 1;
    }
    
    .cart-item-qty {
        grid-column: 2;
        grid-row: 2;
    }
    
    .cart-item-remove {
        grid-column: 3;
        grid-row: 2;
        justify-self: end;
    }
    
    .product-grid-wrap {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}
