html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    height: 100%;
    margin: 0;
}

@media print {
    body * { visibility: hidden !important; }
    #invoice-overlay, #invoice-overlay * { visibility: visible !important; }
    #invoice-card, #invoice-card * { visibility: visible !important; }
    #invoice-card { position: fixed; left: 50% !important; top: 0 !important; transform: translateX(-50%) !important; width: 100% !important; max-width: 500px !important; box-shadow: none !important; border: none !important; z-index: 9999 !important; }
    .print-hide { display: none !important; visibility: hidden !important; }
}

* {
    box-sizing: border-box;
}

/* Touch-friendly: remove tap highlight on Android/iOS */
a, button, input, select, textarea {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent double-tap zoom on interactive elements (iOS/Android) */
button, a {
    touch-action: manipulation;
}

/* Fix iOS input zoom — font-size >= 16px prevents auto-zoom */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
select,
textarea {
    font-size: 16px !important;
}

/* Search input: smaller on desktop only */
#search-input {
    font-size: 14px !important;
}
@media (max-width: 767px) {
    #search-input {
        font-size: 16px !important;
    }
}

/* Smooth touch scrolling globally */
* {
    -webkit-overflow-scrolling: touch;
}

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

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

::-webkit-scrollbar-thumb {
    background: #d4af37;
    border-radius: 3px;
}

.tile-pattern {
    background-image: repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(168, 137, 106, 0.03) 35px, rgba(168, 137, 106, 0.03) 70px);
}

/* =====================================================
   LUXURY NAVIGATION
   ===================================================== */
.top-navbar {
    background: #FFFFFF;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    /* iOS notch safe area */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.dark .top-navbar {
    background: #0f0f0f;
    border-bottom-color: rgba(212, 175, 55, 0.15);
}

