/* ============================================
   Telegram WebApp Shop - Modern Dark Theme
   ============================================ */

:root {
    /* === Typography (rem-based) === */
    --font-xs: 0.75rem;    /* 12px */
    --font-sm: 0.875rem;   /* 14px */
    --font-base: 1rem;     /* 16px */
    --font-lg: 1.125rem;   /* 18px */
    --font-xl: 1.25rem;    /* 20px */
    --font-2xl: 1.5rem;    /* 24px */
    
    /* === Component sizes === */
    --header-height: 3.5rem;      /* 56px */
    --nav-height: 3.5rem;         /* 56px */
    --card-image-height: 11rem;   /* ~176px */
    --sidebar-width: min(17.5rem, 80vw);
    --modal-max-width: min(31.25rem, 92vw);
    --touch-target: 2.75rem;      /* 44px — minimum touch target */
    
    /* === Radii === */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.25rem;
    --radius-full: 50%;
    
    /* === Shadows - Enhanced for dark theme === */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.45);
    --shadow-glow: 0 0 30px rgba(51, 144, 236, 0.3);
    
    /* === Gradients === */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --gradient-card: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
    
    /* === Glass effect === */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg-strong: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-strong: rgba(255, 255, 255, 0.15);
    
    /* === Transitions === */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* === Spacing scale === */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--tg-theme-bg-color, #0f0f23);
    color: var(--tg-theme-text-color, #ffffff);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px));
    padding-left: var(--tg-safe-area-inset-left, 0px);
    padding-right: var(--tg-safe-area-inset-right, 0px);
    min-height: 100vh;
    min-height: 100dvh;
}

#app {
    max-width: 100%;
    min-height: 100vh;
    min-height: var(--tg-viewport-stable-height, 100dvh);
    display: flex;
    flex-direction: column;
    padding-top: calc(
        var(--tg-safe-area-inset-top, 0px) +
        var(--tg-content-safe-area-inset-top, 0px) +
        56px
    );
}

/* ============================================
   App Header
   ============================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    padding-top: calc(
        var(--tg-safe-area-inset-top, 0px) +
        var(--tg-content-safe-area-inset-top, 0px) +
        var(--space-sm)
    );
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    min-height: 56px;
    transition: transform var(--transition-normal);
}

.app-header.header-hidden {
    transform: translateY(-100%);
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
    flex-shrink: 0;
}

.header-icon-btn:active {
    transform: scale(0.92);
    background: var(--tg-theme-button-color, #3390ec);
}

.header-icon-btn svg {
    width: 22px;
    height: 22px;
    stroke: var(--tg-theme-text-color, #fff);
    pointer-events: none;
}

.header-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
    flex: 1;
    text-align: center;
    letter-spacing: -0.02em;
}

/* ============================================
   Lucide Icons
   ============================================ */
.lucide-icon {
    display: inline-block;
    vertical-align: middle;
    line-height: 1;
}

.lucide-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

button i[data-lucide],
button i[data-lucide] svg,
button svg {
    pointer-events: none;
}

/* ============================================
   Subscription Alert & Badge
   ============================================ */
.subscription-alert {
    padding: var(--space-md);
    background: var(--gradient-danger);
    color: white;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.subscription-badge {
    font-size: 0.85rem;
}

.subscription-badge .badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.badge-active {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9) 0%, rgba(56, 142, 60, 0.9) 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(76, 175, 80, 0.4);
}

.badge-trial {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.9) 0%, rgba(245, 124, 0, 0.9) 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(255, 152, 0, 0.4);
}

.badge-expired,
.badge-canceled,
.badge-inactive {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.9) 0%, rgba(211, 47, 47, 0.9) 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(244, 67, 54, 0.4);
}

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding-bottom: calc(
        var(--tg-safe-area-inset-bottom, 0px) +
        var(--tg-content-safe-area-inset-bottom, 0px)
    );
    z-index: 1000;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    flex: 1;
    padding: var(--space-sm) var(--space-xs);
    border: none;
    background: none;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    font-size: 0.7rem;
    cursor: pointer;
    position: relative;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
}

.nav-btn i[data-lucide] {
    width: 24px;
    height: 24px;
    stroke-width: 1.5;
    transition: all var(--transition-fast);
}

.nav-label {
    font-size: 0.65rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0.9;
}

.nav-btn.active {
    color: var(--tg-theme-button-color, #3390ec);
}

.nav-btn.active i[data-lucide] {
    stroke-width: 2.5;
    filter: drop-shadow(0 0 8px var(--tg-theme-button-color, #3390ec));
}

.nav-btn:active {
    transform: scale(0.9);
}

.nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.lock-icon {
    font-size: 0.8rem;
    margin-left: 4px;
}

/* Navigation Badge */
.nav-badge {
    position: absolute;
    top: var(--space-xs);
    right: 50%;
    transform: translateX(14px);
    background: var(--gradient-danger);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 2px 7px;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.5);
    border: 2px solid var(--tg-theme-bg-color, #0f0f23);
}

.nav-badge:empty {
    display: none;
}

.nav-badge.pulse {
    animation: cartPulse 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

#cart-count {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    border-radius: var(--radius-md);
    padding: 2px 6px;
    font-size: 0.7rem;
}

#cart-count.pulse {
    animation: cartPulse 0.6s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

@keyframes cartPulse {
    0%, 100% { transform: scale(1) translateX(14px); }
    25% { transform: scale(1.5) translateX(14px); }
    50% { transform: scale(0.85) translateX(14px); }
    75% { transform: scale(1.25) translateX(14px); }
}

/* ============================================
   Main Content
   ============================================ */
main {
    padding: var(--space-md);
    padding-bottom: calc(
        60px +
        var(--tg-safe-area-inset-bottom, 0px) +
        var(--tg-content-safe-area-inset-bottom, 0px) +
        var(--space-md)
    );
    flex: 1;
}

.page {
    display: none;
    opacity: 0;
    animation: pageFadeIn var(--transition-normal) forwards;
    position: relative;
}

.page.active {
    display: block;
    opacity: 1;
}

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

/* ============================================
   Search
   ============================================ */
.search-row {
    margin-bottom: var(--space-sm);
}

.search-row input {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--glass-bg);
    color: var(--tg-theme-text-color, #fff);
    transition: all var(--transition-fast);
}

.search-row input:focus {
    outline: none;
    border-color: var(--tg-theme-button-color, #3390ec);
    box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.15);
}

.search-row input::placeholder {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.4));
}

/* Search Box */
.search-box {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    animation: slideDown 0.2s ease;
}

.search-box.hidden {
    display: none;
}

.search-box input {
    flex: 1;
    padding: var(--space-md);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--glass-bg);
    color: var(--tg-theme-text-color, #fff);
}

.search-close {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--glass-bg-strong);
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--tg-theme-text-color, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.search-close:active {
    transform: scale(0.9);
}

/* ============================================
   Sort Popup & Overlay
   ============================================ */
.sort-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999;
    opacity: 1;
    transition: opacity var(--transition-fast);
}

