/* ===== Glasseria Catalog Styles - FULLY RESPONSIVE RTL ===== */
/* Fixed for all mobile devices including iPhone 15 Pro Max */
/* UPDATED: Modal image fix + Fullscreen Lightbox */

/* ===== CRITICAL: Prevent horizontal overflow ===== */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

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

:root {
    --primary: #1a1a1a;
    --secondary: #666;
    --light: #f5f5f5;
    --white: #fff;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --radius: 12px;
}

body {
    font-family: 'Heebo', sans-serif;
    background: var(--light);
    color: var(--primary);
    line-height: 1.6;
    direction: rtl;
    overflow-x: hidden;
    width: 100%;
    min-height: 100vh;
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== Header - RTL FIXED ===== */
.header {
    background: var(--white);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.header .container {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    gap: 10px;
}

/* Logo on LEFT side */
.logo {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--primary);
    flex-shrink: 0;
}

.logo img {
    height: 40px;
    width: auto;
    max-width: 50px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 2px;
    white-space: nowrap;
}

/* Nav in center/right */
.nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 10px 18px;
    text-decoration: none;
    color: var(--secondary);
    font-weight: 500;
    border-radius: 25px;
    transition: all 0.3s;
    white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
    background: var(--primary);
    color: var(--white);
}

/* About link in nav */
.nav-about {
    border: 1px solid #ddd;
}

.nav-about:hover {
    border-color: var(--primary);
}

/* Mobile Menu Button - RIGHT side */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 5px;
    padding: 10px;
    background: none;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    order: 1;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--primary);
    transition: all 0.3s;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    flex-direction: column;
    background: var(--white);
    padding: 15px 20px;
    gap: 10px;
    border-top: 1px solid #eee;
    width: 100%;
}

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

.mobile-nav .nav-link {
    display: block;
    text-align: center;
    padding: 12px;
}

/* ===== Hero ===== */
.hero {
    background: var(--primary);
    color: var(--white);
    padding: 40px 20px;
    text-align: center;
    width: 100%;
}

.hero h1 {
    font-size: clamp(24px, 6vw, 42px);
    margin-bottom: 10px;
    line-height: 1.3;
}

.hero p {
    font-size: clamp(14px, 3.5vw, 18px);
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
}

/* ===== Sections ===== */
.categories-section,
.subcategories-section,
.products-section {
    padding: 30px 0;
    width: 100%;
}

.subcategories-section {
    background: var(--white);
}

/* ===== Section Header ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.section-header h2 {
    font-size: clamp(20px, 5vw, 28px);
    flex-shrink: 0;
}

.products-count {
    color: var(--secondary);
    font-size: 14px;
}

#products-sentinel {
    grid-column: 1 / -1;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--light);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    transition: background 0.3s;
}

.back-btn:hover {
    background: #e0e0e0;
}

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

/* ===== Grids ===== */
.categories-grid,
.subcategories-grid,
.products-grid {
    display: grid;
    gap: 16px;
    width: 100%;
}

.categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.subcategories-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.products-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* ===== Category Card ===== */
.category-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: var(--shadow);
    width: 100%;
}

.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
}

.category-image {
    aspect-ratio: 16/10;
    overflow: hidden;
    width: 100%;
}

.category-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

.category-info {
    padding: 16px;
    text-align: center;
}

.category-info h3 {
    font-size: 18px;
    margin-bottom: 6px;
}

.category-count {
    color: var(--secondary);
    font-size: 13px;
}

/* ===== Subcategory Card ===== */
.subcategory-card {
    background: var(--light);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    width: 100%;
}

.subcategory-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.subcategory-image {
    aspect-ratio: 4/3;
    overflow: hidden;
    width: 100%;
}

.subcategory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.subcategory-card.all-in-category .subcategory-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
}

.all-icon {
    width: 50px;
    height: 50px;
    color: var(--white);
}

.all-icon svg {
    width: 100%;
    height: 100%;
}

.subcategory-info {
    padding: 14px;
    text-align: center;
}

.subcategory-info h3 {
    font-size: 15px;
    margin-bottom: 4px;
}

.subcategory-count {
    color: var(--secondary);
    font-size: 12px;
}

/* ===== Product Card ===== */
.product-card {
    background: var(--white);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    cursor: pointer;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
}

/* ===== Product Image Carousel ===== */
.product-image {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    background: var(--white);
    width: 100%;
}

