/* =====================================
   DS SHOPEE - CUSTOM STYLES & SKELETON SHIMMER
===================================== */

:root {
    color-scheme: light;
}

.dark {
    color-scheme: dark;
}

/* =====================================
   SKELETON SHIMMER ANIMATION (GLOBAL)
===================================== */

@keyframes skeletonShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-shimmer {
    background: linear-gradient(
        90deg,
        #e2e8f0 25%,
        #f1f5f9 50%,
        #e2e8f0 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite linear;
}

.dark .skeleton-shimmer {
    background: linear-gradient(
        90deg,
        #1e293b 25%,
        #334155 50%,
        #1e293b 75%
    );
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite linear;
}

/* =====================================
   GLOBAL
===================================== */

* {
    box-sizing: border-box;
}

html {
    width: 100%;
    max-width: 100%;
    scroll-behavior: smooth;
}

body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    font-family: 'Inter', 'Hind', sans-serif;
    overflow-x: clip;
    transition:
        background-color 0.3s ease,
        color 0.3s ease;
}

main,
section,
header,
footer {
    min-width: 0;
    max-width: 100%;
}

/* =====================================
   SCROLLBAR
===================================== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 9999px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #334155;
}

/* =====================================
   GLASS EFFECT
===================================== */

.glass {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

/* =====================================
   HIDE SCROLLBAR
===================================== */

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

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

/* =====================================
   HEADER RESPONSIVE FIX
===================================== */

header {
    width: 100%;
}

header > div {
    width: 100%;
    min-width: 0;
}

#header-main-row {
    width: 100%;
    min-width: 0;
}

#header-main-row > a {
    flex-shrink: 0;
    min-width: 0;
}

#search-input {
    min-width: 0;
}

#header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
    flex-shrink: 0;
}

#header-actions > * {
    flex-shrink: 0;
}

#lang-selector {
    max-width: 140px;
    min-width: 0;
    cursor: pointer;
}

#cart-toggle-btn {
    white-space: nowrap;
}

#mobile-search-input {
    width: 100%;
    min-width: 0;
}

/* =====================================
   CATEGORY SCROLL
===================================== */

#category-pills {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.category-pill {
    flex-shrink: 0;
}

/* =====================================
   PRODUCT GRID
===================================== */

#product-grid {
    width: 100%;
    min-width: 0;
}

.product-card {
    min-width: 0;
    max-width: 100%;
}

.product-image {
    transition: transform 0.5s ease, opacity 0.3s ease;
}

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

/* =====================================
   MODAL TRANSITIONS
===================================== */

.modal-hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-visible {
    opacity: 1;
    pointer-events: auto;
}

/* =====================================
   CART DRAWER
===================================== */

.drawer-open {
    transform: translateX(0);
}

.drawer-closed {
    transform: translateX(100%);
}

#cart-drawer {
    max-width: 100%;
}

#cart-drawer > div {
    min-width: 0;
    max-width: 100vw;
}

/* =====================================
   FOCUS ACCESSIBILITY
===================================== */

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
}

/* =====================================
   TOAST ANIMATION
===================================== */

.toast-enter {
    opacity: 0;
    transform: translateY(8px);
}

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

/* =====================================
   TABLET RESPONSIVE
===================================== */

@media (max-width: 767px) {

    #header-main-row {
        flex-wrap: wrap;
        justify-content: space-between;
        row-gap: 12px;
        padding-top: 12px;
        padding-bottom: 12px;
    }

    #header-main-row > a {
        flex-shrink: 0;
    }

    #header-actions {
        width: 100%;
        flex-basis: 100%;
        justify-content: flex-end;
        gap: 8px;
    }

    #lang-selector {
        max-width: 125px;
    }

    #header-actions button {
        flex-shrink: 0;
    }

    header .pb-3 {
        width: 100%;
        min-width: 0;
    }

    #category-pills {
        padding-bottom: 12px;
    }

    #products-section > div:first-child {
        align-items: flex-start;
    }
}

/* =====================================
   MOBILE RESPONSIVE
===================================== */

