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

body {
    font-family: 'Tajawal', sans-serif;
}

/* Smooth transitions */
* {
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

/* Cart drawer animation */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    background: white;
    z-index: 50;
    transition: right 0.3s ease;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
}

@media (min-width: 640px) {
    .cart-sidebar {
        width: 24rem;
        /* 384px */
    }
}

.cart-sidebar.open {
    right: 0;
}

/* Mobile menu animation */
.mobile-sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 16rem;
    /* 256px */
    height: 100%;
    background: white;
    z-index: 50;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.mobile-sidebar.open {
    left: 0;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Custom scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.dark .custom-scrollbar::-webkit-scrollbar-track {
    background: #374151;
}

.dark .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #6b7280;
}

/* Dark mode styles */
.dark .cart-sidebar,
.dark .mobile-sidebar {
    background: #1f2937;
    /* gray-800 */
}

/* Search dropdown */
.search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-height: 300px;
    overflow-y: auto;
    z-index: 30;
}

.dark .search-dropdown {
    background: #1f2937;
    border: 1px solid #374151;
}

/* Active nav item */
.nav-item {
    position: relative;
    font-weight: 500;
    transition: color 0.3s ease;
}

.nav-item::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: #0ea5e9;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-50%);
    border-radius: 2px;
}

.nav-item:hover::after,
.nav-item.active::after {
    width: 100%;
}

.nav-item.active {
    color: #0ea5e9;
}

/* Mobile bottom nav like app */
.bottom-nav {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
}

.dark .bottom-nav {
    background: rgba(31, 41, 55, 0.9);
}

.bottom-nav .active {
    color: #0ea5e9;
}

.dark .bottom-nav .active {
    color: #38bdf8;
}

/* Category section */
.category-section {
    scroll-margin-top: 5rem;
}

/* Dropdown menu */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    min-width: 240px;
    z-index: 50;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    margin-top: 0.5rem;
    display: block;
}

.dark .dropdown-menu {
    background: rgba(31, 41, 55, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Dropdown item styles */
.dropdown-menu li {
    margin-bottom: 2px;
}

.dropdown-menu li:last-child {
    margin-bottom: 0;
}

.dropdown-menu a {
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    position: relative;
}

/* Hover animation for dropdown items */
.dropdown-menu a:hover {
    background-color: rgba(14, 165, 233, 0.1);
    transform: translateX(-4px);
    /* Move left slightly RTL */
    color: #0ea5e9;
}

/* Notification */
.notification {
    position: fixed;
    top: 80px;
    left: 20px;
    right: 20px;
    background: #10b981;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transform: translateY(-100px);
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto;
}

.notification.show {
    transform: translateY(0);
    opacity: 1;
}

.notification.hide {
    transform: translateY(-100px);
    opacity: 0;
}

.notification.error {
    background: #ef4444;
}

.notification.warning {
    background: #f59e0b;
}

/* Subcategory navigation */
.subcategory-nav {
    display: none;
}

.subcategory-nav.active {
    display: flex;
}

/* Hero slider styles */
.hero-slide {
    display: none;
}

.hero-slide.active {
    display: block;
}

.slider-dot.active {
    background-color: #0ea5e9;
}

/* User menu styles */
.user-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 200px;
    z-index: 30;
}

.user-menu.open {
    display: block;
}

.dark .user-menu {
    background: #1f2937;
    border: 1px solid #374151;
}

/* Category menu styles */
.subcategory-list {
    display: none;
}

.subcategory-list.open {
    display: block;
}

.category-item.active {
    color: #0ea5e9;
}

/* Scroll to top button */
#scrollTop {
    position: fixed;
    bottom: 80px;
    left: 20px;
    background: #0ea5e9;
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

#scrollTop:hover {
    background: #0284c7;
}

#scrollTop.hidden {
    display: none;
}

