/* Global layout */
* {
    font-family: 'Epilogue', sans-serif;
}

body {
    background: linear-gradient(135deg, #fefefe 0%, #f3f7ff 40%, #fff0f6 100%);
    font-family: 'Epilogue', sans-serif;
    font-size: 17px;
    font-weight: 400;
    line-height: 1.8em;
    letter-spacing: -0.3px;
}

/* Responsive body font sizes for small screens */
@media (max-width: 991px) {
    body {
        font-size: 16px;
        line-height: 1.7em;
    }
}

@media (max-width: 767px) {
    body {
        font-size: 13px;
        line-height: 1.6em;
        letter-spacing: -0.2px;
    }
}

@media (max-width: 575px) {
    body {
        font-size: 12px;
        line-height: 1.5em;
        letter-spacing: -0.1px;
    }
}

@media (max-width: 400px) {
    body {
        font-size: 11px;
        line-height: 1.5em;
    }
}

h1, h2, h3, h4, h5, h6, p, span, a, button, input, select, textarea, label, div {
    font-family: 'Epilogue', sans-serif !important;
}

/* Navbar theme */
.navbar {
    background: #525ce5;
}

    .navbar .navbar-brand span,
    .navbar .nav-link {
        color: #ffffff !important;
        font-weight: 600;
    }

        .navbar .nav-link:hover {
            opacity: 0.9;
        }

.brand-logo {
    width: 140px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
}

/* Main content margin for header clearance */
#main-content {
    margin-top: 200px;
}

@media (min-width: 992px) {
    #main-content {
        margin-top: 240px;
    }
}

/* Category strip - make it sticky */
.category-strip {
    background: #f5f7fa;
    color: #212529;
    border-top: 0;
    border-bottom: 0;
    position: sticky;
    top: 0;
    z-index: 1020;
    overflow-x: auto;
    overflow-y: visible !important;
}

/* Hide scrollbar on mobile to prevent visibility through subcategory panel */
@media (max-width: 767px) {
    .category-strip {
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
    }

    .category-strip::-webkit-scrollbar {
        display: none; /* Chrome, Safari, Opera */
    }
}

/* Show styled scrollbar only on desktop */
@media (min-width: 768px) {
    .category-strip {
        scrollbar-width: thin;
        scrollbar-color: rgba(107, 115, 255, 0.3) transparent;
    }

    .category-strip::-webkit-scrollbar {
        height: 8px;
    }

    .category-strip::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 4px;
    }

    .category-strip::-webkit-scrollbar-thumb {
        background: rgba(107, 115, 255, 0.5);
        border-radius: 4px;
    }

    .category-strip::-webkit-scrollbar-thumb:hover {
        background: rgba(107, 115, 255, 0.7);
    }
}

    .category-strip .container {
        min-width: max-content;
    }

    .category-strip .d-flex {
        flex-wrap: nowrap !important;
        gap: 1rem;
        padding: 0.5rem 0;
    }

.category-item {
    flex: 0 0 auto;
    width: 100px;
    text-align: center;
    position: relative;
}

    .category-item img {
        width: 70px;
        height: 70px;
        object-fit: cover;
        border-radius: 12px;
        border: 2px solid rgba(255,255,255,0.8);
        box-shadow: 0 6px 16px rgba(0,0,0,0.1);
        background: #fff;
        transition: transform 0.3s ease, box-shadow 0.3s ease;
    }

    .category-item:hover img {
        transform: scale(1.05);
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    }

    .category-item .title {
        color: #212529;
        font-weight: 700;
        font-size: 0.7rem;
        line-height: 1.2;
        width: 100px;
        text-transform: uppercase;
        letter-spacing: 0.3px;
        word-wrap: break-word;
        overflow-wrap: break-word;
        white-space: normal;
        display: block;
        min-height: 2.4em;
    }

    .category-item a {
        padding: 0.5rem;
        transition: all 0.3s ease;
        display: block;
    }

        .category-item a:hover {
            text-decoration: none;
        }

            .category-item a:hover .title {
                color: #0072ff;
            }

