/* ========== Root Variables ========== */
:root {
    --border-color: #e2e8f0;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== Global Styles ========== */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-dark);
    background: #f8fafc;
    line-height: 1.6;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: var(--transition-smooth);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #5568d3, #653b8a);
}

/* ========== Navbar Styles ========== */
.navbar {
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255, 255, 255, 0.95) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: var(--transition-smooth);
    z-index: 1030;
    position: sticky;
    top: 0;
}

.navbar-collapse {
    position: static;
}

.navbar .container-fluid {
    position: relative;
}

.nav-item.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer !important;
}

.dropdown-toggle::after {
    pointer-events: none;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: var(--transition-smooth);
}

.navbar-brand:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.navbar-brand i {
    background: var(--primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Nav Links */
.nav-link {
    color: var(--text-dark) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition-smooth);
    transform: translateX(-50%);
}

.nav-link:hover {
    background: rgba(102, 126, 234, 0.08);
    color: var(--text-primary) !important;
}

.nav-link:hover::before {
    width: 80%;
}

/* Search Bar */
.input-group .form-control {
    border: 2px solid var(--border-color);
    border-radius: 12px 0 0 12px;
    padding: 0.75rem 1rem;
    transition: var(--transition-smooth);
    background: #f8fafc;
}

.input-group .form-control:focus {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.input-group .btn {
    border-radius: 0 12px 12px 0;
    border: 2px solid var(--border-color);
    border-left: none;
    background: white;
    transition: var(--transition-smooth);
}

.input-group .btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--text-primary);
}

/* Cart Link */
#cartLink {
    position: relative;
    transition: var(--transition-smooth);
    padding: 0.5rem 1rem;
}

#cartLink:hover {
    transform: scale(1.1);
    background: rgba(102, 126, 234, 0.08);
}

#cartCount {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    /* background: linear-gradient(135deg, #f5576c, #f093fb) !important; */
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.4);
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
    }
}

/* Badge pulse animation when items are added */
#cartCount.badge-pulse {
    animation: badgePulse 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes badgePulse {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.1);
    }
    75% {
        transform: scale(1.25);
    }
    100% {
        transform: scale(1);
    }
}

/* Dropdown Menu */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-xl);
    border-radius: 16px;
    padding: 0.75rem;
    margin-top: 0.5rem !important;
    background: white;
    backdrop-filter: blur(10px);
    z-index: 1050 !important;
}

.dropdown-item {
    border-radius: 10px;
    padding: 0.75rem 1rem !important;
    transition: var(--transition-smooth);
    font-weight: 500;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    transform: translateX(5px);
}

.dropdown-divider {
    border-color: var(--border-color);
    margin: 0.5rem 0;
}

/* ========== Hero Section ========== */
.bg-gradient {
    background: var(--primary) !important;
    border-radius: 24px !important;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.bg-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: float 15s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }
    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

.bg-gradient h1 {
    position: relative;
    z-index: 1;
    color: white !important;
    font-weight: 800;
    letter-spacing: -1px;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.bg-gradient p {
    position: relative;
    z-index: 1;
    font-size: 1.1rem;
    font-weight: 400;
}

.bg-gradient .btn-primary {
    background: var(--primary);
    color: var(--text-white);
    border: none;
    padding: 0.875rem 2rem;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    transition: var(--transition-smooth);
    position: relative;
    z-index: 1;
}

.bg-gradient .btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
    /* background: #f8f9fa !important; */
}

/* ========== Product Cards ========== */
.product-card {
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    transition: var(--transition-smooth);
    background: white;
    box-shadow: var(--shadow-sm);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary);
    opacity: 0;
    transition: var(--transition-smooth);
    z-index: 0;
    border-radius: 16px;
}

.product-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: transparent;
}

.product-card:hover::before {
    opacity: 0.03;
}

.product-image-wrapper {
    position: relative;
    overflow: hidden;
    height: 250px;
    background: linear-gradient(135deg, #f6f8fb 0%, #ffffff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.product-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-image[src*="placeholder"],
.product-image[src*="No+Image"] {
    object-fit: contain;
    padding: 2rem;
    filter: grayscale(20%);
}

.product-card:hover .product-image {
    transform: scale(1.1) rotate(2deg);
}

/* Product Overlay */
.product-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    padding: 1.5rem;
    z-index: 5;
    backdrop-filter: blur(5px);
}

.product-card:hover .product-overlay {
    opacity: 1;
    visibility: visible;
}

.quick-action-btns {
    transform: translateY(20px);
    transition: var(--transition-smooth);
    width: 100%;
    display: flex;
    gap: 0.5rem;
    flex-direction: column;
}

.product-card:hover .quick-action-btns {
    transform: translateY(0);
}

.quick-action-btns .btn {
    border-radius: 10px;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

.quick-action-btns .btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Product Badge */
.product-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    text-transform: uppercase;
    border-radius: 20px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
}

.badge-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
    color: white !important;
}