.product-image-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
    direction: ltr; /* Force LTR for consistent transform behavior */
}

.product-image-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}

.product-image-slide img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    padding: 10px;
}

/* Carousel Arrows - Desktop */
.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 5;
    transition: all 0.3s;
}

.carousel-arrow:hover {
    background: var(--white);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.carousel-arrow svg {
    width: 16px;
    height: 16px;
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
}

.carousel-arrow.prev {
    right: 8px;
}

.carousel-arrow.next {
    left: 8px;
}

.product-image.has-multiple .carousel-arrow {
    display: flex;
}

/* Carousel Dots */
.carousel-dots {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 6px;
    z-index: 5;
    direction: ltr;
}

/* On desktop (non-touch), flip dots to match RTL arrow direction */
@media (hover: hover) and (pointer: fine) {
    .carousel-dots {
        direction: rtl;
    }
}

.product-image.has-multiple .carousel-dots {
    display: flex;
}

.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

/* Invisible touch area around small dot */
.carousel-dot::before {
    content: '';
    position: absolute;
    top: -19px;
    left: -10px;
    right: -10px;
    bottom: -19px;
}

.carousel-dot.active {
    background: var(--primary);
    width: 18px;
    border-radius: 3px;
}

/* Favorite Button */
.favorite-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transition: all 0.3s;
    z-index: 6;
}

.favorite-btn svg {
    width: 20px;
    height: 20px;
    fill: #ddd;
    transition: fill 0.3s;
}

.favorite-btn:hover svg,
.favorite-btn.active svg {
    fill: #e74c3c;
}

.product-info {
    padding: 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-price {
    margin-top: auto;
}

.product-name {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-sku {
    color: var(--secondary);
    font-size: 12px;
    margin-bottom: 4px;
}

.product-type {
    color: var(--secondary);
    font-size: 12px;
    margin-bottom: 8px;
}

.product-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
}

.quote-text {
    color: #2e7d32;
    font-weight: 700;
}

/* ===== Product Modal - FIXED FOR MOBILE ===== */
.product-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 15px;
    overflow-y: auto;
}

.product-modal-overlay.active {
    display: flex;
}

.product-modal {
    background: var(--white);
    border-radius: var(--radius);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    margin: auto;
}

.product-modal .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    z-index: 10;
}

.product-modal .modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-product {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

/* Modal Image - FIXED */
.modal-product-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--white);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-in;
}

.modal-image-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    transition: transform 0.3s ease;
    direction: ltr; /* Force LTR for consistent transform behavior */
}

.modal-image-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
}

.modal-image-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

/* Modal Carousel Arrows */
.modal-carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.95);
    border: none;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    z-index: 5;
    transition: all 0.3s;
}

.modal-carousel-arrow:hover {
    background: var(--white);
    box-shadow: 0 4px 15px rgba(0,0,0,0.25);
}

.modal-carousel-arrow svg {
    width: 20px;
    height: 20px;
    stroke: var(--primary);
    stroke-width: 2;
    fill: none;
}

.modal-carousel-arrow.prev {
    right: 12px;
}

.modal-carousel-arrow.next {
    left: 12px;
}

.modal-product-image.has-multiple .modal-carousel-arrow {
    display: flex;
}

/* Modal Carousel Dots */
.modal-carousel-dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    gap: 8px;
    z-index: 5;
    background: rgba(255,255,255,0.8);
    padding: 6px 12px;
    border-radius: 20px;
    direction: ltr;
}

@media (hover: hover) and (pointer: fine) {
    .modal-carousel-dots {
        direction: rtl;
    }
}
}

.modal-product-image.has-multiple .modal-carousel-dots {
    display: flex;
}

.modal-carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0,0,0,0.3);
    border: none;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

/* Invisible touch area around small dot */
.modal-carousel-dot::before {
    content: '';
    position: absolute;
    top: -18px;
    left: -10px;
    right: -10px;
    bottom: -18px;
}

.modal-carousel-dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}

.modal-product-info {
    padding: 24px;
}

.modal-product-category {
    color: var(--secondary);
    font-size: 12px;
    margin-bottom: 6px;
}

.modal-product-name {
    font-size: 24px;
    margin-bottom: 10px;
    line-height: 1.3;
}

.modal-product-sku {
    color: var(--secondary);
    font-size: 13px;
    margin-bottom: 6px;
}

.modal-product-type {
    color: var(--secondary);
    font-size: 13px;
    margin-bottom: 14px;
}