/* Promo Banner Styles */
.banner-container {
    position: sticky;
    top: 0;
    z-index: 35;
    background: linear-gradient(90deg, #0ea5e9, #3b82f6);
    color: white;
    overflow: hidden;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .banner-container {
    background: linear-gradient(90deg, #1e40af, #3730a3);
}

.banner-content {
    position: absolute;
    width: 100%;
    text-align: center;
    opacity: 0;
    transform: translateY(-100%);
    transition: all 0.3s ease;
}

.banner-content.active {
    opacity: 1;
    transform: translateY(0);
}

.banner-text {
    font-size: 0.9rem;
    font-weight: 500;
    margin: 0;
    padding: 0 1rem;
}

@media (max-width: 640px) {
    .banner-container {
        height: 36px;
    }

    .banner-text {
        font-size: 0.8rem;
    }
}

/* Improved Hero Section */
.hero-section {
    position: relative;
    overflow: hidden;
}

.hero-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 55%),
        radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.05) 0%, transparent 55%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

/* Improved Add to Cart Button */
.add-to-cart-btn {
    position: relative;
    overflow: hidden;
}

.add-to-cart-btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.add-to-cart-btn:hover::after {
    opacity: 1;
}

/* Improved Navbar Dropdown - Logic moved to generic class */
.navbar-dropdown {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.navbar-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Mobile Responsive Adjustments */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem !important;
    }

    .hero-subtitle {
        font-size: 1.125rem !important;
    }
}

@media (max-width: 640px) {
    #scrollTop {
        bottom: 70px;
        left: 15px;
        width: 45px;
        height: 45px;
    }

    .notification {
        top: 70px;
        left: 15px;
        right: 15px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Mobile Sidebar Categories */
.sidebar-category-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.5rem 1rem;
    text-align: right;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sidebar-category-btn:hover {
    background-color: #f3f4f6;
    /* bg-gray-100 */
}

.dark .sidebar-category-btn:hover {
    background-color: #374151;
    /* dark:bg-gray-700 */
}

.sidebar-subcategory-list {
    padding-right: 1rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.sidebar-subcategory-list.open {
    max-height: 500px;
    /* Adjust based on content if needed */
}

.sidebar-subcategory-list a {
    display: block;
    padding: 0.5rem 1rem 0.5rem 2rem;
    color: #6b7280;
    /* text-gray-500 */
    text-decoration: none;
    transition: color 0.2s;
}

.dark .sidebar-subcategory-list a {
    color: #9ca3af;
    /* dark:text-gray-400 */
}

.sidebar-subcategory-list a:hover {
    color: #0ea5e9;
    /* text-primary-600 */
}

.dark .sidebar-subcategory-list a:hover {
    color: #38bdf8;
    /* dark:text-primary-400 */
}

/* --- FROM PRODUCT STYLES --- */

/* Product image zoom effect */
.product-image {
    transition: transform 0.5s ease;
}

.product-card:hover .product-image {
    transform: scale(1.05);
}

/* Product Link Button */
.product-link-btn {
    position: absolute;
    top: 3.5rem;
    left: 0.5rem;
    z-index: 10;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.dark .product-link-btn {
    background: rgba(31, 41, 55, 0.8);
    /* dark:bg-gray-800 with opacity */
}

.product-link-btn:hover {
    background: white;
}

.dark .product-link-btn:hover {
    background: #1f2937;
    /* dark:bg-gray-800 */
}

/* Product Prices */
.product-prices {
    display: flex;
    flex-direction: column;
}

.product-old-price {
    text-decoration: line-through;
    color: #9ca3af;
    /* text-gray-400 */
    font-size: 0.9rem;
}

.dark .product-old-price {
    color: #6b7280;
    /* dark:text-gray-500 */
}

.product-current-price {
    font-weight: bold;
    color: #16a34a;
    /* text-green-600 */
}

.dark .product-current-price {
    color: #22c55e;
    /* dark:text-green-500 */
}
