:root {
    --gold: #D4AF37;
    --light-gold: #F5E6A3;
    --beige: #F5F5DC;
    --dark-beige: #E6D8B5;
    --black: #1a1a1a;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    color: #1a1a1a;
    background: linear-gradient(135deg, #faf8f5 0%, #f5f0e8 25%, #ede6d8 50%, #f0e9dc 75%, #faf6f0 100%);
    background-attachment: fixed;
    overflow-x: hidden;
}

.gold-text {
    color: var(--gold);
    font-weight: 700;
}

.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;
}

/* Product Card Styling */
.product-card {
    background: white;
    transition: all 0.3s ease;
    cursor: pointer;
}

.product-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
}

/* Product Images */
.product-img {
    height: 200px;
    object-fit: contain !important;
    object-position: center !important;
    transition: transform 0.3s ease;
    padding: 10px;
}

.product-card:hover .product-img {
    transform: scale(1.05);
}

/* Product Title and Text */
.card-title {
    color: #1a1a1a !important;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.card-text {
    font-size: 0.9rem;
    color: #6c757d !important;
    margin-bottom: 1rem;
}

/* Fix link color inside product card */
.product-card a {
    text-decoration: none;
    color: inherit;
}

.product-card a .card-title {
    color: #1a1a1a !important;
}

.product-card a .card-text {
    color: #6c757d !important;
}

.product-card a:hover .card-title {
    color: #1a1a1a !important;
}

.product-card a:hover .card-text {
    color: #6c757d !important;
}

/* Product Price */
.price {
    color: var(--gold);
    font-weight: bold;
    font-size: 1.2rem;
}

/* Add to Cart Button */
.btn-dark.rounded-circle {
    background: var(--black);
    border: none;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
}

.btn-dark.rounded-circle:hover {
    background: var(--gold);
    transform: scale(1.1);
}

/* Remove parallax animation to prevent zoom effect */

/* 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;
}

/* Product Card Text Sizes */
.card-body .card-title {
    font-size: 1.1rem;
}

.card-body .h5 {
    font-size: 1.3rem;
}

.card-body .btn {
    font-size: 0.95rem;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .product-image {
        height: 200px;
    }

    .product-card {
        margin-bottom: 25px;
    }

    .card-body {
        padding: 20px;
    }

    .card-body .card-title {
        font-size: 1rem;
    }

    .card-body .h5 {
        font-size: 1.2rem;
    }
}

/* Filter Sidebar Styling */
.form-check {
    position: relative;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    flex-direction: row-reverse;
    justify-content: space-between;
}

.form-check-label {
    font-size: 15px;
    color: #5D4037;
    font-weight: 900;
    padding: 8px 10px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: block;
    flex: 1;
    cursor: pointer;
    margin-bottom: 0;
}

.form-check-label:hover {
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%) !important;
    transform: translateX(-3px);
    box-shadow: 0 3px 10px rgba(218, 165, 32, 0.2);
}

.form-check-input:checked~.form-check-label {
    background: linear-gradient(135deg, #DAA520 0%, #B8860B 100%) !important;
    color: white !important;
    font-weight: 600;
    transform: translateX(-3px);
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.4);
}

.form-check-input {
    width: 18px;
    height: 18px;
    border: 2px solid #DAA520;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: 8px;
    margin-right: 0;
    flex-shrink: 0;
}

.form-check-input:hover {
    transform: scale(1.15);
    border-color: #B8860B;
    box-shadow: 0 0 8px rgba(218, 165, 32, 0.3);
}

.form-check-input:checked {
    background-color: #DAA520;
    border-color: #B8860B;
    box-shadow: 0 0 0 4px rgba(218, 165, 32, 0.2);
}

.form-check-input[type="radio"]:checked {
    background-color: #CD853F;
    border-color: #8B4513;
    box-shadow: 0 0 0 4px rgba(205, 133, 63, 0.2);
}

.form-check-input[type="radio"]:checked~.form-check-label {
    background: linear-gradient(135deg, #CD853F 0%, #8B4513 100%) !important;
}

.brand-filter:checked {
    background-color: #D4AF37;
    border-color: #B8860B;
    box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.2);
}

.brand-filter:checked~.form-check-label {
    background: linear-gradient(135deg, #D4AF37 0%, #B8860B 100%) !important;
}

/* Button Hover Effects */
button[onclick="applyFilters()"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(184, 134, 11, 0.4);
}

button[onclick="resetFilters()"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(139, 69, 19, 0.4);
}

/* Card Shadows and Hover */
.card.shadow-sm {
    transition: all 0.3s ease;
}

.card.shadow-sm:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1) !important;
}

/* Input Focus Effects */
input[type="number"]:focus,
.form-control:focus,
.form-select:focus {
    border-color: #DAA520 !important;
    box-shadow: 0 0 0 0.25rem rgba(218, 165, 32, 0.25) !important;
}

