/* ============================================
   CUSTOM STYLES FOR TAILWIND ENHANCEMENTS
   ============================================ */

/* Hide scrollbar but keep functionality */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* RTL Support */
[dir="rtl"] {
    font-family: 'Inter', 'Cairo', 'Tajawal', sans-serif;
}

[dir="ltr"] {
    font-family: 'Inter', 'Poppins', sans-serif;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Product Card Styles */
.product-card {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: #c59d5f;
}

/* Grid View */
.grid-view .product-card {
    flex-direction: column;
}

/* List View - Applied via JavaScript classes */
.list-view .product-card {
    flex-direction: row !important;
    align-items: center;
}

.list-view .product-image-wrapper {
    width: 120px !important;
    min-width: 120px !important;
    height: 120px !important;
    padding-top: 0 !important;
    flex-shrink: 0;
}

.list-view .product-content {
    flex: 1;
    padding: 1.5rem !important;
}

/* Product Image */
.product-image {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.product-image.loaded {
    opacity: 1;
}

/* Main Category Buttons */
.main-category-btn {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 9999px;
    padding: 1rem 2.25rem;
    font-size: 1.125rem;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.main-category-btn:hover {
    border-color: #c59d5f;
    color: #c59d5f;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.main-category-btn.active {
    background: linear-gradient(135deg, #1c1c1c 0%, #2d2d2d 100%);
    border-color: #1c1c1c;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(28, 28, 28, 0.3);
}

/* Sub Category Cards */
.sub-category-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
    font-family: inherit;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 90px;
    text-align: center;
}

.sub-category-card:hover {
    border-color: #c59d5f;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sub-category-card.active {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-color: #d97706;
    box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.2);
}

.sub-category-icon {
    font-size: 1.75rem;
    line-height: 1;
}

.sub-category-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
}

.sub-category-card.active .sub-category-name {
    color: #d97706;
    font-weight: 600;
}

/* View Toggle Buttons */
.view-btn {
    transition: all 0.2s ease;
}

.view-btn.active {
    background: #fef3c7 !important;
    border-color: #d97706 !important;
    color: #d97706 !important;
}

.view-btn:not(.active) {
    background: white !important;
    border-color: #e5e7eb !important;
    color: #9ca3af !important;
}

.view-btn:not(.active):hover {
    border-color: #d1d5db !important;
    color: #6b7280 !important;
}

/* Modal Animation */
@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.animate-modalSlide {
    animation: modalSlide 0.3s ease-out;
}

/* Product Info Button */
.product-info-btn {
    font-style: italic;
    font-weight: 600;
    line-height: 1;
}

/* Product Name - Better mobile typography */
.product-name {
    letter-spacing: -0.01em;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Product Price - Better mobile typography with golden color */
.product-price {
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #d97706; /* amber-600 - golden color */
}

/* Product Header Layout */
.product-header {
    width: 100%;
}

.product-name-row {
    width: 100%;
}

.product-price-row {
    width: 100%;
    align-items: center;
}

/* Responsive adjustments */
@media (min-width: 768px) {
    .list-view .product-image-wrapper {
        width: 150px;
        min-width: 150px;
        height: 150px;
    }
}

@media (min-width: 1024px) {
    .list-view .product-image-wrapper {
        width: 180px;
        min-width: 180px;
        height: 180px;
    }
}

@media (max-width: 640px) {
    .list-view .product-image-wrapper {
        width: 100px;
        min-width: 100px;
        height: 100px;
    }
    
    .list-view .product-content {
        padding: 1rem;
    }
}

/* Language Toggle Styles */
.lang-option {
    color: #6b7280;
    transition: all 0.2s ease;
    cursor: pointer;
}

.lang-option.active {
    color: #d97706; /* amber-600 - golden color */
    font-weight: 600;
}

/* RTL Specific Adjustments */
[dir="rtl"] .header-content {
    flex-direction: row-reverse;
}

[dir="rtl"] .header-main {
    flex-direction: row-reverse;
}

[dir="rtl"] .lang-toggle {
    flex-direction: row-reverse;
}

[dir="rtl"] .product-header {
    flex-direction: row-reverse;
}

[dir="rtl"] .product-name-wrapper {
    flex-direction: row-reverse;
}

[dir="rtl"] .view-toggle {
    justify-content: flex-start;
}

[dir="rtl"] .modal-close {
    right: auto;
    left: 1rem;
}

/* Sub Category Navigation - Ensure it scrolls normally */
#subCategoryNav {
    position: relative;
    z-index: 10;
}

/* Subcategory Label in View Toggle Section */
#subCategoryLabel {
    color: #d97706;
    font-weight: 600;
}

/* Back to Top Button */
#backToTopBtn {
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
}

#backToTopBtn:hover {
    box-shadow: 0 6px 16px rgba(217, 119, 6, 0.4);
}

/* Smooth scrollbar for desktop */
@media (hover: hover) {
    .main-category-scroll,
    .sub-category-scroll {
        scrollbar-width: thin;
        scrollbar-color: #c59d5f transparent;
    }

    .main-category-scroll::-webkit-scrollbar,
    .sub-category-scroll::-webkit-scrollbar {
        display: block;
        height: 6px;
    }

    .main-category-scroll::-webkit-scrollbar-track,
    .sub-category-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .main-category-scroll::-webkit-scrollbar-thumb,
    .sub-category-scroll::-webkit-scrollbar-thumb {
        background: linear-gradient(90deg, #c59d5f, #d4af7a);
        border-radius: 3px;
    }
}