/* Responsive category items for small screens */
@media (max-width: 768px) {
    .category-item {
        width: 80px;
    }

    .category-item img {
        width: 55px;
        height: 55px;
        border-radius: 10px;
    }

    .category-item .title {
        font-size: 0.65rem;
        width: 80px;
        min-height: 2.2em;
    }

    .category-item a {
        padding: 0.4rem;
    }
}

@media (max-width: 576px) {
    .category-item {
        width: 70px;
    }

    .category-item img {
        width: 48px;
        height: 48px;
        border-radius: 8px;
        border: 1.5px solid rgba(255,255,255,0.8);
    }

    .category-item .title {
        font-size: 0.6rem;
        width: 70px;
        min-height: 2em;
        letter-spacing: 0.2px;
    }

    .category-item a {
        padding: 0.3rem;
    }
}

@media (max-width: 400px) {
    .category-item {
        width: 65px;
    }

    .category-item img {
        width: 44px;
        height: 44px;
    }

    .category-item .title {
        font-size: 0.55rem;
        width: 65px;
    }
}

/* Subcategory panel - positioned relative to viewport */
.subcategory-panel {
    position: fixed;
    left: 0;
    right: 0;
    width: 100%;
    background: rgb(255, 255, 255);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-bottom: 2px solid #6b73ff;
    padding: 1.5rem 0;
    z-index: 1049;
    display: none; /* Hidden by default */
    flex-direction: column; /* Only set flex-direction, not display: flex */
    animation: slideDown 0.3s ease-out;
}

/* When panel is shown via JavaScript, it will use flex layout */
.subcategory-panel[style*="display: block"],
.subcategory-panel[style*="display: flex"] {
    display: flex !important;
}

