:root {
    --gold: #D4AF37;
    --light-gold: #F5E6A3;
    --beige: #F5F5DC;
    --dark-beige: #E6D8B5;
    --black: #1a1a1a;
}

.gold-text {
    color: var(--gold);
    font-weight: 700;
}

.navbar {
    font-family: 'Tajawal', sans-serif;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--gold) !important;
}

.nav-link {
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--black) !important;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--gold) !important;
}

.search-container {
    position: obsolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1000;
}

.search-container.active {
    display: block;
}

.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--light-gold) 100%);
    border: none;
    color: var(--black);
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-gold:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(212, 175, 55, 0.4);
}

[dir="rtl"] .btn-gold {
    border-radius: 8px 0 0 8px !important;
}

/* Search and Filter Styling */
.input-group-text {
    border-color: rgba(218, 165, 32, 0.3);
}

#searchInput {
    border-color: rgba(218, 165, 32, 0.3);
}

#searchInput:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(218, 165, 32, 0.25);
}

#sortSelect {
    border-color: rgba(218, 165, 32, 0.3);
}

#sortSelect:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(218, 165, 32, 0.25);
}

.btn-group .btn {
    margin: 5px;
}

/* Search Input Enhancement */
#searchInput {
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#searchInput:hover {
    border-color: #DAA520 !important;
    box-shadow: 0 2px 8px rgba(218, 165, 32, 0.15);
}

#searchInput::placeholder {
    color: #A0826D;
    font-weight: 400;
}

.input-group-text {
    transition: all 0.3s ease;
}

.input-group:hover .input-group-text {
    transform: scale(1.05);
}

.card-body:has(#searchInput) h5::before {
    content: '\f002';
    color: #DAA520;
}

/* Search Container - Allow overflow */
.search-container {
    position: relative;
    z-index: 100;
}

/* Search Suggestions Dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background: white;
    border: 3px solid #DAA520;
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 0;
    overflow: hidden;
    z-index: 150;
    box-shadow: 0 8px 24px rgba(218, 165, 32, 0.3);
    margin-top: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 0;
}

.search-suggestions.show {
    max-height: 400px;
    overflow-y: auto;
    opacity: 1;
}

.suggestion-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    text-align: right;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    background: white;
    animation: slideInSuggestion 0.3s ease forwards;
    opacity: 0;
}

@keyframes slideInSuggestion {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.suggestion-item:nth-child(1) {
    animation-delay: 0.05s;
}

.suggestion-item:nth-child(2) {
    animation-delay: 0.1s;
}

.suggestion-item:nth-child(3) {
    animation-delay: 0.15s;
}

.suggestion-item:nth-child(4) {
    animation-delay: 0.2s;
}

.suggestion-item:nth-child(5) {
    animation-delay: 0.25s;
}

.suggestion-item:nth-child(6) {
    animation-delay: 0.3s;
}

.suggestion-item:hover {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    padding-right: 18px;
    transform: translateX(-5px);
}

.suggestion-item:last-child {
    border-bottom: none;
    border-radius: 0 0 12px 12px;
}

.suggestion-item i {
    color: #DAA520;
    font-size: 16px;
}

.suggestion-item .product-name {
    font-weight: 600;
    color: #5D4037;
    font-size: 15px;
    flex: 1;
}

.suggestion-item .product-price {
    color: #27ae60;
    font-size: 14px;
    font-weight: 600;
    margin-right: auto;
}

/* Highlight matched text */
.suggestion-item .highlight {
    background: #FFECB3;
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
}

/* Pagination Styling */
.pagination {
    gap: 5px;
}

.page-item .page-link {
    border: 2px solid #DAA520;
    color: #5D4037;
    font-weight: 600;
    border-radius: 8px;
    padding: 10px 15px;
    transition: all 0.3s ease;
}

.page-item .page-link:hover {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    border-color: #B8860B;
    transform: translateY(-2px);
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #DAA520 0%, #B8860B 100%);
    border-color: #B8860B;
    color: white;
    box-shadow: 0 4px 12px rgba(218, 165, 32, 0.3);
}