/* Smooth Transitions */
.form-check-label,
.card,
button {
    transition: all 0.3s ease;
}

/* Enhanced Filter Cards */
.card h5 {
    font-size: 16px;
    position: relative;
    display: inline-block;
    color: #5D4037;
    font-weight: 700;
}

.card h5::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #DAA520, #B8860B);
    transition: width 0.4s ease;
    border-radius: 2px;
}

.card:hover h5::after {
    width: 100%;
}

/* Price Filter Inputs - Golden Theme */
#minPrice,
#maxPrice {
    font-size: 15px;
    font-weight: 600;
    color: #5D4037;
    transition: all 0.3s ease;
}

#minPrice:focus,
#maxPrice:focus {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(184, 134, 11, 0.3) !important;
}

/* Sort Select Styling - Golden Theme */
#sortSelect {
    font-size: 15px;
    font-weight: 500;
    color: #5D4037;
    cursor: pointer;
    transition: all 0.3s ease;
}

#sortSelect:hover {
    border-color: #8B4513 !important;
    box-shadow: 0 2px 8px rgba(139, 69, 19, 0.2);
}

#sortSelect:focus {
    border-color: #8B4513 !important;
    box-shadow: 0 4px 12px rgba(139, 69, 19, 0.3) !important;
}

/* 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);
}

/* Filter Card Animations */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.col-lg-3 .card {
    animation: slideInRight 0.5s ease-out;
}

.col-lg-3 .card:nth-child(1) {
    animation-delay: 0.1s;
}

.col-lg-3 .card:nth-child(2) {
    animation-delay: 0.2s;
}

.col-lg-3 .card:nth-child(3) {
    animation-delay: 0.3s;
}

.col-lg-3 .card:nth-child(4) {
    animation-delay: 0.4s;
}

.col-lg-3 .card:nth-child(5) {
    animation-delay: 0.5s;
}

/* Mobile Responsive Filters */
@media (max-width: 991px) {
    .col-lg-3 {
        margin-bottom: 30px;
    }

    .card h5 {
        font-size: 15px;
    }

    .form-check-label {
        font-size: 15px;
        padding: 8px 12px;
    }
}

/* Enhanced Filter Section Styling */
.col-lg-3 .card {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    overflow: hidden;
    position: relative;
}

.col-lg-3 .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #DAA520, #CD853F, #D4AF37, #B8860B, #8B4513);
    background-size: 200% 100%;
    animation: gradientMove 3s ease infinite;
}

@keyframes gradientMove {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

/* Filter Section Headers with Icons */
.col-lg-3 h5 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.col-lg-3 h5::before {
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: 8px;
    font-size: 16px;
}

/* Add icons to each filter section - Golden Theme */
.card-body:has(#searchInput) h5::before {
    content: '\f002';
    color: #DAA520;
}

.card-body:has(input[name="category"]) h5::before {
    content: '\f03a';
    /* list icon */
    color: #CD853F;
}

.card-body:has(.brand-filter) h5::before {
    content: '\f02b';
    /* tag icon */
    color: #D4AF37;
}

.card-body:has(#minPrice) h5::before {
    content: '\f155';
    /* money icon */
    color: #B8860B;
}

.card-body:has(#sortSelect) h5::before {
    content: '\f0dc';
    /* sort icon */
    color: #8B4513;
}

/* Checkbox and Radio Custom Styling */
.form-check-input[type="checkbox"] {
    border-radius: 5px;
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

/* Active State Glow Effect - Golden Theme */
.form-check-input:checked {
    animation: glowPulseGold 1.5s ease-in-out infinite;
}

@keyframes glowPulseGold {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(218, 165, 32, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(218, 165, 32, 0.15);
    }
}

.form-check-input[type="radio"]:checked {
    animation: glowPulseBrown 1.5s ease-in-out infinite;
}

@keyframes glowPulseBrown {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(205, 133, 63, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(205, 133, 63, 0.15);
    }
}

.brand-filter:checked {
    animation: glowPulseAntique 1.5s ease-in-out infinite;
}

@keyframes glowPulseAntique {

    0%,
    100% {
        box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.3);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(212, 175, 55, 0.15);
    }
}

/* Filter Apply Button Enhancement */
button[onclick="applyFilters()"] {
    position: relative;
    overflow: hidden;
}

button[onclick="applyFilters()"]::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button[onclick="applyFilters()"]:hover::before {
    width: 300px;
    height: 300px;
}

/* Products Count Badge - Golden Theme */
#productsCount {
    font-weight: 700;
    color: #8B4513;
    font-size: 16px;
    padding: 3px 10px;
    background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
    border-radius: 6px;
    display: inline-block;
    border: 2px solid #DAA520;
    box-shadow: 0 2px 8px rgba(218, 165, 32, 0.2);
}