.modal-product-description {
    font-size: 14px;
    line-height: 1.7;
    margin-bottom: 18px;
    color: #444;
}

.modal-product-price {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
}

.modal-product-sizes,
.modal-product-colors {
    margin-bottom: 14px;
}

.modal-product-sizes strong,
.modal-product-colors strong {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
}

.size-options,
.color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.size-option,
.color-option {
    padding: 6px 12px;
    background: var(--light);
    border-radius: 6px;
    font-size: 12px;
}

.size-option.has-price,
.color-option.has-price {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.size-option.has-price:hover,
.color-option.has-price:hover {
    background: #e3f2fd;
    border-color: var(--primary);
}

.size-option.has-price.active,
.color-option.has-price.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.price-prefix {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.7;
}

.price-hint {
    font-size: 14px;
    font-weight: 400;
    color: #e53935;
}

.modal-favorite-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    margin-top: 16px;
    font-family: inherit;
}

.modal-favorite-btn svg {
    width: 18px;
    height: 18px;
    fill: var(--white);
}

.modal-favorite-btn.active {
    background: #e74c3c;
}

/* ===== Fullscreen Image Lightbox ===== */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
}

.image-lightbox.active {
    display: flex;
}

.image-lightbox img {
    max-width: 95%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 4px;
    transition: opacity 0.15s ease;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255,255,255,0.25);
}

.lightbox-close svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2;
}

/* Lightbox Navigation Arrows */
.lightbox-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    z-index: 10;
}

.lightbox-arrow:hover {
    background: rgba(255,255,255,0.25);
}

.lightbox-arrow svg {
    width: 24px;
    height: 24px;
    stroke: white;
    stroke-width: 2;
    fill: none;
}

.lightbox-arrow.prev {
    right: 20px;
}

.lightbox-arrow.next {
    left: 20px;
}

/* Lightbox Counter */
.lightbox-counter {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    padding: 8px 16px;
    border-radius: 20px;
    z-index: 10;
    direction: ltr; /* Keep counter in LTR format: "1 / 3" */
}

/* ===== Favorites Panel ===== */
.favorites-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 90;
    transition: transform 0.3s;
}

.favorites-btn:hover {
    transform: scale(1.1);
}

.favorites-btn .heart-icon {
    width: 26px;
    height: 26px;
}

.favorites-count {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 22px;
    height: 22px;
    background: #e74c3c;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorites-panel {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    height: 100%;
    background: var(--white);
    z-index: 200;
    box-shadow: -2px 0 20px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.favorites-panel.active {
    right: 0;
}

.favorites-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.favorites-header h3 {
    font-size: 18px;
}

.close-panel {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--light);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-panel svg {
    width: 18px;
    height: 18px;
}

.favorites-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.favorite-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #eee;
}

.favorite-item-image {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light);
}

.favorite-item-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.favorite-item-info {
    flex: 1;
    min-width: 0;
}

.favorite-item-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.favorite-item-sku {
    color: var(--secondary);
    font-size: 12px;
}

.favorite-item-price {
    font-weight: 700;
    margin-top: 4px;
    font-size: 15px;
}

.favorite-item-remove {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--light);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    align-self: center;
}

.favorite-item-remove svg {
    width: 14px;
    height: 14px;
}

.favorites-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--secondary);
    padding: 40px 20px;
    text-align: center;
}

.favorites-empty svg {
    width: 60px;
    height: 60px;
    margin-bottom: 14px;
    opacity: 0.3;
}

