/* 
  REVON - Sustainable Fashion CSS
  Bảng màu: #f8f7f2 (nền chính), #1a1a1a (văn bản/nút), #7d8471 (nhấn mạnh xanh lá mạ)
*/

:root {
    --background: #f9f8ef;
    --foreground: #151515;
    --primary: #188410;
    --primary-foreground: #f8f7f2;
    --accent: #7d8471;
    --muted: #666666;
    --border: #e5e4de;
    --radius: 4px;
    --font-sans: "Inter", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Layout */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
    line-height: 1.2;
    text-wrap: balance;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    margin-bottom: 24px;
}

h2.section-title {
    font-size: 1.5rem;
    margin: 80px 0 32px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.muted {
    color: var(--muted);
    font-size: 0.95rem;
}


/* Category filter buttons */
.category-filters {
    margin-top: 24px;
    margin-bottom: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.category-filter-btn {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: transparent;
    color: var(--foreground);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer !important;
    transition: all 0.2s;
    pointer-events: auto !important;
    position: relative;
    z-index: 1;
}

.category-filter-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.category-filter-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

/* Mobile: Thu nhỏ các nút filter category */
@media (max-width: 768px) {
    .category-filters {
        gap: 6px !important;
        flex-wrap: nowrap !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .category-filter-btn {
        padding: 6px 10px !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* Header & Nav */
header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}



.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    text-decoration: none;
    color: var(--foreground);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: opacity 0.2s;
}

.nav-links a:hover {
    opacity: 0.6;
}

/* Hero Section */
.hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    min-height: 60vh;
}

.hero p {
    font-size: 1.1rem;
    color: var(--muted);
    max-width: 500px;
}

.hero img {
    width: 100%;
    height: 600px;
    object-fit: cover;
    border-radius: var(--radius);
}

/* Grid & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* 4 columns on desktop */
    gap: 24px;
}

/* Responsive grid: 2 columns on tablet */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 2 columns */
@media (max-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        /* Giảm gap trên mobile cho đẹp hơn */
    }

    /* Products page - Mobile adjustments */
    .card {
        display: flex;
        flex-direction: column;
    }

    .card-body {
        display: flex;
        flex-direction: column;
        flex: 1;
    }

    .product-name {
        font-size: 0.9rem !important;
        line-height: 1.3;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        /* Standard property for compatibility */
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        min-height: 2.6em;
        max-height: 2.6em;
    }

    .product-price-status {
        margin-top: 4px !important;
        text-align: center !important;
    }

    .product-price-status .price {
        font-size: 0.95rem !important;
    }

    .product-action-section {
        margin-bottom: 8px !important;
    }

    .card-body {
        padding: 16px !important;
    }

    .product-short-desc {
        display: none !important;
    }

    .product-action-section .btn {
        width: 100%;
        font-size: 0.7rem !important;
        padding: 6px 8px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

.card {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.3s;
}

/* Make card media stretch full width (fix inline <a> shrink-wrap) */
.card>a {
    display: block;
    width: 100%;
    overflow: hidden;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.card {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card:hover {
    border-color: var(--accent);
}

.card-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.card h3 {
    margin-bottom: 12px;
    font-size: 1.25rem;
}

/* Product thumbnails - SQUARE IMAGE (aspect-ratio 1:1) */
.product-thumb {
    display: block !important;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    /* Square image */
    height: auto !important;
    object-fit: cover !important;
    object-position: center !important;
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    background: #f5f5f5;
    margin: 0 !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: 1px solid var(--primary);
    background: transparent;
    color: var(--primary);
}

.btn.primary {
    background: var(--primary);
    color: var(--primary-foreground);
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* Form Elements */
.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    background: #ffffff;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 1rem;
}

.input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Footer */
footer {
    margin-top: 100px;
    padding: 60px 24px 40px;
    background: #142513;
    color: #ffffff;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
}

.footer-section h3 {
    font-size: 1rem;
    margin-bottom: 20px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.footer-section p,
.footer-section a {
    color: #f9f8ef;
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 8px;
    display: block;
}

.footer-section a:hover {
    color: #f9f8ef;
}

.footer-bottom {
    max-width: 1200px;
    margin: 40px auto 0;
    padding-top: 24px;
    border-top: 1px solid #188410;
    text-align: center;
    color: #ffffff;
    font-size: 0.8rem;
}

/* Navigation Actions */
.nav-actions {
    display: flex !important;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.nav-actions .btn {
    white-space: nowrap;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 20px;
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.25s ease;
    z-index: 1000;
    font-size: 0.9rem;
}

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

/* Loading & Error States */
.loading {
    text-align: center;
    color: var(--muted);
    padding: 20px 0;
}

.error {
    color: #b00020;
    background: #fde7e7;
    border: 1px solid #f5c2c7;
    padding: 10px 12px;
    border-radius: var(--radius);
}

/* Price */
.price {
    font-weight: 700;
    color: var(--primary);
}

/* Badge */
.badge {
    background: #e2efe6;
    color: var(--primary);
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    display: inline-block;
}

/* Pill Options */
.pill-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.pill {
    padding: 8px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
}

.pill.active {
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Cart Item */
.cart-item {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

/* Cart item images - FORCE EQUAL SIZE */
.cart-item img.cart-thumb,
.cart-item img {
    display: block !important;
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    height: 80px !important;
    min-height: 80px !important;
    max-height: 80px !important;
    object-fit: cover !important;
    object-position: center !important;
    border-radius: 8px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
}

.cart-item img.cart-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background: #f5f5f5;
}

/* Table Scroll */
.table-scroll {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-table th,
.list-table td {
    text-align: left;
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
}

/* Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

/* Social Links */
.social-links {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

.social-links a {
    display: inline-block;
    padding: 8px 12px;
    background: rgba(100, 229, 122, 0.316);
    border-radius: 6px;
    transition: all 0.2s ease;
    color: #fff;
}

.social-links a:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Layout Split */
.layout-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
    min-width: 0;
    /* Prevent grid overflow */
}

.layout-split>div {
    min-width: 0;
    /* Allow children to shrink */
    overflow-x: hidden;
    /* Prevent horizontal overflow at container level */
    overflow-y: visible;
    /* Allow vertical content */
}

/* =========================
   PRODUCT PAGE (Nike/Uniqlo-ish)
   ========================= */
.product-page {
    display: grid;
    gap: 28px;
    padding-bottom: 40px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    /* Prevent horizontal scroll */
    box-sizing: border-box;
}

/* Mobile: Extra overflow protection - đảm bảo không có scrollbar ở cấp page, nhưng gallery có scrollbar riêng */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        /* Prevent page-level horizontal scroll */
    }

    .product-page {
        overflow-x: hidden;
        /* Prevent page-level horizontal scroll */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Cho phép gallery có scrollbar riêng - không clip scrollbar */
    .layout-split>div {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
        /* Container không scroll, chỉ gallery scroll */
        box-sizing: border-box;
    }

    /* Đảm bảo gallery có scrollbar riêng và visible */
    .media-gallery-inline {
        overflow-x: auto !important;
        /* Force scrollbar riêng */
        overflow-y: hidden;
    }
}

.product-meta {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-left: 24px;
    min-width: 0;
    /* Allow shrinking in grid */
}

.product-title {
    margin-bottom: 8px;
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.product-shortdesc {
    color: var(--muted);
    margin-top: 4px;
    margin-bottom: 8px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.product-price {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 4px;
    margin-bottom: 8px;
    color: var(--foreground);
}

.stock-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.55);
}

.badge.instock {
    color: #2e7d32;
    background-color: #e8f5e9;
    border: 2px solid #66bb6a;
}

.badge.outstock {
    color: #a12b2b;
    border-color: rgba(161, 43, 43, 0.35);
}

.product-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.product-actions .btn {
    min-width: 160px;
    padding: 12px 24px;
    font-weight: 600;
}

.btn[disabled],
button[disabled].btn {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.variant-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.variant-label {
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--foreground);
    margin-bottom: 8px;
}

.swatches {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.swatch {
    width: 76px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
    text-align: center;
}

.swatch-media {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    overflow: hidden;
    display: block;
    margin: 0 auto;
}

.swatch img,
.swatch-fallback {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.swatch-name {
    display: block;
    margin-top: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    line-height: 1.2;
    white-space: normal;
    /* cho xuống dòng nếu không đủ chỗ */
    overflow: visible;
}

.swatch.active {
    color: var(--foreground);
}

.swatch.active .swatch-media {
    border-color: var(--foreground);
    box-shadow: 0 0 0 2px rgba(21, 21, 21, 0.15);
}

.swatch.active .swatch-name {
    color: var(--foreground);
}

.swatch[aria-disabled="true"] {
    opacity: 0.4;
    cursor: not-allowed;
}

.gallery {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.gallery-thumb {
    width: 84px;
    height: 84px;
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    flex: 0 0 auto;
    cursor: pointer;
    background: #fff;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Main product image (large view) - FIXED SIZE matching 3D */
#media-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

.product-main-image {
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 15px;
    border: 1px solid var(--border);
    background: #f0f0f0;
    object-fit: contain;
    /* Prevent crop/scale */
    object-position: center;
    image-rendering: auto;
}

.gallery-thumb.active {
    border-color: var(--foreground);
    box-shadow: 0 0 0 2px rgba(21, 21, 21, 0.12);
}

.media-controls {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
    /* Prevent overflow */
    width: 100%;
    /* Full width */
    max-width: 100%;
    /* Prevent overflow */
    overflow: hidden;
    /* Prevent children from overflowing */
}

/* Desktop: buttons và gallery cùng hàng */
.media-controls .media-buttons-row {
    display: flex;
    gap: 12px;
    align-items: center;
    min-width: 0;
    flex-wrap: nowrap;
    /* Không wrap trên desktop */
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    /* Prevent overflow */
}

.media-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    /* Nút không bị co lại */
}

.btn-view-3d {
    padding: 10px 20px;
    border-radius: 999px;
    background-color: #e8f5e9;
    color: #2e7d32;
    border: 2px solid #66bb6a;
    font-weight: 600;
}

.btn-view-3d:hover {
    background-color: #c8e6c9;
    transform: translateY(-1px);
}

.btn-ar {
    padding: 10px 20px;
    border-radius: 999px;
    background-color: #2e7d32;
    color: #fff;
    border: 2px solid #2e7d32;
    font-weight: 600;
}

.btn-ar:hover {
    background-color: #1b5e20;
    transform: translateY(-1px);
}

/* Inline gallery - Desktop: bên phải nút, Mobile: trên nút */
.media-gallery-inline {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    /* Space for scrollbar */
    flex-wrap: nowrap;
    /* CRITICAL: Never wrap to multiple rows */
    min-width: 0;
    /* Allow shrinking */
    flex: 1 1 auto;
    /* Chiếm không gian còn lại trên desktop */
    max-width: 100%;
    /* Không vượt quá container */
    width: 100%;
    box-sizing: border-box;
    /* Padding không làm tràn */
    /* Enable smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    /* Custom scrollbar styling - visible scrollbar như ảnh thứ 2 */
    scrollbar-width: auto;
    /* Firefox: show scrollbar */
    scrollbar-color: #c0c0c0 #f5f5f5;
    /* Firefox: thumb and track colors */
}

/* Webkit scrollbar styling (Chrome, Safari, Edge) */
.media-gallery-inline::-webkit-scrollbar {
    height: 8px;
    /* Height of horizontal scrollbar */
}

.media-gallery-inline::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 4px;
}

.media-gallery-inline::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border-radius: 4px;
}

.media-gallery-inline::-webkit-scrollbar-thumb:hover {
    background: #a0a0a0;
}

/* Desktop: gallery nằm cùng hàng với nút, align với cạnh phải khung 3D */
.media-controls .media-buttons-row .media-gallery-inline {
    margin-top: 0;
}

.media-gallery-inline .gallery-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    flex: 0 0 52px;
    /* Fixed size, no grow/shrink */
}

.product-description {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.product-description h2 {
    font-size: 1.25rem;
    margin-bottom: 12px;
}

.product-description .desc {
    color: var(--foreground);
    max-width: 70ch;
    white-space: pre-line;
}

/* “AR” button: only show on mobile */
.ar-only-mobile {
    display: none;
}

@media (max-width: 768px) {
    .ar-only-mobile {
        display: inline-flex;
    }
}

/* 3D product viewer - FIXED HEIGHT container (CRITICAL) */
.product-media-wrapper {
    position: relative;
    width: 100%;
    height: 500px;
    /* FIXED HEIGHT - desktop */
    min-height: 500px;
    overflow: hidden;
    /* Prevent content from overflowing - required for border-radius clipping */
    border-radius: 15px;
    /* Match model-viewer border-radius */
}

/* CSS cho thẻ model-viewer trực tiếp - FIXED SIZE matching image */
#media-3d {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

model-viewer {
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 400px !important;
    display: block !important;
    background-color: #f0f0f0 !important;
    border-radius: 15px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    /* Must be hidden for border-radius to work properly */
    object-fit: contain;
    /* Ensure model fits within container without clipping */
    opacity: 1 !important;
    visibility: visible !important;
}

/* CSS cho class product-3d-viewer (backup) */
.product-3d-viewer {
    width: 100% !important;
    height: 500px !important;
    min-height: 500px !important;
    max-height: 500px !important;
    display: block !important;
    background: linear-gradient(135deg, #f3f3f7 0%, #e8e8ed 100%);
    border-radius: 15px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

/* AR Button */
.product-3d-viewer::part(default-ar-button) {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-3d-viewer::part(default-ar-button):hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Custom AR Button (fallback) */
.ar-button {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10;
}

.ar-button:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.ar-button svg {
    width: 20px;
    height: 20px;
}

/* Model Poster (loading state) */
.model-poster {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f3f3f7 0%, #e8e8ed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px;
}

.poster-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--muted);
    font-size: 0.9rem;
}

.poster-content svg {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Viewer Controls */
.viewer-controls {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 10;
}

.control-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    color: var(--foreground);
}

.control-btn:hover {
    background: #fff;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.control-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.control-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsive cho mobile */
@media (max-width: 768px) {
    .product-3d-viewer {
        height: 400px;
    }

    /* Ẩn nút AR màu xanh tròn trên mobile */
    .product-3d-viewer::part(default-ar-button) {
        display: none !important;
    }

    /* Ẩn cả custom AR button nếu có */
    .ar-button {
        display: none !important;
    }

    .viewer-controls {
        top: 12px;
        right: 12px;
    }

    .control-btn {
        width: 36px;
        height: 36px;
    }
}

/* Utilities */
.flex {
    display: flex;
    align-items: center;
    gap: 12px;
}


/* Responsive */
@media (max-width: 768px) {
    .hero {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }

    .hero p {
        margin: 0 auto;
    }

    .flex {
        justify-content: center;
    }

    .nav-links {
        display: none;
        /* Mobile menu can be added via JS */
    }

    .layout-split {
        grid-template-columns: 1fr;
    }

    .nav-actions {
        flex-wrap: wrap;
    }


}

/* Media Query cho điện thoại (màn hình nhỏ hơn 768px) */
@media (max-width: 768px) {
    .nav {
        flex-direction: column;
        /* Xếp logo và menu thành hàng dọc */
        padding: 10px;
        gap: 10px;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        /* Tự động xuống dòng nếu quá dài */
        justify-content: center;
        gap: 15px;
        font-size: 14px;
        /* Chữ nhỏ lại một chút cho vừa màn hình */
    }

    .nav-actions {
        width: 100%;
        justify-content: center;
        gap: 10px;
    }

    .nav-actions .btn {
        padding: 8px 15px;
        /* Nút nhỏ lại */
        font-size: 13px;
    }

}

@media (max-width: 768px) {
    .layout-split {
        display: flex;
        flex-direction: column;
        gap: 32px;
    }

    .product-meta {
        padding-left: 0;
    }

    /* Mobile: Fixed height for media - same as desktop */
    .product-media-wrapper {
        height: 500px;
        /* FIXED HEIGHT - mobile (same as desktop) */
        min-height: 500px;
        overflow: hidden;
        /* Must be hidden for border-radius to work properly */
    }

    model-viewer,
    .product-main-image {
        height: 100% !important;
        max-height: 100% !important;
    }

    /* Mobile: Gallery ở trên nút buttons - FIX OVERFLOW với thanh cuộn riêng */
    .media-controls {
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
        /* Cho phép scrollbar của gallery hiển thị */
        overflow-y: visible;
        box-sizing: border-box;
    }

    .media-controls .media-buttons-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
        /* Cho phép scrollbar của gallery hiển thị */
        overflow-y: visible;
        box-sizing: border-box;
    }

    .media-controls .media-buttons-row .media-gallery-inline {
        order: -1;
        /* Gallery lên trên */
        margin-top: 0;
        max-width: 100% !important;
        /* Force full width trên mobile */
        width: 100% !important;
        /* Force full width */
        flex: 1 1 100%;
        /* Full width on mobile */
        overflow-x: auto !important;
        /* Enable horizontal scroll với scrollbar visible */
        overflow-y: hidden;
        box-sizing: border-box;
        margin-left: 0;
        margin-right: 0;
        /* Scrollbar sẽ hiển thị trong container gallery */
        scrollbar-width: thin;
        /* Firefox: thin scrollbar */
        scrollbar-color: #c0c0c0 #f5f5f5;
        /* Firefox: thumb and track */
    }

    /* Mobile: Webkit scrollbar visible */
    .media-controls .media-buttons-row .media-gallery-inline::-webkit-scrollbar {
        height: 12px !important;
        /* Visible scrollbar height */
        display: block !important;
    }

    .media-controls .media-buttons-row .media-gallery-inline::-webkit-scrollbar-track {
        background: #f5f5f5 !important;
        border-radius: 6px !important;
        display: block !important;
    }

    .media-controls .media-buttons-row .media-gallery-inline::-webkit-scrollbar-thumb {
        background: #c0c0c0 !important;
        border-radius: 6px !important;
        display: block !important;
    }

    .media-controls .media-buttons-row .media-gallery-inline::-webkit-scrollbar-thumb:hover {
        background: #a0a0a0 !important;
    }

    .media-buttons {
        flex-wrap: wrap;
        /* Buttons có thể wrap trên mobile */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

@media (max-width: 768px) {
    /* Removed conflicting model-viewer height - using height: 100% from above instead */

    .product-details {
        text-align: center;
        /* Căn giữa chữ cho đẹp trên mobile */
    }

    .actions {
        flex-direction: column;
        /* Nút "Thêm giỏ hàng" và "Tùy chỉnh" xếp chồng lên nhau */
        width: 100%;
    }

    .actions .btn {
        width: 100%;
        /* Nút bấm full chiều ngang để dễ bấm bằng ngón tay */
    }
}

/* =========================
 BRAND LOGO – TRANSPARENT
 ========================= */

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand img {
    height: 90px;
    /* 🔥 TĂNG KÍCH THƯỚC LOGO DESKTOP */
    width: auto;
    display: block;
    background: transparent;
    border: none;
    border-radius: 0;
    object-fit: contain;
}

/* Hamburger Menu */
.hamburger-icon {
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 6px 2px;
    margin-left: 8px;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--foreground);
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-menu {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
}

.hamburger-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

.hamburger-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 250px;
    height: 100%;
    background: var(--background);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.1);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hamburger-item {
    padding: 12px 16px;
    text-decoration: none;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.2s;
    background: transparent;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: var(--font-sans);
}

.hamburger-item:hover {
    background: var(--border);
}

.hamburger-logout {
    color: #a11;
    border-color: #a11;
}

.hamburger-logout:hover {
    background: #a11;
    color: white;
}

/* Mobile */
@media (max-width: 768px) {
    .brand img {
        height: 70px;
        /* 🔥 LOGO MOBILE */
    }
}

/* Customize page: Khung Lựa chọn - Viền dày và màu xanh */
.customize-card {
    border-width: 3px !important;
    border-color: var(--primary) !important;
    /* Màu xanh (#188410) */
}

/* =========================
 SHIPPING & PAYMENT LAYOUT - MOBILE
 ========================= */
@media (max-width: 768px) {

    /* Shipping page mobile layout */
    .shipping-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 24px !important;
    }

    .shipping-summary-section {
        order: -1;
        /* Tóm tắt đơn hàng lên trên */
    }

    .shipping-form-section {
        order: 1;
        /* Form thông tin xuống dưới */
    }

    /* Payment page mobile layout */
    .payment-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 24px !important;
    }

    .payment-summary-section {
        order: -1;
        /* Tóm tắt đơn hàng lên trên */
    }

    .payment-form-section {
        order: 1;
        /* Form thanh toán xuống dưới */
    }

    /* Cart page mobile adjustments */
    /* Giảm cỡ chữ ghi chú sản phẩm trên mobile (chỉ các dòng ghi chú có margin-top hoặc font-size 0.9rem) */
    .cart-item .muted[style*="margin-top:4px"],
    .cart-item .muted[style*="font-size:0.9rem"] {
        font-size: 0.75rem !important;
    }

    /* Căn giữa khung Tổng cộng trên mobile */
    .cart-total-card {
        margin-left: auto !important;
        margin-right: auto !important;
        max-width: 100% !important;
    }
}