/* Smooth Scroll Behavior */
html {
    scroll-behavior: smooth;
}

/* Loading Animation for Filters */
@keyframes filterLoad {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.col-lg-3 .card {
    animation: filterLoad 0.6s ease-out backwards;
}

/* RTL Sp
ecific Enhancements for Filters */
[dir="rtl"] .input-group {
    direction: rtl;
}

/* Enhanced Border Radius for RTL Buttons */
[dir="rtl"] .btn-primary,
[dir="rtl"] button[onclick="applyFilters()"] {
    border-radius: 8px;
    border-left: 4px solid rgba(184, 134, 11, 0.8);
    padding-left: 16px;
}

[dir="rtl"] .btn-primary:hover,
[dir="rtl"] button[onclick="applyFilters()"]:hover {
    border-left-width: 6px;
    padding-left: 14px;
}

/* Form Controls Left Border Emphasis */
.form-control,
.form-select {
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-left-color: #DAA520 !important;
    border-left-width: 4px !important;
    padding-left: calc(0.75rem - 1px);
}

/* Input Group Text Left Border */
.input-group-text {
    border-left: 3px solid rgba(184, 134, 11, 0.5);
}

/* Select Dropdown Arrow Position for RTL */
[dir="rtl"] .form-select {
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
    padding-right: 0.75rem;
}

/* Product Card Image Styling - Uniform & Contained */
.card-img-top {
    width: 100% !important;
    height: 200px !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block;
    padding: 10px !important;
    margin: 0;
}

/* Ensure all product cards have same height */
.card.h-100 {
    display: flex;
    flex-direction: column;
}

.card.h-100 .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Badge positioning */
.badge.position-absolute {
    z-index: 10;
}

/* Card image styling */
.card-img-top {
    border-radius: 0.375rem 0.375rem 0 0;
    margin-bottom: 0;
    background: #fff;
}

/* Responsive Image Sizing */
@media (max-width: 768px) {
    .product-image {
        height: 220px !important;
    }

    .card .position-relative.overflow-hidden {
        height: 220px !important;
        min-height: 220px;
        max-height: 220px;
    }
}

@media (max-width: 576px) {
    .product-image {
        height: 200px !important;
    }

    .card .position-relative.overflow-hidden {
        height: 200px !important;
        min-height: 200px;
        max-height: 200px;
    }
}

/* Product Image Specific Styling */
.product-image {
    width: 100% !important;
    height: 200px !important;
    object-fit: contain !important;
    object-position: center !important;
    display: block;
    padding: 10px !important;
    margin: 0;
}

/* Image Container Fixed Height */
.card .position-relative.overflow-hidden {
    height: 200px !important;
    min-height: 200px;
    max-height: 200px;
    overflow: hidden;
    background: #fff;
}

/* Responsive Image Sizing */
@media (max-width: 768px) {

    .product-image,
    .card-img-top,
    .product-img {
        height: 180px !important;
        padding: 8px !important;
    }

    .card .position-relative.overflow-hidden,
    .position-relative.overflow-hidden {
        height: 180px !important;
        min-height: 180px;
        max-height: 180px;
    }
}

@media (max-width: 576px) {

    .product-image,
    .card-img-top,
    .product-img {
        height: 160px !important;
        padding: 8px !important;
    }

    .card .position-relative.overflow-hidden,
    .position-relative.overflow-hidden {
        height: 160px !important;
        min-height: 160px;
        max-height: 160px;
    }
}

/* 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;
}

/* Prevent cards from stretching on zoom out */
.col-lg-4, .col-md-6 {
    max-width: 400px;
    flex: 0 0 auto;
}

/* Filter sidebar max width */
.col-lg-3 {
    max-width: 350px;
    flex: 0 0 auto;
}

/* Products container */
#products-container {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: flex-start;
}

#products-container > div {
    flex: 0 0 calc(33.333% - 14px);
    max-width: 380px;
}

/* Responsive adjustments */
@media (max-width: 1400px) {
    #products-container > div {
        flex: 0 0 calc(33.333% - 14px);
    }
}

@media (max-width: 1200px) {
    #products-container > div {
        flex: 0 0 calc(50% - 10px);
        max-width: 450px;
    }
}

@media (max-width: 768px) {
    #products-container > div {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .col-lg-3 {
        max-width: 100%;
    }
}

/* Prevent filter cards from stretching */
.col-lg-3 .card {
    max-width: 100%;
    width: 100%;
}

footer {
    background-color: var(--black);
    color: white;
}

.footer-title {
    color: var(--gold);
    margin-bottom: 1.5rem;
    font-weight: bold;
}

.footer-links a {
    color: #adb5bd;
    text-decoration: none;
    transition: color 0.3s;
    display: block;
    margin-bottom: 0.5rem;
}

.footer-links a:hover {
    color: var(--gold);
}

.footer-contact i {
    color: var(--gold);
    width: 20px;
}