.sort-overlay.hidden {
    display: none;
    opacity: 0;
}

.sort-popup {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--tg-theme-bg-color, #1a1a2e);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border: 1px solid var(--glass-border);
    border-bottom: none;
    padding: var(--space-lg);
    padding-bottom: calc(
        var(--space-lg) +
        var(--tg-safe-area-inset-bottom, 0px) +
        var(--tg-content-safe-area-inset-bottom, 0px)
    );
    z-index: 1000;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sort-popup.hidden {
    display: none;
}

.sort-popup-header {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: var(--space-md);
    text-align: center;
    color: var(--tg-theme-text-color, #fff);
}

.sort-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.sort-option {
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    color: var(--tg-theme-text-color, #fff);
    transition: all var(--transition-fast);
}

.sort-option:active,
.sort-option.active {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    transform: scale(0.98);
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

/* ============================================
   Categories Toolbar & Sidebar
   ============================================ */
.categories-toolbar {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    padding: var(--space-sm) 0;
}

.burger-btn,
.sort-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: var(--glass-bg);
    color: var(--tg-theme-text-color, #fff);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.burger-btn i[data-lucide],
.sort-btn i[data-lucide] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.burger-btn:active,
.sort-btn:active {
    transform: scale(0.96);
    background: var(--glass-bg-strong);
    border-color: var(--tg-theme-button-color, #3390ec);
}

/* Categories Sidebar */
.categories-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    max-width: 85%;
    background: var(--tg-theme-bg-color, #0f0f23);
    z-index: 2000;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    padding-top: calc(
        var(--tg-safe-area-inset-top, 0px) +
        var(--tg-content-safe-area-inset-top, 0px)
    );
}

.categories-sidebar.active {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
}

.categories-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
}

.categories-sidebar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.categories-sidebar-close {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    transition: all var(--transition-fast);
}

.categories-sidebar-close i[data-lucide] {
    width: 22px;
    height: 22px;
}

.categories-sidebar-close:active {
    transform: scale(0.9);
    background: var(--tg-theme-button-color, #3390ec);
    color: white;
}

.categories-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-sm) 0;
}

.category-sidebar-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: none;
    background: transparent;
    color: var(--tg-theme-text-color, #fff);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: left;
}

.category-sidebar-item i[data-lucide] {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
}

.category-sidebar-item:active {
    background: var(--glass-bg);
}

.category-sidebar-item.active {
    background: var(--tg-theme-button-color, #3390ec);
    color: white;
    font-weight: 600;
}

.category-sidebar-item.active i[data-lucide] {
    color: white;
}

/* Categories Backdrop */
.categories-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.categories-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   Price Filter
   ============================================ */
.price-filter-wrapper {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}

.price-filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.price-filter-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, #fff);
}

.price-filter-clear {
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--tg-theme-button-color, #3390ec);
    font-size: 0.85rem;
    cursor: pointer;
    padding: var(--space-xs) var(--space-sm);
    transition: all var(--transition-fast);
}

.price-filter-clear:active {
    transform: scale(0.95);
}

.price-filter-inputs {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.price-input-group {
    display: flex;
    align-items: center;
    flex: 1;
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    transition: all var(--transition-fast);
}

.price-input-group:focus-within {
    border-color: var(--tg-theme-button-color, #3390ec);
    box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.15);
}

.price-input-label {
    font-size: 0.85rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    margin-right: var(--space-sm);
}

.price-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--tg-theme-text-color, #fff);
    width: 100%;
    min-width: 0;
    outline: none;
}

.price-input::placeholder {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.3));
}

.price-input::-webkit-outer-spin-button,
.price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.price-input[type=number] {
    -moz-appearance: textfield;
}

.price-input-currency {
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    margin-left: var(--space-xs);
}

.price-input-separator {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    font-size: 0.9rem;
    flex-shrink: 0;
}

.price-filter-range {
    margin-top: var(--space-sm);
    text-align: center;
}

.price-range-text {
    font-size: 0.8rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.4));
}

/* ============================================
   Products Grid & Cards
   ============================================ */
.products-grid {
    display: grid;
    /* Adaptive grid: 2 columns on small, more on wide */
    grid-template-columns: repeat(auto-fill, minmax(min(8.75rem, 45%), 1fr));
    gap: var(--space-md);
    padding: 0 var(--space-md) var(--space-md);
}

.product-card {
    position: relative;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 0;
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.4s ease-out both;
}

.product-card:active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: var(--shadow-md);
    border-color: var(--tg-theme-button-color, rgba(51, 144, 236, 0.5));
}

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

/* Stagger animation for product grid */
.products-grid .product-card:nth-child(1) { animation-delay: 0.05s; }
.products-grid .product-card:nth-child(2) { animation-delay: 0.1s; }
.products-grid .product-card:nth-child(3) { animation-delay: 0.15s; }
.products-grid .product-card:nth-child(4) { animation-delay: 0.2s; }
.products-grid .product-card:nth-child(5) { animation-delay: 0.25s; }
.products-grid .product-card:nth-child(6) { animation-delay: 0.3s; }
.products-grid .product-card:nth-child(n+7) { animation-delay: 0.35s; }

