:root {
    --primary-color: #1a365d;
    --primary-light: #2c5282;
    --primary-dark: #0f1f3a;
    --secondary-color: #C5A880;
    --secondary-light: #d8c3a5;
    --secondary-dark: #9c8360;
    --text-color: #333333;
    --text-muted: #6c757d;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #eaeaea;
    --border-radius: 8px;
    --border-radius-lg: 16px;
    --transition: all 0.3s ease;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

body {
    font-family: 'Tajawal', sans-serif;
    color: var(--text-color);
    background-color: var(--bg-white);
    line-height: 1.6;
    overflow-x: hidden;
}

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

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

/* ── الشريط العلوي ── */
.top-bar {
    background-color: var(--primary-dark);
    color: var(--bg-light);
    font-size: 0.85rem;
    padding: 6px 0;
}
.top-bar a {
    color: var(--bg-light);
}
.top-bar a:hover {
    color: var(--secondary-color);
}
.top-bar-sep {
    color: rgba(255,255,255,0.3);
    margin: 0 10px;
}
.social-icons-top a {
    opacity: 0.8;
}
.social-icons-top a:hover {
    opacity: 1;
}

/* ── الهيدر ── */
.main-header {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1020;
    padding: 15px 0;
}
.header-inner {
    height: 60px;
}

/* ── شريط البحث ── */
.search-wrapper {
    max-width: 600px;
    position: relative;
}
.search-input-group {
    display: flex;
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    overflow: hidden;
    background: var(--bg-light);
    transition: var(--transition);
}
.search-input-group:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.2);
    background: var(--bg-white);
}
.search-icon-inner {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-input {
    border: none;
    background: transparent;
    padding: 10px 15px 10px 45px; /* RTL */
    font-family: inherit;
    width: 100%;
}
.search-input:focus {
    box-shadow: none;
    background: transparent;
}
.search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 25px;
    font-weight: 500;
    transition: var(--transition);
}
.search-btn:hover {
    background: var(--primary-light);
}

/* ── نتائج البحث المباشر ── */
.live-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    margin-top: 10px;
    z-index: 1050;
    max-height: 400px;
    overflow-y: auto;
}
.search-suggestion-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
    color: var(--text-color);
}
.search-suggestion-item:last-child {
    border-bottom: none;
}
.search-suggestion-item:hover {
    background: var(--bg-light);
    color: var(--primary-color);
}
.search-suggestion-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-left: 15px; /* RTL */
}
.search-suggestion-info h6 {
    margin: 0 0 5px;
    font-size: 0.95rem;
    font-weight: 500;
}
.search-suggestion-price {
    color: var(--secondary-color);
    font-weight: 700;
    font-size: 0.9rem;
}

/* ── أيقونات الهيدر ── */
.header-icon-btn {
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 1.3rem;
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: var(--transition);
    text-decoration: none;
}
.header-icon-btn:hover {
    color: var(--secondary-color);
}
.header-icon-label {
    font-size: 0.9rem;
    font-weight: 500;
}
.cart-badge {
    position: absolute;
    top: -5px;
    right: -8px; /* RTL */
    background: var(--secondary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ── القائمة الرئيسية ── */
.main-nav {
    background: var(--primary-color);
    color: white;
    border-bottom: 3px solid var(--secondary-color);
}
.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.nav-list::-webkit-scrollbar {
    display: none;
}
.nav-item {
    position: relative;
    white-space: nowrap;
}
.nav-link-item {
    display: block;
    padding: 15px 20px;
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
}
.nav-link-item i {
    margin-left: 5px; /* RTL */
    font-size: 1.1rem;
}
.nav-link-item:hover, .nav-link-item.active {
    background: rgba(255,255,255,0.1);
    color: white;
}
.nav-link-offers {
    color: var(--secondary-color);
    font-weight: 700;
}
.nav-link-offers:hover {
    color: #fff;
    background: var(--secondary-color);
}

/* ── موبايل توجل ── */
.navbar-toggler-custom {
    background: transparent;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 24px;
    width: 30px;
    cursor: pointer;
    padding: 0;
}
.navbar-toggler-custom span {
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: var(--transition);
}

/* ── بطاقة المنتج ── */
.product-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
}
.product-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-5px);
    border-color: var(--secondary-light);
}
.product-img-wrap {
    position: relative;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    overflow: hidden;
    background: var(--bg-light);
}
.product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}
.product-card:hover .product-img {
    transform: scale(1.05);
}
.product-badge {
    position: absolute;
    top: 20%;
    right: 0;
    background: var(--secondary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 20px 0 0 20px; /* RTL curve on left side */
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 2;
}
.badge-discount {
    background: #dc3545; /* Red for discount */
}
.badge-recent {
    background: #0d6efd; /* Blue for recent */
    top: 20%;
    right: auto;
    left: 0; /* Position recent on the left */
    border-radius: 0 20px 20px 0; /* LTR curve on right side */
}
.product-info {
    padding: 15px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-category {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}
.product-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.product-title a {
    color: var(--text-color);
}
.product-title a:hover {
    color: var(--primary-color);
}
.product-price-wrap {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.product-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}
.product-price-old {
    font-size: 0.9rem;
    text-decoration: line-through;
    color: var(--text-muted);
}
.product-actions {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-light);
}
.btn-add-cart {
    width: 100%;
    background: var(--bg-white);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px;
    border-radius: 4px;
    font-weight: 600;
    transition: var(--transition);
}
.btn-add-cart:hover {
    background: var(--primary-color);
    color: white;
}

/* ── الأزرار ── */
.btn-primary-custom {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
}
.btn-primary-custom:hover {
    background: var(--primary-light);
    color: white;
}
.btn-secondary-custom {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: var(--border-radius);
    font-weight: 600;
    transition: var(--transition);
}
.btn-secondary-custom:hover {
    background: var(--secondary-dark);
    color: white;
}

/* ── الفوتر ── */
.site-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.8);
    margin-top: 60px;
}
.footer-main {
    padding: 60px 0;
}
.footer-heading {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 10px;
}
.footer-heading::after {
    content: '';
    position: absolute;
    right: 0; /* RTL */
    bottom: 0;
    width: 40px;
    height: 2px;
    background: var(--secondary-color);
}
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-links li {
    margin-bottom: 12px;
}
.footer-links a {
    color: rgba(255,255,255,0.8);
    transition: var(--transition);
}
.footer-links a:hover {
    color: var(--secondary-color);
    padding-right: 5px; /* RTL */
}
.footer-contact {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-contact li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
}
.footer-contact i {
    color: var(--secondary-color);
    margin-top: 4px;
}
.footer-contact a {
    color: rgba(255,255,255,0.8);
}
.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    color: white;
    border-radius: 50%;
    transition: var(--transition);
}
.social-link:hover {
    background: var(--secondary-color);
    color: white;
    transform: translateY(-3px);
}
.badge-pay {
    display: inline-block;
    background: rgba(255,255,255,0.1);
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-left: 5px;
    margin-bottom: 5px;
}
.footer-bottom {
    background: rgba(0,0,0,0.2);
    padding: 20px 0;
    font-size: 0.9rem;
}
.footer-bottom a {
    color: rgba(255,255,255,0.8);
}
.footer-bottom a:hover {
    color: var(--secondary-color);
}