.favorites-actions {
    padding: 16px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

.btn-clear {
    padding: 12px 16px;
    background: var(--light);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 14px;
}

.btn-whatsapp {
    flex: 1;
    padding: 12px 16px;
    background: #25D366;
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-whatsapp svg {
    width: 18px;
    height: 18px;
}

/* ===== Overlay ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

/* ===== Loading with Logo Animation (Mobile First) ===== */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    z-index: 9999;
    text-align: center;
    padding: 40px 16px 30px;
    color: var(--secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.loading-logo-animation {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.loading-logo-spin {
    width: 56px;
    height: 56px;
    animation: logoSpin 2.5s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.12));
}

.loading-brand-name {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 5px;
    color: var(--primary);
    opacity: 0;
    animation: brandFadeIn 1s ease-out 0.3s forwards, brandPulse 2.5s ease-in-out 1.3s infinite;
}

.loading-progress {
    width: 140px;
    height: 2px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 14px;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--primary);
    border-radius: 3px;
    animation: progressSlide 2s ease-in-out infinite;
}

.loading-slogan {
    font-size: 13px;
    color: var(--secondary);
    margin: 0;
    letter-spacing: 0.3px;
    opacity: 0;
    animation: sloganFadeIn 1s ease-out 2s forwards;
}

.loading.fade-out {
    opacity: 0;
    transition: opacity 0.4s ease;
}

/* Desktop enhancements */
@media (min-width: 769px) {
    .loading {
        padding: 60px 20px 40px;
    }
    .loading-logo-spin {
        width: 70px;
        height: 70px;
    }
    .loading-brand-name {
        font-size: 24px;
        letter-spacing: 6px;
    }
    .loading-progress {
        width: 180px;
        height: 3px;
    }
    .loading-slogan {
        font-size: 15px;
        letter-spacing: 0.5px;
    }
}

@keyframes logoSpin {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(180deg); }
    100% { transform: rotateY(360deg); }
}

@keyframes brandFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes brandPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes progressSlide {
    0% { width: 0%; margin-right: 0; margin-left: auto; }
    50% { width: 70%; margin-right: 0; margin-left: 0; }
    100% { width: 0%; margin-right: auto; margin-left: 0; }
}

@keyframes sloganFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 0.7; transform: translateY(0); }
}

/* Old spinner kept for backwards compat */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #eee;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== No Products ===== */
.no-products {
    text-align: center;
    padding: 50px 20px;
    color: var(--secondary);
}

/* ===== Footer ===== */
.footer {
    background: var(--primary);
    color: var(--white);
    text-align: center;
    padding: 24px 20px;
    margin-top: 40px;
    font-size: 14px;
    width: 100%;
}

.built-by {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.2);
    font-size: 13px;
}

.built-by a {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: color 0.3s;
}

.built-by a:hover {
    color: #fff;
}

/* ===== Welcome Popup ===== */
.welcome-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
}

.welcome-popup-overlay.active {
    display: flex;
}

.welcome-popup {
    background: var(--white);
    border-radius: var(--radius);
    padding: 30px 24px;
    width: 100%;
    max-width: 450px;
    text-align: center;
    margin: auto;
}