/* Sticky header for subcategory panel */
.subcategory-panel-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgb(255, 255, 255); /* Changed from rgba(255, 255, 255, 0.98) to fully opaque */
    backdrop-filter: blur(10px);
    padding: 1rem 0;
    border-bottom: 1px solid rgba(107, 115, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.subcategory-panel-body {
    padding: 1rem 0 1.5rem 0;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subcategory-panel-title {
    color: #6b73ff;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
    padding-left: 0.5rem;
    border-left: 3px solid #6b73ff;
}

/* Update existing panel title to remove bottom margin in sticky context */
.subcategory-panel-header .subcategory-panel-title {
    color: #6b73ff;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 0.5rem;
    border-left: 3px solid #6b73ff;
    margin: 0;
}

/* Show panel on category hover */
.category-item:hover + .subcategory-panel,
.subcategory-panel:hover {
    display: block !important;
}

/* Subcategory list using CSS Grid */
.subcategory-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
}

/* Responsive grid columns */
@media (max-width: 1199px) {
    .subcategory-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 991px) {
    .subcategory-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .subcategory-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .subcategory-list {
        grid-template-columns: repeat(1, 1fr);
    }
}

/* List item styling */
.subcategory-list li {
    display: flex;
}

/* Sleek subcategory card - updated for list layout */
.subcategory-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid rgba(107, 115, 255, 0.15);
    transition: all 0.25s ease;
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    gap: 0.75rem;
    width: 100%;
    height: 100%;
    max-width: 300px;
    text-wrap: auto;
}

    .subcategory-card:hover {
        transform: translateX(4px);
        border-color: #6b73ff;
        box-shadow: 0 4px 12px rgba(107, 115, 255, 0.15);
        background: linear-gradient(90deg, #f8f9ff, #ffffff);
    }

.subcategory-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: #212529;
    line-height: 1.3;
    flex: 1;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.subcategory-card:hover .subcategory-name {
    color: #6b73ff;
}

/* Responsive adjustments for subcategory cards */
@media (max-width: 768px) {
    .subcategory-card {
        padding: 0.6rem 0.75rem;
        gap: 0.6rem;
    }

    .subcategory-name {
        font-size: 0.85rem;
    }

    .subcategory-list {
        gap: 0.75rem;
    }
}

@media (max-width: 575px) {
    .subcategory-card {
        padding: 0.5rem 0.65rem;
    }

    .subcategory-name {
        font-size: 0.8rem;
    }

    .subcategory-list {
        gap: 0.5rem;
    }
}

/* Ensure category strip doesn't clip the panel */
.category-strip {
    position: relative;
    overflow-x: auto;
    overflow-y: visible !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .subcategory-panel {
        padding: 1rem 0;
    }

    .subcategory-panel-title {
        font-size: 0.85rem;
        margin-bottom: 0.75rem;
    }

    .subcategory-card {
        padding: 0.6rem 0.75rem;
        gap: 0.6rem;
    }

    .subcategory-img-wrapper {
        width: 40px;
        height: 40px;
        min-width: 40px;
    }

    .subcategory-name {
        font-size: 0.85rem;
    }

    .subcategory-panel-header {
        padding: 0.75rem 0;
    }
    
    .subcategory-panel-body {
        padding: 0.75rem 0 1rem 0;
    }
    
    .subcategory-panel-header .subcategory-panel-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .subcategory-panel .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .subcategory-panel-header {
        padding: 0.5rem 0;
    }
    
    .subcategory-panel-body {
        padding: 0.5rem 0 0.75rem 0;
    }
    
    .subcategory-panel-header .subcategory-panel-title {
        font-size: 0.8rem;
    }
}

/* Add vertical scrolling for subcategory panel on small screens */
@media (max-width: 767px) {
    .subcategory-panel {
        max-height: 60vh;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(107, 115, 255, 0.5) rgba(107, 115, 255, 0.1);
    }

    .subcategory-panel::-webkit-scrollbar {
        width: 6px;
    }

    .subcategory-panel::-webkit-scrollbar-track {
        background: rgba(107, 115, 255, 0.1);
        border-radius: 3px;
    }

    .subcategory-panel::-webkit-scrollbar-thumb {
        background: rgba(107, 115, 255, 0.5);
        border-radius: 3px;
    }

    .subcategory-panel::-webkit-scrollbar-thumb:hover {
        background: rgba(107, 115, 255, 0.7);
    }
}

@media (max-width: 575px) {
    .subcategory-panel {
        max-height: 50vh;
    }
}

/* Close button for subcategory panel - updated for inline layout */
.btn-close-subcategory {
    position: relative;
    top: 0;
    right: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1050;
    padding: 0;
    line-height: 1;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

    .btn-close-subcategory i {
        font-size: 1.5rem;
        color: #6b73ff;
        transition: all 0.3s ease;
    }

    .btn-close-subcategory:hover i {
        color: #ff4757;
        transform: rotate(90deg) scale(1.1);
    }

    .btn-close-subcategory:focus {
        outline: none;
        box-shadow: 0 0 0 3px rgba(107, 115, 255, 0.3);
        border-radius: 50%;
    }

/* Update panel title to work with flex layout */
.subcategory-panel-title {
    color: #6b73ff;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding-left: 0.5rem;
    border-left: 3px solid #6b73ff;
    margin: 0;
}

/* Responsive close button */
@media (max-width: 768px) {
    .btn-close-subcategory i {
        font-size: 1.35rem;
    }

    .subcategory-panel-title {
        font-size: 0.85rem;
    }
}

@media (max-width: 576px) {
    .btn-close-subcategory i {
        font-size: 1.25rem;
    }

    .subcategory-panel-title {
        font-size: 0.8rem;
    }
}

.hero-slide {
    width: 100%;
    height: auto;
    object-fit: cover;
    box-shadow: 0 12px 28px rgba(255, 113, 154, 0.35);
}

/* Responsive hero carousel heights */
@media (min-width: 992px) {
    .hero-slide {
        height: 500px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .hero-slide {
        height: 300px;
    }
}

@media (min-width: 576px) and (max-width: 767px) {
    .hero-slide {
        height: 250px;
    }
}

@media (max-width: 575px) {
    .hero-slide {
        height: 200px;
        box-shadow: 0 8px 20px rgba(255, 113, 154, 0.35);
    }
}

@media (max-width: 400px) {
    .hero-slide {
        height: 150px;
    }
}

/* Ensure carousel container doesn't overflow */
#heroCarousel {
    overflow: hidden;
}

#heroCarousel .carousel-inner {
    overflow: hidden;
}

#heroCarousel .carousel-item {
    overflow: hidden;
}