.page-item.disabled .page-link {
    background: #f0f0f0;
    border-color: #ddd;
    color: #999;
}

/* Responsive Pagination */
@media (max-width: 576px) {
    .pagination {
        font-size: 14px;
    }

    .page-item .page-link {
        padding: 8px 12px;
    }
}

/* Fix for search suggestions overflow */
.card-body:has(#searchInput) {
    overflow: visible !important;
}

.card:has(#searchInput) {
    overflow: visible !important;
    z-index: 100;
}

.col-lg-3:has(#searchInput) {
    position: relative;
    z-index: 100;
}

/* Ensure suggestions appear above filter cards but below cart icon */
.search-suggestions {
    z-index: 150 !important;
}

/* Scrollbar styling for suggestions */
.search-suggestions::-webkit-scrollbar {
    width: 8px;
}

.search-suggestions::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 0 0 12px 0;
}

.search-suggestions::-webkit-scrollbar-thumb {
    background: #DAA520;
    border-radius: 4px;
}

.search-suggestions::-webkit-scrollbar-thumb:hover {
    background: #B8860B;
}

.user-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    display: none;
    z-index: 1000;
}

.user-menu.active {
    display: block;
}

/* Cart Items */
.cart-item {
    background: linear-gradient(145deg, #ffffff 0%, #fffbf5 100%);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 3px 12px rgba(212, 175, 55, 0.1);
    transition: transform 0.3s ease;
    border: 1px solid rgba(212, 175, 55, 0.15);
}

.cart-item:hover {
    transform: translateY(-2px);
    border-color: rgba(212, 175, 55, 0.35);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.18);
}

.cart-item-image {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-btn {
    width: 35px;
    height: 35px;
    border: 2px solid #D4AF37;
    background: linear-gradient(145deg, #ffffff 0%, #fffbf5 100%);
    color: #D4AF37;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 700;
    font-size: 1.1rem;
}

.quantity-btn:hover {
    background: linear-gradient(135deg, #D4AF37 0%, #B8860B 100%);
    color: white;
    border-color: #B8860B;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(212, 175, 55, 0.3);
}

/* Cart Summary */
.cart-summary {
    position: sticky;
    top: 100px;
    background: linear-gradient(145deg, #ffffff 0%, #fffbf5 100%);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.1);
}

/* Empty Cart */
#empty-cart {
    background: linear-gradient(145deg, #ffffff 0%, #fffbf5 100%);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(212, 175, 55, 0.15);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.08);
}

#empty-cart i {
    color: var(--primary-gold);
}

#empty-cart h4 {
    color: var(--dark-brown);
}

/* Coupon Section */
.coupon-section h6 {
    color: var(--dark-brown);
}

#coupon-code {
    border: 1px solid rgba(218, 165, 32, 0.3);
}

#coupon-code:focus {
    border-color: var(--primary-gold);
    box-shadow: 0 0 0 0.2rem rgba(218, 165, 32, 0.25);
}

/* Summary Rows */
.summary-row {
    color: var(--text-brown);
    font-weight: 500;
}

#total {
    color: var(--dark-gold);
    font-size: 1.2rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .cart-summary {
        position: static;
        margin-top: 30px;
    }

    .cart-item {
        padding: 15px;
    }

    .cart-item-image {
        width: 80px;
        height: 80px;
    }
}

/* RTL Border Radius Fix for Coupon Input */
[dir="rtl"] .coupon-input-group .form-control {
    border-radius: 0 8px 8px 0 !important;
    border-left: none;
}

[dir="rtl"] .coupon-input-group .btn {
    border-radius: 8px 0 0 8px !important;
}

/* Coupon Message Animation */
.coupon-alert {
    animation: fadeIn 0.3s ease-in;
    margin-top: 10px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* 
Search Container - Inside navbar next to icon */
#searchContainer {
    display: none;
}

#searchContainer.show {
    display: block;
}

/* Add spacing to navbar icons when search is active */
.d-flex.align-items-center.position-relative.search-active #userToggle,
.d-flex.align-items-center.position-relative.search-active > a {
    margin-right: 250px;
    transition: margin-right 0.3s ease;
}