.product-card-image-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: var(--glass-bg);
}

.product-card-content {
    padding: var(--space-md);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.product-card:active img {
    transform: scale(1.05);
}

.product-card-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--glass-bg) 0%, var(--glass-bg-strong) 100%);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.3));
}

.product-card-no-image i[data-lucide] {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.product-card h3 {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--tg-theme-text-color, #fff);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.product-card .price {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
    margin-bottom: var(--space-sm);
    text-shadow: 0 0 20px rgba(51, 144, 236, 0.3);
}

.product-card .description {
    font-size: 0.8rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    margin-bottom: var(--space-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.product-card .product-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.product-card .stock,
.product-card .weight {
    font-size: 0.75rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.4));
}

.product-card .add-to-cart-btn {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-sm);
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: auto;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 10px rgba(51, 144, 236, 0.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.product-card .add-to-cart-btn i[data-lucide] {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.product-card .add-to-cart-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 5px rgba(51, 144, 236, 0.3);
}

/* Product Image Wrapper */
.product-image-wrapper {
    position: relative;
    margin-bottom: var(--space-md);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-md);
    transition: transform var(--transition-normal);
}

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

.product-image-placeholder {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.3));
    font-size: 0.9rem;
}

/* Favorite Button */
.favorite-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    z-index: 10;
    padding: 0;
}

.favorite-btn i[data-lucide],
.favorite-btn svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    color: rgba(255, 255, 255, 0.8);
    stroke: rgba(255, 255, 255, 0.8);
    fill: none;
    transition: all var(--transition-bounce);
}

.favorite-btn.active i[data-lucide],
.favorite-btn.active svg {
    fill: #ff3b30;
    color: #ff3b30;
    stroke: #ff3b30;
    stroke-width: 2.5;
    animation: heartBounce 0.4s ease;
    filter: drop-shadow(0 0 8px rgba(255, 59, 48, 0.6));
}

.favorite-btn:active {
    transform: scale(0.85);
}

@keyframes heartBounce {
    0% { transform: scale(1); }
    25% { transform: scale(1.4); }
    50% { transform: scale(0.85); }
    75% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: var(--space-md);
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.btn-primary {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    box-shadow: 0 4px 16px rgba(51, 144, 236, 0.4);
}

.btn-primary:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.3);
}

.btn-secondary {
    background: var(--glass-bg-strong);
    color: var(--tg-theme-text-color, #fff);
    border: 1px solid var(--glass-border);
}

.btn-secondary:active {
    transform: scale(0.97);
    background: var(--glass-bg);
}

/* ============================================
   Cart
   ============================================ */
.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
    transition: all var(--transition-fast);
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    flex: 1;
}

.cart-item-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--tg-theme-text-color, #fff);
}

.cart-item-info .price {
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
}

.cart-item-actions {
    display: flex;
    gap: var(--space-md);
    align-items: center;
}

.quantity-controls {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xs) var(--space-sm);
}

.quantity-controls button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all var(--transition-fast);
}

.quantity-controls button:disabled {
    background: var(--glass-bg-strong);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.3));
    cursor: not-allowed;
}

.quantity-controls button:active:not(:disabled) {
    transform: scale(0.9);
}

.quantity-controls .quantity {
    min-width: 28px;
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--tg-theme-text-color, #fff);
}

.cart-item-actions .item-total {
    min-width: 80px;
    text-align: right;
    font-weight: 600;
    color: var(--tg-theme-button-color, #3390ec);
}

.cart-item-actions .delete-btn {
    border: none;
    background: var(--glass-bg);
    color: #ff3b30;
    font-size: 1.2rem;
    cursor: pointer;
    padding: var(--space-sm);
    border-radius: var(--radius-full);
    transition: all var(--transition-fast);
}

.cart-item-actions .delete-btn:active {
    transform: scale(0.9);
    background: rgba(255, 59, 48, 0.2);
}

#cart-total {
    margin-top: var(--space-md);
}

.cart-summary {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    font-size: 1rem;
    color: var(--tg-theme-text-color, #fff);
}

.summary-row.total {
    border-top: 1px solid var(--glass-border);
    margin-top: var(--space-sm);
    padding-top: var(--space-md);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
}

/* ============================================
   Orders
   ============================================ */
.order-card {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--gradient-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all var(--transition-fast);
}

.order-card:active {
    transform: scale(0.99);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.order-number {
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
}

.order-details {
    margin-bottom: var(--space-md);
}

.order-details p {
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, #fff);
}

.order-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.order-actions .btn-small {
    flex: 1;
}

.order-actions .btn-primary {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
}

.delivery-status {
    color: var(--tg-theme-button-color, #3390ec);
    font-size: 0.95rem;
    font-weight: 500;
}

.tracking {
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
}

.order-date {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
}

.order-status {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.order-status.pending {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.9) 0%, rgba(255, 140, 0, 0.9) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 165, 0, 0.4);
}

.order-status.confirmed {
    background: linear-gradient(135deg, rgba(51, 144, 236, 0.9) 0%, rgba(33, 150, 243, 0.9) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.4);
}

.order-status.processing {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.9) 0%, rgba(30, 136, 229, 0.9) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
}

.order-status.shipped {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.9) 0%, rgba(142, 36, 170, 0.9) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(156, 39, 176, 0.4);
}

.order-status.delivered {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.4);
}

.order-status.canceled {
    background: var(--gradient-danger);
    color: white;
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.4);
}

/* ============================================
   Profile
   ============================================ */
.profile-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-2xl) var(--space-md);
    background: linear-gradient(180deg, var(--glass-bg-strong) 0%, transparent 100%);
    border-bottom: 1px solid var(--glass-border);
    margin: calc(-1 * var(--space-md));
    margin-bottom: var(--space-lg);
    position: relative;
    overflow: hidden;
}

.profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200%;
    height: 100%;
    background: radial-gradient(ellipse at center top, rgba(51, 144, 236, 0.15) 0%, transparent 60%);
    pointer-events: none;
}

.profile-avatar {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-full);
    background: var(--tg-theme-button-color, #3390ec);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 8px 24px rgba(51, 144, 236, 0.4), 0 0 0 4px var(--glass-border);
    margin-bottom: var(--space-md);
    position: relative;
    z-index: 1;
}

.profile-avatar-img {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-full);
    object-fit: cover;
    box-shadow: 0 8px 24px rgba(51, 144, 236, 0.4), 0 0 0 4px var(--glass-border);
    margin-bottom: var(--space-md);
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tg-theme-text-color, #fff);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.profile-username {
    font-size: 1rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    font-weight: 400;
}

.profile-menu {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    padding: 0;
    margin-bottom: var(--space-md);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-menu-item:active {
    transform: translateX(4px);
    background: var(--glass-bg-strong);
    border-color: var(--tg-theme-button-color, #3390ec);
}

.menu-item-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg-strong);
    border-radius: var(--radius-sm);
    color: var(--tg-theme-button-color, #3390ec);
}

.menu-item-icon i[data-lucide] {
    width: 22px;
    height: 22px;
}

.menu-item-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 500;
    color: var(--tg-theme-text-color, #fff);
}

.menu-item-arrow {
    flex-shrink: 0;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.3));
    width: 20px;
    height: 20px;
}

/* Subscription Card */
.subscription-card {
    background: var(--gradient-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
}

.subscription-card:active {
    transform: scale(0.99);
}

.subscription-card.inactive {
    border-color: rgba(244, 67, 54, 0.5);
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.1) 0%, rgba(244, 67, 54, 0.05) 100%);
}