/* Carousel controls - adjust for smaller screens */
@media (max-width: 767px) {
    .carousel-control-prev,
    .carousel-control-next {
        width: 40px;
    }

    .carousel-control-prev-icon,
    .carousel-control-next-icon {
        width: 20px;
        height: 20px;
    }
}

/* Carousel indicators - adjust for smaller screens */
@media (max-width: 767px) {
    .carousel-indicators [data-bs-target] {
        width: 8px;
        height: 8px;
    }
}

.carousel-caption h5, .carousel-caption p {
    text-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* Product cards - Modernized with responsive sizing - SMALLER */
.product-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    position: relative;
}

    .product-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: 12px;
        padding: 2px;
        background: linear-gradient(135deg, #6b73ff, #00c6ff);
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: xor;
        mask-composite: exclude;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .product-card:hover {
        transform: translateY(-4px) scale(1.01);
        box-shadow: 0 12px 24px rgba(107, 115, 255, 0.2);
    }

        .product-card:hover::before {
            opacity: 1;
        }

    .product-card .card-img-top {
        height: 140px;
        object-fit: cover;
        transition: transform 0.4s ease;
    }

@media (min-width: 768px) {
    .product-card .card-img-top {
        height: 150px;
    }
}

@media (min-width: 992px) {
    .product-card .card-img-top {
        height: 160px;
    }
}

.product-card:hover .card-img-top {
    transform: scale(1.08);
}

.product-card .card-img-wrapper {
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

    .product-card .card-img-wrapper::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 100%);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

.product-card:hover .card-img-wrapper::after {
    opacity: 1;
}

.product-card .tag {
    font-size: 0.6rem;
    font-weight: 600;
    color: #0072ff;
    background: linear-gradient(135deg, #e3f2fd, #f0f4ff);
    border: 1px solid rgba(0, 114, 255, 0.2);
    border-radius: 15px;
    padding: 2px 8px;
    display: inline-block;
    margin-right: 3px;
    margin-bottom: 3px;
    transition: all 0.2s ease;
    font-family: 'Epilogue', sans-serif !important;
    text-transform: uppercase;
}

@media (min-width: 768px) {
    .product-card .tag {
        font-size: 0.65rem;
        padding: 3px 10px;
        margin-right: 4px;
        margin-bottom: 4px;
    }
}

.product-card .tag:hover {
    background: linear-gradient(135deg, #0072ff, #00c6ff);
    color: #fff;
    border-color: transparent;
    transform: scale(1.05);
}

.product-card .card-body {
    padding: 0.75rem;
}

@media (min-width: 768px) {
    .product-card .card-body {
        padding: 0.85rem;
    }
}

@media (min-width: 992px) {
    .product-card .card-body {
        padding: 1rem;
    }
}

.product-card .card-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 0.5rem;
    line-height: 1.25;
    min-height: 2rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Epilogue', sans-serif !important;
}

@media (min-width: 768px) {
    .product-card .card-title {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
        min-height: 2.1rem;
    }
}

@media (min-width: 992px) {
    .product-card .card-title {
        font-size: 0.9rem;
        margin-bottom: 0.65rem;
        min-height: 2.25rem;
        line-height: 1.3;
    }
}

.product-card .btn {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 0.4rem 0.6rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: 'Epilogue', sans-serif !important;
}

@media (min-width: 768px) {
    .product-card .btn {
        font-size: 0.75rem;
        padding: 0.45rem 0.7rem;
    }
}

@media (min-width: 992px) {
    .product-card .btn {
        font-size: 0.8rem;
        padding: 0.5rem 0.8rem;
    }
}

.product-card .btn::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;
}

.product-card .btn:hover::before {
    width: 300px;
    height: 300px;
}

.product-card .btn-outline-primary {
    border-width: 1.5px;
    border-color: #0072ff;
    color: #0072ff;
    background: transparent;
}

    .product-card .btn-outline-primary:hover {
        background: linear-gradient(135deg, #0072ff, #00c6ff);
        border-color: transparent;
        color: #fff;
        transform: translateY(-1px);
        box-shadow: 0 6px 12px rgba(0, 114, 255, 0.25);
    }

.product-card .btn .bi {
    font-size: 0.8rem;
}

@media (min-width: 768px) {
    .product-card .btn .bi {
        font-size: 0.85rem;
    }
}

@media (min-width: 992px) {
    .product-card .btn .bi {
        font-size: 0.9rem;
    }
}

.product-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: linear-gradient(135deg, #f7971e, #ffd200);
    color: #2b2b2b;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 15px;
    z-index: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
    animation: pulse 2s infinite;
    font-family: 'Epilogue', sans-serif !important;
}

@media (min-width: 768px) {
    .product-badge {
        top: 10px;
        right: 10px;
        font-size: 0.65rem;
        padding: 3px 8px;
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-card {
    animation: fadeInUp 0.5s ease-out;
}

    .product-card:nth-child(1) {
        animation-delay: 0.1s;
    }

    .product-card:nth-child(2) {
        animation-delay: 0.2s;
    }

    .product-card:nth-child(3) {
        animation-delay: 0.3s;
    }

    .product-card:nth-child(4) {
        animation-delay: 0.4s;
    }

/* Buttons */
.btn-primary {
    background: linear-gradient(90deg, #00c6ff, #0072ff);
    border: none;
    font-weight: 700;
    font-family: 'Epilogue', sans-serif !important;
}

.btn-outline-primary {
    border-width: 2px;
    border-color: #0072ff;
    color: #0072ff;
    font-weight: 700;
    font-family: 'Epilogue', sans-serif !important;
}

    .btn-outline-primary:hover {
        background: #0072ff;
        color: #fff;
    }

.btn-warning {
    background: linear-gradient(90deg, #f7971e, #ffd200);
    border: none;
    color: #2b2b2b;
    font-weight: 700;
    font-family: 'Epilogue', sans-serif !important;
}

.btn-success {
    background: linear-gradient(90deg, #00b09b, #96c93d);
    border: none;
    font-weight: 700;
    font-family: 'Epilogue', sans-serif !important;
}

.btn-outline-danger {
    border-width: 2px;
    font-weight: 700;
    font-family: 'Epilogue', sans-serif !important;
}

.form-control, .form-select {
    font-family: 'Epilogue', sans-serif !important;
}

.floating-cart {
    position: fixed;
    bottom: 90px;
    right: 16px;
    z-index: 1030;
    display: none;
    box-shadow: 0 12px 24px rgba(0,0,0,0.2);
    font-family: 'Epilogue', sans-serif !important;
}

@media (max-width: 576px) {
    .floating-cart {
        display: inline-flex;
    }
}

footer {
    background: #191c2f;
    color: #fff;
}

    footer a {
        color: #ffe082;
    }

        footer a:hover {
            color: #fff6bf;
        }

.btn:focus, .nav-link:focus {
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,0.25);
    outline: none;
}

#loadingIndicator {
    animation: fadeInUp 0.3s ease-out;
}

    #loadingIndicator .spinner-border {
        width: 3rem;
        height: 3rem;
        border-width: 0.3em;
    }

.input-group-text {
    font-family: 'Epilogue', sans-serif !important;
}

#searchResults {
    font-family: 'Epilogue', sans-serif !important;
}

.table {
    font-family: 'Epilogue', sans-serif !important;
}

.toast-body {
    font-family: 'Epilogue', sans-serif !important;
}

.offcanvas-title {
    font-family: 'Epilogue', sans-serif !important;
}

.badge {
    font-family: 'Epilogue', sans-serif !important;
}