/* ── واتساب العائم ── */
.whatsapp-fab {
    position: fixed;
    bottom: 30px;
    left: 30px; /* RTL - left instead of right */
    width: 60px;
    height: 60px;
    background: #25D366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: var(--transition);
}
.whatsapp-fab:hover {
    transform: scale(1.1);
    color: white;
}

/* ── شريط البحث موبايل ── */
.mobile-search-bar {
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    z-index: 1019; /* Just below sticky header (1020) */
    position: relative;
    pointer-events: auto;
    transition: none !important;
    display: none !important; /* Default hidden */
}
.mobile-search-bar.active-search {
    display: block !important; /* Visible when class is added */
}
.mobile-search-bar .search-input-group {
    display: flex;
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 30px;
    overflow: hidden;
    background: var(--bg-light);
    transition: var(--transition);
}
.mobile-search-bar .search-input-group:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(197, 168, 128, 0.2);
    background: var(--bg-white);
}
.mobile-search-bar .search-input {
    border: none;
    background: transparent;
    padding: 12px 15px 12px 50px;
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
    min-height: 48px; /* Apple HIG minimum touch target */
    -webkit-appearance: none; /* Fix iOS rounded inputs */
}
.mobile-search-bar .search-input:focus {
    box-shadow: none;
    background: transparent;
    outline: none;
}
.mobile-search-bar .search-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 20px;
    min-width: 48px;
    min-height: 48px; /* Touch-friendly target */
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    touch-action: manipulation; /* Prevent double-tap zoom */
}
.mobile-search-bar .search-btn:active {
    background: var(--primary-light);
}
.mobile-search-bar .search-icon-inner {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none; /* Prevent icon from stealing taps */
}

/* ── الموبايل والتجاوب ── */
/* ── Nav overlay safety — must NEVER block taps when inactive ── */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1010;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.nav-overlay.active {
    pointer-events: auto;
    opacity: 1;
}

@media (max-width: 991px) {
    .main-nav {
        display: none; /* Hide standard nav on mobile */
    }

    /* Ensure mobile search toggle is tappable — generous touch target */
    #mobileSearchToggle {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
        touch-action: manipulation;
        pointer-events: auto !important;
        position: relative;
        z-index: 100; /* Well above any overlay or sibling */
    }

    /* The icon inside the button must not steal pointer events */
    #mobileSearchToggle i,
    #mobileSearchToggle * {
        pointer-events: none;
    }

    /* Ensure no overlay blocks the search bar */
    .mobile-search-bar {
        pointer-events: auto !important;
        z-index: 1019;
    }
    .mobile-search-bar * {
        pointer-events: auto;
    }

    /* Prevent header-actions container from clipping */
    .header-actions {
        position: relative;
        z-index: 50;
        pointer-events: auto;
    }
}

/* ── نظام التقييمات ── */
.rating-stars {
    display: inline-flex;
    flex-direction: row-reverse;
    font-size: 1.5rem;
    color: #ddd;
}
.rating-stars input[type="radio"] {
    display: none;
}
.rating-stars label {
    cursor: pointer;
    padding: 0 0.1rem;
    transition: color 0.2s;
    color: #ddd;
}
.rating-stars label i.fa-solid {
    display: none;
}
.rating-stars label:hover,
.rating-stars label:hover ~ label,
.rating-stars input:checked ~ label {
    color: #f39c12;
}
.rating-stars input:checked ~ label i.fa-solid,
.rating-stars label:hover i.fa-solid,
.rating-stars label:hover ~ label i.fa-solid {
    display: inline-block;
}
.rating-stars input:checked ~ label i.fa-regular,
.rating-stars label:hover i.fa-regular,
.rating-stars label:hover ~ label i.fa-regular {
    display: none;
}

.review-card {
    background: #fdfdfd;
    border: 1px solid #eaeaea;
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    transition: box-shadow 0.2s;
}
.review-card:hover {
    box-shadow: var(--shadow-sm);
}
.review-stars i {
    color: #f39c12;
    font-size: 1.1rem;
}
.review-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 1.2rem;
}