.subscription-card p {
    margin-bottom: var(--space-md);
    line-height: 1.6;
    color: var(--tg-theme-text-color, #fff);
}

.status-active { color: #4caf50; font-weight: 700; text-shadow: 0 0 10px rgba(76, 175, 80, 0.5); }
.status-trial { color: #ff9800; font-weight: 700; text-shadow: 0 0 10px rgba(255, 152, 0, 0.5); }
.status-expired { color: #f44336; font-weight: 700; text-shadow: 0 0 10px rgba(244, 67, 54, 0.5); }
.status-canceled { color: #f44336; font-weight: 700; text-shadow: 0 0 10px rgba(244, 67, 54, 0.5); }

/* Subscription Empty State */
.subscription-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xl);
    max-width: 500px;
    margin: 0 auto;
}

.subscription-icon {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.subscription-icon i {
    color: #fff;
}

.subscription-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tg-theme-text-color, #fff);
    margin-bottom: var(--space-sm);
    letter-spacing: -0.02em;
}

.subscription-description {
    font-size: 1rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.subscription-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    margin-bottom: var(--space-xl);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.feature-item:active {
    transform: translateX(4px);
    background: var(--glass-bg-strong);
}

.feature-item i {
    color: var(--tg-theme-button-color, #3390ec);
    flex-shrink: 0;
}

.feature-item span {
    color: var(--tg-theme-text-color, #fff);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: left;
}

.btn-subscribe-large {
    width: 100%;
    max-width: 300px;
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-lg);
    border: none;
    background: var(--gradient-primary);
    color: var(--tg-theme-button-text-color, #fff);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
    transition: all var(--transition-normal);
}

.btn-subscribe-large:active {
    transform: scale(0.97);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.4);
}

/* Active Subscription State */
.subscription-active-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-xl);
    max-width: 500px;
    margin: 0 auto;
}

.subscription-active-icon {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    box-shadow: 0 8px 30px rgba(76, 175, 80, 0.4);
    animation: float 3s ease-in-out infinite;
}

.subscription-active-icon i {
    color: #fff;
}

.subscription-active-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--tg-theme-text-color, #fff);
    margin-bottom: var(--space-sm);
}

.subscription-active-description {
    font-size: 1rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.subscription-details-card {
    width: 100%;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--glass-border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 0.95rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
}

.detail-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
}

.text-success {
    color: #4caf50 !important;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.text-muted {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5)) !important;
}

.subscription-benefits {
    width: 100%;
}

.benefits-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
    margin-bottom: var(--space-md);
    text-align: left;
}

.benefit-item-small {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    text-align: left;
}

.benefit-item-small i {
    flex-shrink: 0;
    color: var(--tg-theme-button-color, #3390ec);
}

.benefit-item-small span {
    color: var(--tg-theme-text-color, #fff);
    font-size: 0.95rem;
}

/* ============================================
   Addresses
   ============================================ */
.addresses-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.address-card {
    background: var(--gradient-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all var(--transition-fast);
}

.address-card:active {
    transform: scale(0.99);
}

.address-card.default {
    border-color: var(--tg-theme-button-color, #3390ec);
    border-width: 2px;
    box-shadow: 0 0 20px rgba(51, 144, 236, 0.2);
}

.address-card p {
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--tg-theme-text-color, #fff);
}

.address-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.btn-small {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
    background: var(--glass-bg-strong);
    color: var(--tg-theme-text-color, #fff);
    border: 1px solid var(--glass-border);
}

.btn-small:active {
    transform: scale(0.95);
}

.btn-small.btn-danger {
    background: var(--gradient-danger);
    color: white;
    border: none;
    box-shadow: 0 2px 10px rgba(244, 67, 54, 0.35);
}

.no-address-message {
    background: var(--glass-bg);
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    margin-bottom: var(--space-md);
}

.no-address-message p {
    font-size: 1rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    margin: 0;
}

.btn-add-address {
    background: var(--gradient-success);
    color: white;
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: var(--space-sm);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4);
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
}

.btn-add-address:active {
    transform: scale(0.97);
    box-shadow: 0 2px 10px rgba(76, 175, 80, 0.35);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
    box-shadow: 0 3px 12px rgba(244, 67, 54, 0.4);
    transition: all var(--transition-fast);
}

.btn-danger:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.35);
}

.badge-primary {
    background: var(--tg-theme-button-color, #3390ec);
    color: white;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-block;
    margin-bottom: var(--space-sm);
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.4);
}

/* ============================================
   Modal
   ============================================ */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    justify-content: center;
    align-items: center;
    padding: var(--space-md);
}

.modal.active {
    display: flex;
    animation: modalFadeIn var(--transition-normal);
}

.modal-content {
    background: var(--tg-theme-bg-color, #1a1a2e);
    margin: auto;
    padding: var(--space-xl);
    border-radius: var(--radius-xl);
    width: 92%;
    max-width: 440px;
    border: 1px solid var(--glass-border);
    position: relative;
    align-self: center;
    max-height: min(
        calc(85vh -
            var(--tg-safe-area-inset-top, 0px) -
            var(--tg-content-safe-area-inset-top, 0px) -
            var(--tg-safe-area-inset-bottom, 0px) -
            var(--tg-content-safe-area-inset-bottom, 0px)
        ),
        85vh
    );
    overflow-y: auto;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.close-modal {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    font-weight: normal;
    line-height: 1;
    transition: all var(--transition-fast);
}

.close-modal:active {
    transform: scale(0.9);
    background: var(--glass-bg-strong);
    color: var(--tg-theme-text-color, #fff);
}

.modal-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
}

.modal-actions button {
    flex: 1;
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

#order-confirm-content {
    margin: var(--space-lg) 0;
    line-height: 1.6;
    color: var(--tg-theme-text-color, #fff);
}

/* About Modal */
.about-content {
    line-height: 1.6;
}

.about-content p {
    margin-bottom: var(--space-md);
    color: var(--tg-theme-text-color, #fff);
}

.about-content h4 {
    margin-top: var(--space-lg);
    margin-bottom: var(--space-md);
    color: var(--tg-theme-text-color, #fff);
    font-size: 1rem;
    font-weight: 600;
}

.about-content ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.about-content ul li {
    padding: var(--space-sm) 0;
    padding-left: var(--space-xl);
    position: relative;
    color: var(--tg-theme-text-color, #fff);
}

.about-content ul li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--tg-theme-button-color, #3390ec);
    font-weight: bold;
}

/* ============================================
   Forms
   ============================================ */
#address-modal-title {
    margin: 0 0 var(--space-lg) 0;
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
    color: var(--tg-theme-text-color, #fff);
    font-size: 1.25rem;
    font-weight: 700;
}

#address-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

#address-form label {
    display: block;
    margin-top: var(--space-md);
    margin-bottom: var(--space-sm);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--tg-theme-text-color, #fff);
}

#address-form label:first-of-type {
    margin-top: 0;
}

#address-form input,
#address-form textarea {
    width: 100%;
    padding: var(--space-md);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background: var(--glass-bg);
    color: var(--tg-theme-text-color, #fff);
    box-sizing: border-box;
    transition: all var(--transition-fast);
}

#address-form input:focus,
#address-form textarea:focus {
    outline: none;
    border-color: var(--tg-theme-button-color, #3390ec);
    box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.15);
    background: var(--glass-bg-strong);
}

#address-form input::placeholder,
#address-form textarea::placeholder {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.4));
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checkbox-label:active {
    background: var(--glass-bg-strong);
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--tg-theme-button-color, #3390ec);
}

.checkbox-label span {
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, #fff);
}

.modal-buttons {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--glass-border);
}

.modal-buttons button {
    flex: 1;
    padding: var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-buttons .btn-primary {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    box-shadow: 0 2px 12px rgba(51, 144, 236, 0.4);
}

.modal-buttons .btn-primary:active {
    transform: scale(0.97);
}

.modal-buttons .btn-secondary {
    background: var(--glass-bg-strong);
    color: var(--tg-theme-text-color, #fff);
    border: 1px solid var(--glass-border);
}

.modal-buttons .btn-secondary:active {
    transform: scale(0.97);
    background: var(--glass-bg);
}

/* ============================================
   Loading States & Skeletons
   ============================================ */
.loading {
    text-align: center;
    padding: var(--space-xl);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
}

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

.skeleton {
    background: linear-gradient(
        90deg,
        var(--glass-bg) 0%,
        var(--glass-bg) 40%,
        var(--glass-bg-strong) 50%,
        var(--glass-bg) 60%,
        var(--glass-bg) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.skeleton-card {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    background: var(--glass-bg);
}

.skeleton-card .skeleton-image {
    width: 100%;
    height: 140px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-sm);
}

.skeleton-card .skeleton-title {
    height: 1rem;
    width: 80%;
    margin-bottom: var(--space-sm);
}

.skeleton-card .skeleton-text {
    height: 0.85rem;
    width: 60%;
    margin-bottom: var(--space-sm);
}

.skeleton-card .skeleton-price {
    height: 1.1rem;
    width: 40%;
    margin-bottom: var(--space-sm);
}

.skeleton-card .skeleton-btn {
    height: 2.25rem;
    width: 100%;
    margin-top: var(--space-sm);
    border-radius: var(--radius-sm);
}

/* Skeleton Order Card */
.skeleton-order {
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    background: var(--glass-bg);
}

.skeleton-order .skeleton-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.skeleton-order .skeleton-badge {
    height: 1.5rem;
    width: 5rem;
    border-radius: var(--radius-lg);
}

.skeleton-order .skeleton-order-num {
    height: 0.9rem;
    width: 6rem;
}

.skeleton-order .skeleton-line {
    height: 0.9rem;
    margin-bottom: var(--space-sm);
}

.skeleton-order .skeleton-line-short { width: 50%; }
.skeleton-order .skeleton-line-medium { width: 70%; }

.skeleton-order .skeleton-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.skeleton-order .skeleton-btn-small {
    height: 2rem;
    flex: 1;
    border-radius: var(--radius-sm);
}

/* Skeleton Cart */
.skeleton-cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--glass-border);
}

.skeleton-cart-item .skeleton-info { flex: 1; }

.skeleton-cart-item .skeleton-name {
    height: 1rem;
    width: 60%;
    margin-bottom: var(--space-sm);
}

.skeleton-cart-item .skeleton-price {
    height: 0.9rem;
    width: 30%;
}

.skeleton-cart-item .skeleton-controls {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.skeleton-cart-item .skeleton-qty {
    height: 2rem;
    width: 6rem;
    border-radius: var(--radius-lg);
}

.skeleton-cart-item .skeleton-total {
    height: 1rem;
    width: 4rem;
}

.skeleton-cart-summary {
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-top: var(--space-md);
}

.skeleton-cart-summary .skeleton-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.skeleton-cart-summary .skeleton-label {
    height: 1rem;
    width: 4rem;
}

.skeleton-cart-summary .skeleton-value {
    height: 1rem;
    width: 5rem;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--tg-theme-button-color, #3390ec);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: var(--space-xl) auto;
}

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

.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.spinner-container .spinner-text {
    margin-top: var(--space-md);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    font-size: 0.9rem;
}

/* ============================================
   Product Detail Page
   ============================================ */
.btn-back {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--tg-theme-button-color, #3390ec);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    padding: var(--space-sm) var(--space-md);
    margin-bottom: var(--space-md);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: all var(--transition-fast);
}

.btn-back:active {
    transform: scale(0.95);
}

.product-detail {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.product-image {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--glass-bg);
}

.product-image img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    display: block;
}

.product-info-full {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.product-info-full h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--tg-theme-text-color, #fff);
    letter-spacing: -0.02em;
}

.product-price-block {
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.price-large {
    font-size: 2rem;
    font-weight: 700;
    color: var(--tg-theme-button-color, #3390ec);
    text-shadow: 0 0 30px rgba(51, 144, 236, 0.4);
}

.product-stock {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 600;
    text-align: center;
}

.product-stock.in-stock {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #4caf50;
}

.product-stock.out-of-stock {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #f44336;
}

.product-description {
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.product-description h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--tg-theme-text-color, #fff);
}

.product-description p {
    line-height: 1.6;
    color: var(--tg-theme-text-color, #fff);
    opacity: 0.9;
}

.product-characteristics {
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
}

.product-characteristics h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--tg-theme-text-color, #fff);
}

.product-characteristics ul {
    list-style: none;
    padding: 0;
}

.product-characteristics li {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--glass-border);
    color: var(--tg-theme-text-color, #fff);
}

.product-characteristics li:last-child {
    border-bottom: none;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.quantity-selector {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.quantity-selector label {
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
}

.quantity-controls-large {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    width: fit-content;
}

.quantity-controls-large button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: var(--radius-full);
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 10px rgba(51, 144, 236, 0.35);
}

.quantity-controls-large button:active {
    transform: scale(0.9);
}

.quantity-controls-large input {
    width: 60px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    border: none;
    background: transparent;
    color: var(--tg-theme-text-color, #fff);
}

.add-to-cart-large {
    font-size: 1.1rem;
    padding: var(--space-md);
}

.product-unavailable {
    padding: var(--space-lg);
    background: rgba(244, 67, 54, 0.1);
    border: 1px solid rgba(244, 67, 54, 0.3);
    border-radius: var(--radius-md);
    text-align: center;
    color: #f44336;
    font-weight: 600;
    margin-top: var(--space-md);
}

/* ============================================
   Address Selection Modal
   ============================================ */
#address-select-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
    max-height: 50vh;
    overflow-y: auto;
}

.address-select-card {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.address-select-card:active {
    border-color: var(--tg-theme-button-color, #3390ec);
    background: var(--glass-bg-strong);
    transform: scale(0.98);
}

.address-select-card.default {
    border-color: var(--tg-theme-button-color, #3390ec);
}

.address-select-card p {
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, #fff);
}

.address-select-card .badge {
    margin-bottom: var(--space-md);
}

/* Delivery Method Selection */
.delivery-method-section {
    margin-bottom: var(--space-lg);
}

.delivery-method-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--tg-theme-text-color, #fff);
}

.delivery-methods {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.delivery-method-option {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--glass-bg);
}

.delivery-method-option:active {
    border-color: var(--tg-theme-button-color, #3390ec);
    background: var(--glass-bg-strong);
}

.delivery-method-option input[type="radio"] {
    margin-right: var(--space-md);
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: var(--tg-theme-button-color, #3390ec);
}

.delivery-method-option input[type="radio"]:checked + span {
    font-weight: 600;
    color: var(--tg-theme-button-color, #3390ec);
}

.delivery-method-option span {
    font-size: 1rem;
    color: var(--tg-theme-text-color, #fff);
}

/* Info Card */
.info-card {
    padding: var(--space-md);
    background: var(--glass-bg);
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
}

.info-card p {
    margin-bottom: var(--space-sm);
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, #fff);
}

.info-card p:last-child {
    margin-bottom: 0;
}

/* ============================================
   Offline Banner
   ============================================ */
.offline-banner {
    position: fixed;
    top: calc(
        var(--tg-safe-area-inset-top, 0px) +
        var(--tg-content-safe-area-inset-top, 0px)
    );
    left: 0;
    right: 0;
    background: var(--gradient-danger);
    color: white;
    text-align: center;
    padding: var(--space-md);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.offline-banner.visible {
    transform: translateY(0);
}

body:has(.offline-banner.visible) #app {
    padding-top: calc(
        var(--tg-safe-area-inset-top, 0px) +
        var(--tg-content-safe-area-inset-top, 0px) +
        48px
    );
}

/* ============================================
   Order Timeline
   ============================================ */
.order-timeline {
    display: flex;
    justify-content: space-between;
    margin: var(--space-md) 0;
    position: relative;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.timeline-step::before {
    content: '';
    position: absolute;
    top: 12px;
    left: -50%;
    width: 100%;
    height: 2px;
    background: var(--glass-border);
}

.timeline-step:first-child::before { display: none; }
.timeline-step.completed::before { background: #4caf50; box-shadow: 0 0 8px rgba(76, 175, 80, 0.5); }
.timeline-step.current::before { background: linear-gradient(to right, #4caf50 50%, var(--glass-border) 50%); }

.timeline-dot {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    background: var(--glass-bg-strong);
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid var(--glass-border);
}

.timeline-step.completed .timeline-dot {
    background: var(--gradient-success);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.5);
}

.timeline-step.current .timeline-dot {
    background: var(--tg-theme-button-color, #3390ec);
    color: white;
    border: none;
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.5);
}

.timeline-label {
    font-size: 0.7rem;
    margin-top: var(--space-xs);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    text-align: center;
}

/* ============================================
   Optimistic Cart Updates
   ============================================ */
.add-to-cart-btn.loading,
.add-to-cart-large.loading {
    opacity: 0.7;
    pointer-events: none;
    position: relative;
}

.add-to-cart-btn.loading::after,
.add-to-cart-large.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    right: 12px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

.add-to-cart-btn.success,
.add-to-cart-large.success {
    animation: buttonSuccess 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes buttonSuccess {
    0% { transform: scale(1); }
    30% { transform: scale(0.95); }
    60% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.cart-item.cart-item-loading {
    opacity: 0.5;
    pointer-events: none;
}

.cart-item.cart-item-loading .quantity-controls button,
.cart-item.cart-item-loading .delete-btn {
    opacity: 0.4;
}

.item-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--tg-theme-button-color, #3390ec);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin-left: var(--space-sm);
    vertical-align: middle;
}

/* ============================================
   Infinite Scroll
   ============================================ */
.infinite-scroll-status {
    padding: var(--space-md);
    text-align: center;
    width: 100%;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
}

.loading-spinner .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--tg-theme-button-color, #3390ec);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
    margin: 0;
}

.no-more-products {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    font-size: 0.9rem;
    padding: var(--space-md) 0;
}

.scroll-sentinel {
    height: 1px;
    width: 100%;
}

/* ============================================
   Empty States
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
    animation: fadeInUp 0.5s ease-out;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    border-radius: var(--radius-full);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    opacity: 0.7;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tg-theme-text-color, #fff);
    margin-bottom: var(--space-sm);
}

.empty-state-message,
.empty-state-text {
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: var(--space-lg);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
}

.empty-state-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #fff);
    border: none;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px rgba(51, 144, 236, 0.4);
}

.empty-state-cta i[data-lucide] {
    flex-shrink: 0;
}

.empty-state-cta:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(51, 144, 236, 0.3);
}

/* ============================================
   Search Modal
   ============================================ */
.search-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--tg-theme-bg-color, #0f0f23);
    z-index: 200;
    display: none;
    flex-direction: column;
    padding-top: calc(
        var(--tg-safe-area-inset-top, 0px) +
        var(--tg-content-safe-area-inset-top, 0px)
    );
}

.search-modal.active {
    display: flex;
    animation: modalFadeIn var(--transition-fast);
}

.search-modal-header {
    display: flex;
    align-items: center;
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--glass-border);
    gap: var(--space-sm);
    min-height: 56px;
    flex-shrink: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.search-modal-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    color: var(--tg-theme-text-color, #fff);
    outline: none;
    padding: var(--space-sm);
}

.search-modal-input::placeholder {
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.4));
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-md);
}

.search-results .products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-md);
    padding: 0;
}

.search-results .empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-md);
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.5));
}

/* Hide old categories toolbar */
.categories-toolbar {
    display: none !important;
}

/* Catalog toolbar */
.catalog-toolbar {
    padding: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* Compact toolbar buttons */
.compact-toolbar-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--tg-theme-button-color, #3390ec);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(51, 144, 236, 0.4);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.compact-toolbar-btn:active {
    transform: scale(0.9);
}

.compact-toolbar-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
    pointer-events: none;
}

/* ============================================
   Desktop Styles
   ============================================ */
body.platform-desktop #app {
    padding-top: 0;
    max-width: 1200px;
    margin: 0 auto;
}

body.platform-desktop .product-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

body.platform-desktop .product-card:hover img {
    transform: none;
}

/* ============================================
   User Info Modal
   ============================================ */
.user-info-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-lg);
}

.user-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--glass-border);
}