.welcome-icon {
    width: 70px;
    height: 70px;
    background: var(--light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.welcome-icon svg {
    width: 35px;
    height: 35px;
    stroke: #e74c3c;
}

.welcome-popup h2 {
    font-size: 20px;
    margin-bottom: 6px;
}

.welcome-brand {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 24px;
}

.welcome-steps {
    text-align: right;
    margin-bottom: 24px;
}

.welcome-step {
    display: flex;
    gap: 14px;
    margin-bottom: 14px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content strong {
    display: block;
    margin-bottom: 2px;
    font-size: 14px;
}

.step-content p {
    color: var(--secondary);
    font-size: 13px;
}

.step-arrow {
    text-align: center;
    margin: 6px 0;
}

.step-arrow svg {
    width: 20px;
    height: 20px;
    stroke: #ccc;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(5px); }
}

.welcome-btn {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: 14px;
}

.welcome-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--secondary);
    font-size: 13px;
    cursor: pointer;
}

.welcome-checkbox input {
    width: 16px;
    height: 16px;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* ===== TABLET (max 992px) ===== */
@media (max-width: 992px) {
    .nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .modal-product {
        grid-template-columns: 1fr;
    }
    
    .modal-product-image {
        aspect-ratio: 4/3;
        max-height: 350px;
    }
    
    .modal-product-info {
        padding: 20px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== MOBILE (max 768px) ===== */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header .container {
        height: 60px;
    }
    
    .logo img {
        height: 36px;
    }
    
    .logo-text {
        font-size: 18px;
        letter-spacing: 1px;
    }
    
    .hero {
        padding: 30px 16px;
    }
    
    .categories-section,
    .products-section,
    .subcategories-section {
        padding: 20px 0;
    }
    
    .section-header {
        margin-bottom: 16px;
    }
    
    /* 2 columns on mobile */
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .subcategories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    /* Cards */
    .product-card,
    .category-card,
    .subcategory-card {
        border-radius: 10px;
    }
    
    .product-image-slide img {
        padding: 8px;
    }
    
    .favorite-btn {
        width: 32px;
        height: 32px;
        top: 8px;
        right: 8px;
    }
    
    .favorite-btn svg {
        width: 16px;
        height: 16px;
    }
    
    /* Hide arrows on mobile - use swipe */
    .carousel-arrow {
        display: none !important;
    }
    
    .carousel-dots {
        bottom: 6px;
    }
    
    .carousel-dot {
        width: 5px;
        height: 5px;
    }
    
    .carousel-dot.active {
        width: 14px;
    }
    
    .product-info {
        padding: 10px;
    }
    
    .product-name {
        font-size: 13px;
        margin-bottom: 4px;
    }
    
    .product-sku,
    .product-type {
        font-size: 11px;
    }
    
    .product-price {
        font-size: 15px;
    }
    
    .category-info {
        padding: 12px;
    }
    
    .category-info h3 {
        font-size: 14px;
    }
    
    .category-count {
        font-size: 11px;
    }
    
    .subcategory-info {
        padding: 10px;
    }
    
    .subcategory-info h3 {
        font-size: 13px;
    }
    
    /* ===== Modal Mobile - FIXED ===== */
    .product-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    
    .product-modal {
        max-height: 95vh;
        border-radius: 16px 16px 0 0;
    }
    
    .modal-product-image {
        aspect-ratio: auto;
        height: 280px;
        max-height: 40vh;
        background: var(--white);
    }
    
    .modal-image-slide {
        background: var(--white);
        padding: 10px;
    }
    
    .modal-image-slide img {
        max-width: 100%;
        max-height: 100%;
        width: auto;
        height: auto;
        object-fit: contain;
        border-radius: 8px;
    }
    
    /* Hide modal arrows on mobile */
    .modal-carousel-arrow {
        display: none !important;
    }
    
    .modal-carousel-dots {
        bottom: 10px;
        background: rgba(255,255,255,0.9);
        padding: 4px 10px;
    }
    
    .modal-product-info {
        padding: 16px;
    }
    
    .modal-product-name {
        font-size: 20px;
    }
    
    .modal-product-price {
        font-size: 24px;
    }
    
    /* Lightbox Mobile */
    .lightbox-close {
        top: 15px;
        right: 15px;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-close svg {
        width: 20px;
        height: 20px;
    }
    
     /* ×”×¡×ª×¨×ª ×”×—×¦×™× ×‘×ž×•×‘×™×™×œ */
    .lightbox-arrow {
        display: none !important;
    }
    
    .lightbox-arrow svg {
        width: 20px;
        height: 20px;
    }
    
    .lightbox-arrow.prev {
        right: 10px;
    }
    
    .lightbox-arrow.next {
        left: 10px;
    }
    
    .lightbox-counter {
        bottom: 15px;
        font-size: 13px;
        padding: 6px 14px;
    }
    
    /* Favorites */
    .favorites-btn {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
    }
    
    .favorites-btn .heart-icon {
        width: 22px;
        height: 22px;
    }
    
    .favorites-panel {
        max-width: 100%;
    }
    
    /* Footer */
    .footer {
        padding: 20px 16px;
        margin-top: 30px;
        font-size: 13px;
    }
    
    /* Welcome Popup */
    .welcome-popup-overlay {
        padding: 16px;
    }
    
    .welcome-popup {
        padding: 24px 20px;
    }
    
    .welcome-brand {
        font-size: 24px;
    }
}

/* ===== SMALL MOBILE (max 400px) ===== */
@media (max-width: 400px) {
    .container {
        padding: 0 12px;
    }
    
    .logo-text {
        font-size: 16px;
    }
    
    .logo img {
        height: 32px;
    }
    
    .hero {
        padding: 24px 12px;
    }
    
    .products-grid,
    .categories-grid,
    .subcategories-grid {
        gap: 10px;
    }
    
    .product-info,
    .category-info,
    .subcategory-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 12px;
    }
    
    .product-price {
        font-size: 14px;
    }
    
    .category-info h3 {
        font-size: 13px;
    }
    
    .subcategory-info h3 {
        font-size: 12px;
    }
    
    .favorite-btn {
        width: 28px;
        height: 28px;
        top: 6px;
        right: 6px;
    }
    
    .favorite-btn svg {
        width: 14px;
        height: 14px;
    }
    
    /* Modal on small screens */
    .modal-product-image {
        height: 240px;
        max-height: 35vh;
    }
    
    /* Lightbox on small screens */
    .lightbox-arrow {
        width: 38px;
        height: 38px;
    }
    
    .lightbox-arrow svg {
        width: 18px;
        height: 18px;
    }
}

/* ===== iPhone Safe Areas ===== */
@supports (padding: max(0px)) {
    body {
        padding-top: env(safe-area-inset-top);
    }
    
    .header {
        padding-top: env(safe-area-inset-top);
    }
    
    .favorites-btn {
        bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px));
        right: max(20px, env(safe-area-inset-right));
    }
    
    .favorites-panel {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .footer {
        padding-bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px));
    }
    
    .product-modal {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .welcome-popup-overlay {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    /* Lightbox Safe Areas */
    .lightbox-close {
        top: max(20px, calc(env(safe-area-inset-top) + 10px));
        right: max(20px, env(safe-area-inset-right));
    }
    
    .lightbox-counter {
        bottom: max(20px, calc(env(safe-area-inset-bottom) + 10px));
    }
    
    .lightbox-arrow.prev {
        right: max(20px, env(safe-area-inset-right));
    }
    
    .lightbox-arrow.next {
        left: max(20px, env(safe-area-inset-left));
    }
}

/* ===== Prevent Image Overflow ===== */
img {
    max-width: 100%;
    height: auto;
}

/* ===== Touch Improvements ===== */
@media (hover: none) and (pointer: coarse) {
    .product-card:hover,
    .category-card:hover,
    .subcategory-card:hover {
        transform: none;
    }
    
    .product-card:active,
    .category-card:active,
    .subcategory-card:active {
        transform: scale(0.98);
    }
    
    .favorite-btn:hover svg {
        fill: #ddd;
    }
    
    .favorite-btn.active svg,
    .favorite-btn:active svg {
        fill: #e74c3c;
    }
    
    /* Enable touch swipe */
    .product-image-carousel,
    .modal-image-carousel {
        scroll-snap-type: x mandatory;
        overflow-x: auto;
        scrollbar-width: none;
        -ms-overflow-style: none;
        transition: none; /* Disable transform transition - using native scroll on touch */
        transform: none !important; /* Prevent transform from interfering with scroll-snap */
    }
    
    .product-image-carousel::-webkit-scrollbar,
    .modal-image-carousel::-webkit-scrollbar {
        display: none;
    }
    
    .product-image-slide,
    .modal-image-slide {
        scroll-snap-align: start;
    }
}

/* ===== Selection Modal for Size & Color ===== */
.selection-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1500;
    padding: 20px;
}

.selection-modal-overlay.active {
    display: flex;
}

.selection-modal {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.selection-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--light);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.3s;
}