.badge-danger {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%) !important;
    color: white !important;
}

.badge-warning {
    background: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%) !important;
    color: white !important;
}

/* Wishlist Button */
.wishlist-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: var(--transition-smooth);
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
}

.wishlist-btn:hover {
    background: white;
    color: #e53e3e;
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.3);
}

.wishlist-btn.active {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.wishlist-btn.active:hover {
    background: linear-gradient(135deg, #d42a40 0%, #dc4a39 100%);
    box-shadow: 0 8px 25px rgba(229, 62, 62, 0.4);
}

.wishlist-btn.active i {
    font-weight: 900;
}

/* Product Info */
.card-body {
    padding: 1rem !important;
    display: flex;
    flex-direction: column;
    flex: 1;
    background: white;
    position: relative;
    z-index: 1;
}

.product-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    min-height: 2.65rem;
    transition: var(--transition-smooth);
}

.product-title a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition-smooth);
}

.product-title a:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.product-card:hover .product-title {
    color: var(--text-primary);
}

.category-tag {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: inline-block;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
}

.product-price {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0;
    line-height: 1.2;
}

.product-old-price {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: line-through;
    margin-left: 0.5rem;
    font-weight: 400;
}

/* Product Rating */
.product-rating {
    color: #fbbf24;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.product-rating i {
    filter: drop-shadow(0 1px 2px rgba(251, 191, 36, 0.3));
}

/* Stock Badge */
.stock-badge {
    font-size: 0.65rem;
    padding: 0.25rem 0.65rem;
    font-weight: 600;
    border-radius: 12px;
    display: inline-block;
    margin-top: 0.4rem;
}

.stock-badge i {
    font-size: 0.6rem;
}

/* ========== Category Section ========== */
.category-section {
    margin-bottom: 5rem;
    position: relative;
}

.category-header {
    padding-left: 1.5rem;
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.category-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 5px;
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
}

.category-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    letter-spacing: -0.5px;
}

.category-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 400;
}

/* ========== Carousel Styles ========== */
.products-carousel {
    position: relative;
    overflow: hidden;
    padding: 1rem 0;
}

.products-carousel-inner {
    display: flex;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: white;
    border: 2px solid var(--border-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: var(--transition-smooth);
    box-shadow: var(--shadow-md);
    color: var(--text-dark);
}

.carousel-nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: transparent;
    transform: translateY(-50%) scale(1.1);
    box-shadow: var(--shadow-lg);
}

.carousel-nav-btn.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

.carousel-nav-btn.prev {
    left: -25px;
}

.carousel-nav-btn.next {
    right: -25px;
}

/* ========== Loading Spinner ========== */
#productsSpinner {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    padding: 3rem;
}

.spinner-grow {
    animation: spinner-grow 1.5s ease-in-out infinite !important;
}

@keyframes spinner-grow {
    0%, 100% {
        transform: scale(0);
        opacity: 0.3;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ========== Animations ========== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ========== Responsive Design ========== */
@media (min-width: 992px) {
    .col-lg-5ths {
        flex: 0 0 20%;
        max-width: 20%;
    }
}

@media (max-width: 991px) {
    .product-image-wrapper {
        height: 220px;
    }

    .category-title {
        font-size: 1.75rem;
    }

    .navbar-brand {
        font-size: 1.25rem !important;
    }
}

@media (max-width: 767px) {
    .product-image-wrapper {
        height: 200px;
    }

    .product-title {
        font-size: 0.9rem;
        min-height: 2.7rem;
    }

    .product-price {
        font-size: 1.25rem;
    }

    .category-title {
        font-size: 1.5rem;
    }

    .bg-gradient {
        padding: 2rem !important;
    }

    .bg-gradient h1 {
        font-size: 2rem !important;
    }

    .bg-gradient p {
        font-size: 1rem;
    }
}

@media (max-width: 576px) {
    .product-image-wrapper {
        height: 180px;
    }

    .product-title {
        font-size: 0.85rem;
    }

    .product-price {
        font-size: 1.1rem;
    }

    .wishlist-btn {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }

    .product-badge {
        font-size: 0.65rem;
        padding: 0.3rem 0.6rem;
    }

    .category-title {
        font-size: 1.25rem;
    }

    .carousel-nav-btn {
        width: 40px;
        height: 40px;
    }

    .carousel-nav-btn.prev {
        left: -15px;
    }

    .carousel-nav-btn.next {
        right: -15px;
    }
}

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

/* ========== Container Spacing ========== */
.container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
}

/* ========== Additional Enhancements ========== */
.btn {
    transition: var(--transition-smooth);
}

.btn:active {
    transform: scale(0.95);
}

/* Focus states for accessibility */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* Selection color */
::selection {
    background: var(--text-primary);
    color: white;
}

::-moz-selection {
    background: var(--text-primary);
    color: white;
}