.user-info-item:last-child {
    border-bottom: none;
}

.user-info-item .label {
    font-weight: 500;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
    font-size: 0.9rem;
}

.user-info-item .value {
    font-weight: 600;
    color: var(--tg-theme-text-color, #fff);
    text-align: right;
}

/* ============================================
   Subscribe Modal
   ============================================ */
.subscribe-modal-content {
    max-width: 480px;
}

.subscribe-modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-md) 0;
}

.subscribe-icon {
    width: 88px;
    height: 88px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-lg);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4);
    animation: float 3s ease-in-out infinite;
}

.subscribe-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tg-theme-text-color, #fff);
    margin-bottom: var(--space-sm);
}

.subscribe-modal-description {
    font-size: 1rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}

.subscribe-features-compact {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    margin-bottom: var(--space-xl);
}

.feature-item-compact {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    text-align: left;
}

.feature-item-compact i {
    color: var(--tg-theme-button-color, #3390ec);
    flex-shrink: 0;
}

.feature-item-compact span {
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, #fff);
}

.subscribe-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
}

.btn-subscribe-action {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    transition: all var(--transition-fast);
    border: none;
    cursor: pointer;
}

.btn-subscribe-action i {
    flex-shrink: 0;
}

#trial-btn {
    background: var(--gradient-primary);
    color: var(--tg-theme-button-text-color, #fff);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.5);
}