@media (max-width: 640px) {

    #header-main-row {
        gap: 10px;
    }

    #header-main-row > a {
        gap: 9px;
    }

    #header-main-row > a > div:first-child {
        width: 38px;
        height: 38px;
    }

    #header-main-row > a span.text-xl {
        font-size: 18px;
    }

    #header-actions {
        gap: 6px;
    }

    #header-actions button {
        padding: 9px;
    }

    #lang-selector {
        max-width: 115px;
        padding: 8px 7px;
        font-size: 11px;
    }

    #cart-toggle-btn {
        padding: 9px 12px;
        gap: 6px;
        font-size: 13px;
    }

    #mobile-search-input {
        font-size: 14px;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    #hero-title {
        font-size: 30px;
        line-height: 1.25;
    }

    #products-section > div:first-child {
        padding: 14px;
    }

    #products-section > div:first-child > div {
        max-width: 100%;
    }

    #cart-drawer {
        padding-left: 0;
        width: 100%;
    }

    #cart-drawer > div {
        width: 100%;
        max-width: 100vw;
    }

    #quickview-card,
    #checkout-modal > div {
        max-width: 100%;
    }
}

/* =====================================
   EXTRA SMALL MOBILE
===================================== */

@media (max-width: 360px) {

    #header-main-row {
        gap: 8px;
    }

    #header-main-row > a {
        gap: 7px;
    }

    #header-main-row > a span.text-xl {
        font-size: 16px;
    }

    #header-actions {
        gap: 4px;
    }

    #lang-selector {
        max-width: 95px;
        font-size: 10px;
        padding: 7px 5px;
    }

    #header-actions button {
        padding: 7px;
    }

    #cart-toggle-btn {
        padding: 8px 9px;
        gap: 5px;
    }

    #hero-title {
        font-size: 26px;
    }
}

/* =====================================
   REDUCED MOTION ACCESSIBILITY
===================================== */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================
   DS SHOPEE - PRODUCT DETAILS PAGE
========================================= */

#product-carousel {
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

#main-product-image {
    transition: opacity 0.25s ease, transform 0.3s ease;
}

.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;

    width: 44px;
    height: 44px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: rgba(255, 255, 255, 0.95);
    color: #334155;

    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);

    transition:
        background 0.2s ease,
        transform 0.2s ease;
}

.gallery-arrow:hover {
    background: #eef2ff;
    transform: translateY(-50%) scale(1.06);
}

.dark .gallery-arrow {
    background: #1e293b;
    color: #f8fafc;
}

.dark .gallery-arrow:hover {
    background: #334155;
}

#product-thumbnails {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    overscroll-behavior-x: contain;
}

.product-thumbnail {
    cursor: pointer;
    transition:
        border-color 0.2s ease,
        transform 0.2s ease;
}

.product-thumbnail:hover {
    transform: translateY(-2px);
}

.product-thumbnail.active-thumbnail {
    border-color: #4f46e5;
}

.dark .product-thumbnail.active-thumbnail {
    border-color: #818cf8;
}

#product-description {
    overflow-wrap: anywhere;
}

#product-specifications {
    overflow: hidden;
}

#image-zoom-modal {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#zoom-image {
    user-select: none;
    -webkit-user-drag: none;
}

#product-quantity {
    appearance: textfield;
    -moz-appearance: textfield;
}

#product-quantity::-webkit-inner-spin-button,
#product-quantity::-webkit-outer-spin-button {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
}

#related-products {
    min-width: 0;
}

#related-products > a {
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 640px) {

    #product-details-main > div {
        padding-top: 24px;
    }

    #product-carousel {
        border-radius: 20px;
    }

    .gallery-arrow {
        width: 38px;
        height: 38px;
    }

    #product-thumbnails img {
        width: 68px;
        height: 68px;
    }

    #product-name {
        font-size: 26px;
    }

    #product-price {
        font-size: 27px;
    }

    #reviews-section {
        scroll-margin-top: 85px;
    }

    #image-zoom-modal {
        padding: 12px;
    }
}

@media (max-width: 360px) {

    #product-name {
        font-size: 23px;
    }

    #product-price {
        font-size: 24px;
    }

    .gallery-arrow {
        width: 34px;
        height: 34px;
    }

    #product-thumbnails img {
        width: 60px;
        height: 60px;
    }
}

.gallery-arrow:focus-visible,
.product-thumbnail:focus-visible {
    outline: 2px solid #6366f1;
    outline-offset: 3px;
}