.selection-modal-close:hover {
    background: #ddd;
}

.selection-modal-close svg {
    width: 18px;
    height: 18px;
}

.selection-modal-header {
    display: flex;
    gap: 14px;
    padding: 20px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.selection-modal-image {
    width: 70px;
    height: 70px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--light);
}

.selection-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.selection-modal-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
    line-height: 1.3;
}

.selection-modal-info p {
    color: var(--secondary);
    font-size: 13px;
}

.selection-modal-body {
    padding: 20px;
}

.selection-group {
    margin-bottom: 20px;
}

.selection-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
}

.selection-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.selection-option {
    padding: 10px 16px;
    background: var(--light);
    border: 2px solid transparent;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.selection-option:hover {
    background: #e8e8e8;
}

.selection-option.selected {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.selection-note {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #fff8e1;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
}

.selection-modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
}

.btn-add-favorite {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background 0.3s;
}

.btn-add-favorite:hover {
    background: #333;
}

.btn-add-favorite svg {
    width: 20px;
    height: 20px;
    fill: var(--white);
}

/* Favorite Item Selection Tag */
.favorite-item-selection {
    display: inline-block;
    padding: 4px 8px;
    background: #e3f2fd;
    color: #1565c0;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 4px;
    font-weight: 500;
}

/* ===== Selection Modal Mobile ===== */
@media (max-width: 768px) {
    .selection-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }
    
    .selection-modal {
        max-height: 85vh;
        border-radius: 20px 20px 0 0;
        animation: slideUpMobile 0.3s ease;
    }
    
    @keyframes slideUpMobile {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .selection-modal-header {
        padding: 16px;
    }
    
    .selection-modal-body {
        padding: 16px;
    }
    
    .selection-modal-footer {
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }
    
    .selection-option {
        padding: 12px 16px;
    }
}