#trial-btn:active {
    transform: scale(0.97);
}

#subscribe-pay-btn {
    background: var(--glass-bg-strong);
    color: var(--tg-theme-text-color, #fff);
    border: 1px solid var(--glass-border);
}

#subscribe-pay-btn:active {
    transform: scale(0.97);
    background: var(--glass-bg);
}

/* ============================================
   Catalog Filters
   ============================================ */
.catalog-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    align-items: flex-start;
}

.catalog-filters > #price-filter {
    flex: 1;
    min-width: 200px;
}

.catalog-filters > #sort-container {
    flex-shrink: 0;
}

/* Sort Select */
.sort-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.sort-label {
    font-size: 0.9rem;
    color: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.6));
    white-space: nowrap;
}

.sort-select {
    background: var(--glass-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md);
    font-size: 0.95rem;
    color: var(--tg-theme-text-color, #fff);
    cursor: pointer;
    outline: none;
    min-width: 160px;
    transition: all var(--transition-fast);
}

.sort-select:focus {
    border-color: var(--tg-theme-button-color, #3390ec);
    box-shadow: 0 0 0 3px rgba(51, 144, 236, 0.15);
}

/* ============================================
   Ripple Effect for Interactive Elements
   ============================================ */
.btn-primary,
.add-to-cart-btn,
.burger-btn,
.sort-btn,
.nav-btn,
.profile-menu-item,
.category-sidebar-item {
    position: relative;
    overflow: hidden;
}

.btn-primary::after,
.add-to-cart-btn::after,
.burger-btn::after,
.sort-btn::after,
.nav-btn::after,
.profile-menu-item::after,
.category-sidebar-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}

.btn-primary:active::after,
.add-to-cart-btn:active::after,
.burger-btn:active::after,
.sort-btn:active::after,
.nav-btn:active::after,
.profile-menu-item:active::after,
.category-sidebar-item:active::after {
    width: 300px;
    height: 300px;
    transition: width 0s, height 0s;
}

/* ============================================
   Scrollbar Styling (Webkit)
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--glass-border-strong);
}

/* Hide scrollbar on touch devices but keep scrolling */
@media (pointer: coarse) {
    ::-webkit-scrollbar {
        display: none;
    }
    
    * {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
}

/* ===========================================
   RESPONSIVE BREAKPOINTS
   - 320px: Small phones (iPhone SE, older Android)
   - 375px: Regular phones (iPhone X/11/12/13)
   - 428px+: Large phones (iPhone Pro Max, large Android)
   =========================================== */

/* === Small phones (320px - 374px) === */
@media screen and (max-width: 374px) {
    :root {
        --font-xs: 0.6875rem;   /* 11px */
        --font-sm: 0.8125rem;   /* 13px */
        --font-base: 0.9375rem; /* 15px */
        --font-lg: 1rem;        /* 16px */
        --space-md: 0.75rem;
        --card-image-height: 9rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-sm);
        padding: var(--space-sm);
    }
    
    .product-card h3 {
        font-size: var(--font-xs);
        -webkit-line-clamp: 2;
    }
    
    .product-card .price {
        font-size: var(--font-sm);
    }
    
    .product-card .add-to-cart-btn {
        padding: var(--space-xs) var(--space-sm);
        font-size: var(--font-xs);
    }
    
    .header-title {
        font-size: var(--font-base);
    }
    
    .nav-label {
        font-size: 0.625rem; /* 10px */
    }
    
    .modal-content {
        padding: var(--space-md);
    }
    
    .catalog-toolbar {
        padding: var(--space-sm);
    }
    
    .compact-toolbar-btn {
        width: 2rem;
        height: 2rem;
    }
    
    .compact-toolbar-btn svg {
        width: 1rem;
        height: 1rem;
    }
    
    /* Cart */
    .cart-item {
        padding: var(--space-sm);
        flex-wrap: wrap;
        gap: var(--space-sm);
    }
    
    .cart-item-info h3 {
        font-size: var(--font-sm);
    }
    
    .quantity-controls {
        gap: var(--space-xs);
    }
    
    .quantity-controls button {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 1rem;
    }
    
    /* Profile */
    .profile-avatar {
        width: 4rem;
        height: 4rem;
    }
    
    .profile-name {
        font-size: var(--font-lg);
    }
    
    .profile-menu-item {
        padding: var(--space-sm);
        gap: var(--space-sm);
    }
    
    .menu-item-icon {
        width: 2rem;
        height: 2rem;
    }
    
    .menu-item-icon i[data-lucide] {
        width: 1rem;
        height: 1rem;
    }
}

/* === Regular phones (375px - 427px) === */
@media screen and (min-width: 375px) and (max-width: 427px) {
    .products-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: var(--space-md);
    }
    
    .product-card-image-wrapper {
        aspect-ratio: 1 / 1;
    }
}