.top-navbar.scrolled {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.top-navbar.dark.scrolled {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.gold-accent { color: #d4af37; }
.gold-border { border-color: #d4af37; }
.gold-bg { background: #d4af37; }
.gold-glow { box-shadow: 0 0 12px rgba(212, 175, 55, 0.3); }

.search-bar {
    background: #f8f8f8;
    border: 1.5px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
}

.search-bar:focus-within {
    border-color: #d4af37;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.15);
}

.dark .search-bar {
    background: #1a1a1a;
    border-color: rgba(212, 175, 55, 0.2);
}

.dark .search-bar:focus-within {
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.25);
}

.filter-navbar {
    background: #FFFFFF;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d4af37 transparent;
    transition: background 0.3s ease;
    position: sticky;
    top: 80px;
    z-index: 40;
}

.dark .filter-navbar {
    background: #1a1a1a;
    border-bottom-color: rgba(212, 175, 55, 0.15);
}

.filter-item {
    white-space: nowrap;
    padding: 12px 20px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
}

.dark .filter-item { color: #ffffff; }

.filter-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    background: #d4af37;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.3s ease;
}

.filter-item:hover { color: #d4af37; }
.filter-item:hover::after { transform: scaleX(1); }

/* =====================================================
   CATEGORY SECTION
   ===================================================== */
.category-section {
    background: #FFFFFF;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    padding: 16px 0;
    transition: background 0.3s ease;
}

.dark .category-section {
    background: #1a1a1a;
    border-bottom-color: rgba(212, 175, 55, 0.15);
}

.category-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.category-circle-inner {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f0f0f0 0%, #e8e8e8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(212, 175, 55, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.dark .category-circle-inner {
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
}

.category-circle:hover .category-circle-inner {
    border-color: #d4af37;
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.3);
    transform: scale(1.05);
}

.category-label {
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    color: #333;
    transition: color 0.3s ease;
}

.dark .category-label { color: #ffffff; }
.category-circle:hover .category-label { color: #d4af37; }

/* =====================================================
   ICON BUTTONS / BADGES
   ===================================================== */
.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    cursor: pointer;
    color: #333;
}

.dark .icon-btn { color: #ffffff; }
.icon-btn:hover {
    background: rgba(212, 175, 55, 0.1);
    color: #d4af37;
}

.premium-btn {
    padding: 10px 24px;
    border: 2px solid #d4af37;
    background: transparent;
    color: #d4af37;
    border-radius: 24px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.premium-btn:hover {
    background: #d4af37;
    color: #FFFFFF;
    box-shadow: 0 8px 24px rgba(212, 175, 55, 0.3);
}

.badge-counter {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    background: #d4af37;
    color: #FFFFFF;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-pop {
    animation: badgePop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badgePop {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

@keyframes slideRight {
    from { opacity: 0; transform: translateX(-30px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.9); }
    to   { opacity: 1; transform: scale(1); }
}

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

.slide-down   { animation: slideDown  0.5s ease forwards; }
.anim-fade-up { animation: fadeUp     0.7s ease forwards; }
.anim-fade-in { animation: fadeIn     0.5s ease forwards; }
.anim-slide-right { animation: slideRight 0.6s ease forwards; }
.anim-scale-in    { animation: scaleIn    0.5s ease forwards; }

.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
.delay-5 { animation-delay: 0.5s; opacity: 0; }
.delay-6 { animation-delay: 0.6s; opacity: 0; }
.delay-7 { animation-delay: 0.7s; opacity: 0; }
.delay-8 { animation-delay: 0.8s; opacity: 0; }

.gold-shimmer {
    background: linear-gradient(90deg, #a8896a, #d4b896, #a8896a);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.card-hover { transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
.card-hover:hover { transform: translateY(-8px); }

.glass {
    background: rgba(255, 255, 255, 0.03);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(168, 137, 106, 0.15);
}
.dark .glass { background: rgba(0, 0, 0, 0.3); }

.toast-enter { animation: fadeUp 0.3s ease forwards; }
.toast-exit  { animation: fadeIn 0.3s ease reverse forwards; }

/* =====================================================
   SCROLL REVEAL
   ===================================================== */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}
.reveal.active { opacity: 1; transform: translateY(0); }

.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}
.reveal-left.active { opacity: 1; transform: translateX(0); }

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}
.reveal-right.active { opacity: 1; transform: translateX(0); }

.reveal-fade {
    opacity: 0;
    transition: opacity 1.2s ease-out;
}
.reveal-fade.active { opacity: 1; }

.reveal-stagger > * {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.2, 1, 0.3, 1);
}
.reveal-stagger.active > * { opacity: 1; transform: translateY(0); }
.reveal-stagger.active > *:nth-child(1) { transition-delay: 0.1s; }
.reveal-stagger.active > *:nth-child(2) { transition-delay: 0.2s; }
.reveal-stagger.active > *:nth-child(3) { transition-delay: 0.3s; }
.reveal-stagger.active > *:nth-child(4) { transition-delay: 0.4s; }
.reveal-stagger.active > *:nth-child(5) { transition-delay: 0.5s; }
.reveal-stagger.active > *:nth-child(6) { transition-delay: 0.6s; }
.reveal-stagger.active > *:nth-child(7) { transition-delay: 0.7s; }
.reveal-stagger.active > *:nth-child(8) { transition-delay: 0.8s; }

/* =====================================================
   BACK TO TOP / NAVBAR SCROLL EFFECTS
   ===================================================== */
.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* iOS safe area: position floating button clear of bottom bar */
.back-to-top {
    bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    right: calc(2rem + env(safe-area-inset-right, 0px));
}

#navbar, #filter-navbar {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.4s ease,
                box-shadow 0.4s ease;
}

.navbar-hidden { transform: translateY(-100%) !important; }

.navbar-scrolled {
    background-color: rgba(255, 255, 255, 0.9) !important;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.dark .navbar-scrolled {
    background-color: rgba(15, 13, 10, 0.9) !important;
}

.navbar-hidden + #filter-navbar {
    transform: translateY(-74px) !important;
}

/* =====================================================
   VISUALIZER
   ===================================================== */
.visualizer-room {
    background: linear-gradient(180deg, #f5f0eb 0%, #e8e0d8 100%);
    position: relative;
}
.visualizer-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    perspective: 500px;
}
.visualizer-floor-inner {
    width: 100%;
    height: 100%;
    transform: rotateX(45deg);
    transform-origin: bottom center;
}

/* =====================================================
   NO-SCROLLBAR UTILITY
   ===================================================== */
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.no-scrollbar::-webkit-scrollbar { display: none; }

/* =====================================================
   MOBILE HAMBURGER MENU
   ===================================================== */
.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    padding: 8px;
    cursor: pointer;
    background: none;
    border: none;
    border-radius: 50%;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.hamburger-btn:hover,
.hamburger-btn:focus {
    background: rgba(212, 175, 55, 0.1);
    outline: none;
}
.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: #333;
    border-radius: 2px;
    transition: all 0.35s cubic-bezier(0.23, 1, 0.32, 1);
    transform-origin: center;
}
.dark .hamburger-btn span { background: #fff; }
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile nav drawer overlay */
.mobile-menu {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 300;
    pointer-events: none;
}
.mobile-menu-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.35s ease;
}
.mobile-menu-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: min(340px, 85vw);
    height: 100%;
    background: #fff;
    box-shadow: -8px 0 40px rgba(0,0,0,0.15);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    /* Account for iPhone X+ notch */
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 20px);
}
.dark .mobile-menu-drawer { background: #0f0d0a; }
.mobile-menu.open { pointer-events: all; }
.mobile-menu.open .mobile-menu-overlay { opacity: 1; }
.mobile-menu.open .mobile-menu-drawer { transform: translateX(0); }

/* Drawer header */
.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

/* Drawer nav links */
.mobile-menu-nav { flex: 1; padding: 12px 0; }
.mobile-menu-nav a,
.mobile-menu-nav button {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 500;
    color: #1a1510;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}
.dark .mobile-menu-nav a,
.dark .mobile-menu-nav button { color: #fff; }
.mobile-menu-nav a:hover,
.mobile-menu-nav button:hover {
    background: rgba(212, 175, 55, 0.08);
    color: #d4af37;
    padding-left: 30px;
}

/* Drawer footer (auth buttons, phone) */
.mobile-menu-footer {
    padding: 20px 24px;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

/* --- Mobile: max 767px --- */
@media (max-width: 767px) {

    /* Show hamburger */
    .hamburger-btn { display: flex; }

    /* Hide desktop nav links (sign in button stays) */
    .hidden-mobile-nav { display: none !important; }

    /* Category section show on mobile */
    .category-section {
        display: block !important;
        margin-top: 62px !important;
    }

    /* Filter navbar hidden on mobile (hamburger replaces it) */
    #filter-navbar { display: none !important; }

    /* Category circles tighter on mobile */
    .category-circle-inner { width: 62px; height: 62px; }
    .category-label { font-size: 10px; }

    /* Back to top: smaller & inset on mobile */
    .back-to-top {
        width: 44px;
        height: 44px;
        right: calc(1rem + env(safe-area-inset-right, 0px));
        bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    }

    /* Responsive display headings */
    .font-display.text-5xl,
    .font-display.text-4xl {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }
    .font-display.text-3xl {
        font-size: 1.4rem !important;
        line-height: 1.3 !important;
    }

    /* Simplify directional reveal to vertical on mobile (better performance) */
    .reveal-left,
    .reveal-right {
        transform: translateY(20px);
    }
    .reveal-left.active,
    .reveal-right.active {
        transform: translateY(0);
    }

    /* Google map shorter on mobile */
    iframe[src*="google.com/maps"],
    iframe[src*="maps.google"] {
        height: 260px !important;
    }

    /* Auth modal slides up from bottom on mobile */
    #auth-modal {
        align-items: flex-end !important;
    }
    #auth-modal .relative.bg-white {
        border-radius: 1.5rem 1.5rem 0 0 !important;
        max-width: 100% !important;
        width: 100% !important;
        max-height: 90dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Shop / Cart page top padding for mobile category bar */
    #page-shop,
    #page-cart {
        padding-top: 120px !important;
    }
    #page-home {
        padding-top: 0 !important;
    }

    /* Reduce heavy vertical padding on mobile content sections */
    .py-24 { padding-top: 3rem !important; padding-bottom: 3rem !important; }
    .py-20 { padding-top: 2.5rem !important; padding-bottom: 2.5rem !important; }
    .py-16 { padding-top: 2rem !important; padding-bottom: 2rem !important; }
    .gap-16 { gap: 2rem !important; }
    .gap-12 { gap: 1.5rem !important; }

    /* Cart summary full width on mobile */
    .lg\:w-\[400px\] { width: 100% !important; }
}

/* --- Small phones: max 480px --- */
@media (max-width: 480px) {
    .category-circle-inner { width: 56px; height: 56px; }
    .category-label { font-size: 10px; }

    /* Compact navbar inner padding */
    nav.top-navbar .max-w-7xl {
        padding-left: 12px !important;
        padding-right: 12px !important;
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }

    /* Sign in button very compact */
    #auth-nav-container button {
        padding: 5px 10px !important;
        font-size: 11px !important;
    }
}

/* --- Tablet: 768px–1023px --- */
@media (min-width: 768px) and (max-width: 1023px) {
    .hamburger-btn { display: none; }
    .category-circle-inner { width: 72px; height: 72px; }
    .font-display.text-5xl { font-size: 2.5rem !important; }
}

/* --- Desktop: 1024px+ --- */
@media (min-width: 1024px) {
    .hamburger-btn { display: none !important; }
    .category-circle-inner { width: 80px; height: 80px; }
}