/* === Large phones (428px+) === */
@media screen and (min-width: 428px) {
    :root {
        --card-image-height: 12rem;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)) !important;
        gap: var(--space-md);
    }
    
    .product-card h3 {
        font-size: var(--font-base);
    }
    
    .product-card .price {
        font-size: var(--font-lg);
    }
    
    .product-card-content {
        padding: var(--space-md);
    }
}

/* === Landscape orientation === */
@media screen and (orientation: landscape) and (max-height: 500px) {
    :root {
        --header-height: 3rem;
        --nav-height: 3rem;
    }
    
    .app-header {
        min-height: var(--header-height);
    }
    
    .bottom-nav {
        min-height: var(--nav-height);
    }
    
    .nav-btn {
        padding: var(--space-xs);
    }
    
    .nav-label {
        display: none;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)) !important;
    }
    
    .product-card-image-wrapper {
        aspect-ratio: 4 / 3;
        max-height: 6rem;
    }
    
    main {
        padding-bottom: calc(
            var(--nav-height) +
            var(--tg-safe-area-inset-bottom, 0px) +
            var(--tg-content-safe-area-inset-bottom, 0px) +
            var(--space-sm)
        );
    }
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .product-card:hover {
        transform: none;
    }
    
    .product-card:hover img {
        transform: none;
    }
}
