/* ============================================
   Faberlic Mini App v2 — "Cozy Tech" Design
   ============================================ */

/* === CSS Variables === */
:root {
    /* Colors — Pastel & Clean */
    --bg-primary: #F5F5F7;
    --bg-secondary: #FFFFFF;
    --bg-card: #FFFFFF;
    
    --accent-primary: #E8D7D0;
    --accent-secondary: #B2D8D8;
    --accent-sale: #FF6B6B;
    --accent-success: #34C759;
    --accent-warning: #FF9500;
    
    --text-primary: #1C1C1E;
    --text-secondary: #8E8E93;
    --text-tertiary: #C7C7CC;
    --text-inverse: #FFFFFF;
    
    --border-color: rgba(0, 0, 0, 0.06);
    --shadow-light: 0 2px 12px rgba(0, 0, 0, 0.04);
    --shadow-medium: 0 4px 20px rgba(0, 0, 0, 0.08);
    
    /* Category Colors */
    --cat-family: #E8D7D0;
    --cat-sale: #FFE5E5;
    --cat-new: #FFF3E0;
    --cat-home: #E8F5E9;
    --cat-health: #E0F2F1;
    --cat-care: #F3E5F5;
    --cat-makeup: #FCE4EC;
    --cat-fashion: #EDE7F6;
    --cat-kids: #E3F2FD;
    --cat-perfume: #FFF8E1;
    --cat-office: #ECEFF1;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 50%;
    
    /* Layout */
    --header-height: 56px;
    --bottom-nav-height: 60px;
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* === Reset === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.4;
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

input, textarea {
    font-family: inherit;
    font-size: inherit;
    border: none;
    outline: none;
    background: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* === App Container === */
.app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    /* безопасный отступ + дополнительный 8px, чтобы точно не залезать под статус-бар */
    padding-top: calc(env(safe-area-inset-top, 0px) + 8px);
}

/* === Header === */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: var(--header-height);
    /* Большой отступ под кнопки Telegram (закрытие/сворачивание) */
    padding: 0 var(--spacing-md);
    padding-top: calc(env(safe-area-inset-top, 0px) + 40px);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-logo {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
}

.header-logo:active {
    background: var(--bg-primary);
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.header-actions {
    display: flex;
    gap: var(--spacing-xs);
}

.header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

.header-btn:active {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* === Search Overlay === */
.search-overlay {
    position: fixed;
    /* Начинаем ПОД header (с учётом кнопок Telegram) */
    top: calc(var(--header-height) + env(safe-area-inset-top, 0px) + 40px);
    left: 0;
    right: 0;
    /* Не перекрываем нижнее меню */
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    z-index: 80;
    background: var(--bg-primary);
    padding-top: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Отключаем скроллинг основного контента когда открыт поиск */
body.search-open {
    overflow: hidden !important;
}

body.search-open #main-content {
    overflow: hidden !important;
}

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

.search-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.search-input-wrap {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.search-icon {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    height: 36px;
    font-size: 16px;
    color: var(--text-primary);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

.search-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    color: var(--text-tertiary);
}

.search-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-xs);
    padding: 0 var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.search-suggestion {
    padding: 6px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 var(--spacing-md);
    padding-bottom: var(--spacing-xl);
    -webkit-overflow-scrolling: touch;
}

/* Compact search results */
.search-results .products-grid {
    gap: var(--spacing-sm);
}

.search-results .product-card {
    border-radius: var(--radius-md);
}

.search-results .product-image {
    height: 100px;
}

.search-results .product-info {
    padding: var(--spacing-sm);
}

.search-results .product-title {
    font-size: 11px;
    -webkit-line-clamp: 1;
}

.search-results .product-price-new {
    font-size: 13px;
}

.search-results .product-price-old {
    font-size: 10px;
}

.search-results .product-add-btn {
    padding: 4px;
    font-size: 10px;
}

/* === Main Content === */
.main {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* === Pages === */
.page {
    display: none;
    padding: var(--spacing-md);
    padding-bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--spacing-md));
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-lg);
}

.page-title { order: 1; }
.page-header-spacer { order: 2; flex: 1; }
.back-btn { order: 3; }

.page-title {
    flex: 1;
    font-size: 20px;
    font-weight: 700;
}

.page-header-spacer {
    width: 40px;
}

.back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    color: var(--text-secondary);
}

.back-btn:active {
    background: var(--bg-primary);
}

/* === Stories === */
.stories-section {
    margin-bottom: var(--spacing-lg);
}

.stories-scroll {
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
    padding: var(--spacing-xs) 0;
    scrollbar-width: none;
}

.stories-scroll::-webkit-scrollbar {
    display: none;
}

.story-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.story-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-full);
    padding: 2px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.story-avatar-inner {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 2px solid var(--bg-primary);
    background: var(--bg-secondary);
}

.story-avatar-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-title {
    font-size: 11px;
    color: var(--text-secondary);
    max-width: 68px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Section === */
.section {
    margin-bottom: var(--spacing-xl);
}

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

.section-title {
    font-size: 18px;
    font-weight: 700;
}

.section-more-btn {
    font-size: 14px;
    color: var(--accent-sale);
    font-weight: 500;
}

/* === Family Section === */
.family-scroll {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding: var(--spacing-xs) 0;
    scrollbar-width: none;
}

.family-scroll::-webkit-scrollbar {
    display: none;
}

.family-card {
    display: flex;
    flex-direction: column;
    min-width: 130px;
    max-width: 130px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    flex-shrink: 0;
}

.family-card:active {
    transform: scale(0.98);
}

.family-card-image {
    width: 100%;
    height: 90px;
    background: var(--cat-family);
    display: flex;
    align-items: center;
    justify-content: center;
}

.family-card-image .emoji {
    font-size: 36px;
}

.family-card-info {
    padding: var(--spacing-sm);
}

.family-card-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Services === */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.service-card {
    display: flex;
    flex-direction: column;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
}

.service-card:active {
    transform: scale(0.98);
}

.service-icon {
    font-size: 28px;
    margin-bottom: var(--spacing-sm);
}

.service-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.service-price {
    font-size: 12px;
    color: var(--text-secondary);
}
.service-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-top: 4px;
}

.service-discount {
    display: inline-block;
    margin-top: var(--spacing-sm);
    padding: 2px 6px;
    background: var(--accent-secondary);
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 600;
}

/* === Banner === */
.banner-section {
    margin-bottom: var(--spacing-lg);
}

.banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--accent-primary) 0%, #F5E6E0 100%);
    border-radius: var(--radius-lg);
}

.banner-tag {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    display: block;
}

.banner-title {
    font-size: 18px;
    font-weight: 700;
}

.banner-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--text-primary);
    color: var(--text-inverse);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.banner-btn:active {
    transform: scale(0.96);
}

.banner-client {
    background: linear-gradient(135deg, var(--accent-secondary) 0%, #D4EDED 100%);
}

/* === Sale Section === */
.sale-scroll {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding: var(--spacing-xs) 0;
    scrollbar-width: none;
}

.sale-scroll::-webkit-scrollbar {
    display: none;
}

.sale-card {
    display: flex;
    flex-direction: column;
    min-width: 120px;
    max-width: 120px;
    height: auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-light);
    flex-shrink: 0;
    position: relative;
}

.sale-card-btn {
    display: flex;
    flex-direction: column;
    flex: 1;
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.sale-card-btn:active {
    transform: scale(0.98);
}

.sale-card:active {
    transform: scale(0.98);
}

.sale-card-image {
    position: relative;
    width: 100%;
    height: 90px;
    background: var(--cat-sale);
}

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

.sale-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    padding: 2px 6px;
    background: var(--accent-sale);
    color: var(--text-inverse);
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

.sale-card-info {
    padding: var(--spacing-sm);
}

.sale-card-title {
    font-size: 11px;
    font-weight: 500;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.sale-card-price {
    font-size: 13px;
    font-weight: 700;
}

.sale-card-add-btn {
    width: 100%;
    padding: 8px 6px;
    margin: 0;
    margin-top: auto;
    background: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
    display: flex !important;
    align-items: center;
    justify-content: center;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 10;
    position: relative;
}

.sale-card-add-btn:active {
    background: var(--accent-dark);
}

/* === Categories === */
.categories-scroll {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    padding: var(--spacing-xs) 0;
    scrollbar-width: none;
}

.categories-scroll::-webkit-scrollbar {
    display: none;
}

.category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    width: 80px;
    height: 90px;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
    flex-shrink: 0;
}

.category-card:active {
    transform: scale(0.96);
}

.category-emoji {
    font-size: 28px;
    margin-bottom: var(--spacing-xs);
}

.category-name {
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    line-height: 1.2;
}

.category-count {
    font-size: 9px;
    color: var(--text-tertiary);
}

/* === About === */
.about-section {
    margin-bottom: var(--spacing-xl);
}

.about-card {
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
}

.about-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.about-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
    overflow: hidden;
}

.about-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-name {
    font-size: 16px;
    font-weight: 600;
}

.about-role {
    font-size: 13px;
    color: var(--text-secondary);
}

.about-bio {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.about-channel-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-md);
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
}

.about-channel-btn:active {
    transform: scale(0.98);
}

/* === Products Grid === */
.products-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
}

.product-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

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

.product-image {
    position: relative;
    aspect-ratio: 1;
    background: var(--bg-primary);
}

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

.product-discount-badge {
    position: absolute;
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    padding: 3px 6px;
    background: var(--accent-sale);
    color: var(--text-inverse);
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-sm);
}

.product-family-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    font-size: 16px;
}

.product-family-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-xs);
}

.product-view-btn {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.product-tap-hint {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    white-space: nowrap;
    opacity: 0.8;
    pointer-events: none;
}

.product-info {
    padding: var(--spacing-sm);
}

.product-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-prices {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
}

.product-price-new {
    font-size: 15px;
    font-weight: 700;
}

.product-price-old {
    font-size: 12px;
    color: var(--text-tertiary);
    text-decoration: line-through;
}

.product-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
}

.product-add-btn:active {
    background: var(--accent-secondary);
}

.product-add-btn.added {
    background: var(--accent-success);
    color: var(--text-inverse);
}

/* Product Detail */
.product-detail-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

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

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

.product-detail-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.3;
}

.product-detail-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.product-detail-prices {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
}

.product-detail-actions {
    display: flex;
    gap: var(--spacing-sm);
}

.product-detail-btn {
    flex: 1;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    text-align: center;
}

.product-detail-btn.primary {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.product-detail-btn.ghost {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* === About Detail Page === */
.about-detail {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.about-detail-avatar {
    width: 100%;
    aspect-ratio: 1.6;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--bg-primary);
}

.about-detail-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-detail-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.about-detail-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-detail-banner {
    display: flex;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--accent-primary), #fbeae0);
    border-radius: var(--radius-lg);
    align-items: center;
}

.about-detail-banner-title {
    font-size: 16px;
    font-weight: 700;
}

.about-detail-banner-desc {
    font-size: 13px;
    color: var(--text-secondary);
}

.about-detail-btn {
    width: 100%;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    background: var(--accent-success);
    color: var(--text-inverse);
    font-size: 15px;
    font-weight: 700;
}

.about-detail-btn.secondary {
    background: var(--accent-primary);
    color: var(--text-primary);
}

/* === Family Categories List === */
.family-categories-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.family-category-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
}

.family-category-item:active {
    transform: scale(0.98);
}

.family-category-emoji {
    font-size: 32px;
}

.family-category-info {
    flex: 1;
}

.family-category-title {
    font-size: 15px;
    font-weight: 600;
}

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

/* === Family Sub === */
.family-sub-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-lg);
}

.family-products-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.family-product-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
}

.family-product-item:active {
    background: var(--bg-primary);
}

.family-product-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
}

.family-product-arrow {
    color: var(--text-tertiary);
}

/* === Bottom Categories Carousel === */
.bottom-categories-section {
    grid-column: 1 / -1;
    margin-top: var(--spacing-xl);
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.bottom-categories-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.bottom-categories-scroll {
    display: flex;
    gap: var(--spacing-sm);
    overflow-x: auto;
    scrollbar-width: none;
}

.bottom-categories-scroll::-webkit-scrollbar {
    display: none;
}

.bottom-category-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 70px;
    padding: var(--spacing-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-light);
    flex-shrink: 0;
}

.bottom-category-card:active {
    transform: scale(0.96);
}

.bottom-category-emoji {
    font-size: 20px;
    margin-bottom: 2px;
}

.bottom-category-name {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* === Load More === */
.load-more-wrap {
    display: flex;
    justify-content: center;
    padding: var(--spacing-lg) 0;
}

.loading-indicator {
    font-size: 14px;
    color: var(--text-secondary);
}

/* === Cart === */
.cart-content {
    min-height: 200px;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
}

.cart-empty-icon {
    font-size: 56px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.cart-empty-text {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.cart-empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-lg);
}

.cart-empty-btn {
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
}

.cart-items {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding-bottom: 200px; /* Место для фиксированного footer */
}

.cart-item {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
}

.cart-item-image {
    width: 70px;
    height: 70px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-primary);
}

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

.cart-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.cart-item-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.cart-item-price {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: auto;
}

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

.cart-qty-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--bg-primary);
    border-radius: var(--radius-full);
    font-size: 16px;
    color: var(--text-secondary);
}

.cart-qty-value {
    font-size: 14px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.cart-item-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--accent-sale);
}

.cart-footer {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom));
    left: 0;
    right: 0;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

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

.cart-total-label {
    font-size: 15px;
    color: var(--text-secondary);
}

.cart-total-value {
    font-size: 22px;
    font-weight: 700;
}

.cart-checkout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-md);
    background: var(--accent-success);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-inverse);
}

.cart-checkout-btn:active {
    transform: scale(0.98);
}

/* === Profile === */
.profile-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.profile-card {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
}

.profile-avatar {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border-radius: var(--radius-full);
    font-size: 24px;
    font-weight: 700;
}

.profile-name {
    font-size: 18px;
    font-weight: 700;
}

.profile-phone {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-fields {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.profile-field {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
}

.profile-field:last-child {
    border-bottom: none;
}

.profile-field-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-field-value {
    font-size: 14px;
    font-weight: 500;
}

.profile-field-value.profile-field-empty {
    color: var(--text-tertiary);
    font-style: italic;
}

.profile-menu {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.profile-menu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

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

.profile-menu-item:active {
    background: var(--bg-primary);
}

.profile-menu-icon {
    font-size: 18px;
}

.profile-menu-text {
    flex: 1;
    font-size: 15px;
}

.profile-menu-arrow {
    color: var(--text-tertiary);
}

/* === Help === */
.help-content {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.help-section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.help-chat-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-light);
}

.help-chat-input-wrap {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.help-chat-input {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    font-size: 15px;
    resize: none;
}

.help-chat-send {
    padding: var(--spacing-md);
    background: var(--accent-success);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-inverse);
}

.help-chat-send:active {
    transform: scale(0.98);
}

.help-chat-hint {
    font-size: 13px;
    color: var(--text-tertiary);
    text-align: center;
    margin-top: var(--spacing-sm);
}

.help-faq-section {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-light);
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.faq-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    font-size: 14px;
    text-align: left;
}

.faq-item:active {
    background: var(--border-color);
}

.faq-arrow {
    color: var(--text-tertiary);
    font-size: 12px;
}

.faq-answer {
    padding: var(--spacing-md);
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.5;
}

/* === Service Detail === */
.service-detail {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.service-detail-card {
    padding: var(--spacing-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-light);
}

.service-detail-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-md);
}

.service-detail-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.service-detail-price {
    font-size: 17px;
    font-weight: 600;
    color: var(--accent-sale);
    margin-bottom: var(--spacing-md);
}

.service-detail-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.service-detail-discount {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--accent-secondary);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-md);
    font-size: 13px;
    font-weight: 500;
}

.service-book-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: var(--spacing-md);
    background: var(--accent-success);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-inverse);
}

.service-book-btn:active {
    transform: scale(0.98);
}

/* === Edit Profile === */
.edit-profile-content {
    padding: 0;
}

.edit-profile-form {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-hint {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--text-tertiary);
}

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 15px;
}

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

.form-submit-btn {
    width: 100%;
    padding: var(--spacing-md);
    margin-top: var(--spacing-md);
    background: var(--accent-success);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-inverse);
}

.form-submit-btn:active {
    transform: scale(0.98);
}

/* === Settings === */
.settings-content {
    padding: 0;
}

.settings-list {
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.settings-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

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

.settings-item:active {
    background: var(--bg-primary);
}

.settings-icon {
    font-size: 18px;
}

.settings-text {
    flex: 1;
    font-size: 15px;
}

.settings-arrow {
    color: var(--text-tertiary);
}

.settings-toggle {
    position: relative;
    width: 50px;
    height: 28px;
}

.settings-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-tertiary);
    border-radius: 28px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background-color: var(--accent-success);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* === Orders === */
.orders-content {
    padding: 0;
}

.orders-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xl);
    text-align: center;
}

.orders-empty-icon {
    font-size: 56px;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

.orders-empty-text {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

/* === Partner Page === */
.partner-content {
    padding: var(--spacing-md);
}

.partner-benefits {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.partner-benefits-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.partner-benefit-item {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.benefit-icon {
    font-size: 24px;
    min-width: 36px;
    text-align: center;
}

.benefit-text {
    flex: 1;
}

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

.benefit-text span {
    font-size: 12px;
    color: var(--text-secondary);
}

.partner-form {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.partner-form-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--spacing-md);
    text-align: center;
}

.partner-note {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    padding: 0 var(--spacing-md);
}

/* === Book Service Page === */
.book-service-content {
    padding: var(--spacing-md);
}

.book-service-info {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    text-align: center;
}

.book-service-icon {
    font-size: 48px;
    margin-bottom: var(--spacing-sm);
}

.book-service-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.book-service-price {
    font-size: 15px;
    color: var(--text-secondary);
}

.book-service-form {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

/* === Privacy Page === */
.privacy-content {
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    margin: var(--spacing-md);
    border-radius: var(--radius-lg);
}

.privacy-content h2 {
    font-size: 18px;
    margin-bottom: var(--spacing-md);
}

.privacy-content h3 {
    font-size: 15px;
    margin: var(--spacing-md) 0 var(--spacing-sm);
    color: var(--text-primary);
}

.privacy-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    line-height: 1.5;
}

.privacy-content ul {
    margin: 0 0 var(--spacing-md) var(--spacing-md);
    padding: 0;
}

.privacy-content li {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
}

.privacy-content a {
    color: var(--accent-primary);
    text-decoration: none;
}

.privacy-date {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--spacing-lg);
    text-align: center;
}

.orders-empty-hint {
    font-size: 14px;
    color: var(--text-secondary);
}

/* === Bottom Navigation === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--bottom-nav-height);
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex: 1;
    padding: var(--spacing-xs) 0;
    color: var(--text-tertiary);
    position: relative;
}

.nav-item.active {
    color: var(--text-primary);
}

.nav-icon {
    width: 24px;
    height: 24px;
}

.nav-label {
    font-size: 10px;
    font-weight: 500;
}

/* Расставляем порядок во внутреннем меню: Домой слева, Корзина центр, Назад справа */
/* Фиксированный порядок кнопок: Домой слева, Корзина центр, Назад справа */
#bottom-nav-inner {
    display: flex;
}
#bottom-nav-inner .nav-item[data-page="home"] { order: 1; }
#bottom-nav-inner .nav-item[data-page="cart"] { order: 2; }
#bottom-nav-inner .nav-back-btn { order: 3; }

/* То же для search navigation */
#bottom-nav-search {
    display: flex;
}
#bottom-nav-search #search-nav-home { order: 1; }
#bottom-nav-search #search-nav-cart { order: 2; }
#bottom-nav-search #search-nav-back { order: 3; }

.nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    background: var(--accent-sale);
    color: var(--text-inverse);
    font-size: 10px;
    font-weight: 700;
    border-radius: 8px;
}

/* === Toast === */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-area-bottom) + var(--spacing-md));
    left: 50%;
    transform: translateX(-50%);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--text-primary);
    color: var(--text-inverse);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-lg);
    z-index: 300;
    opacity: 0;
    transition: opacity 0.3s;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
}

/* === Quantity Dialog === */
.quantity-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

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

.quantity-dialog {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 320px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.quantity-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 15px;
}

.quantity-dialog-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-dialog-product {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
}

.quantity-dialog-product img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: var(--radius-md);
    background: var(--bg-primary);
}

.quantity-dialog-title {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.quantity-dialog-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-primary);
}

.quantity-dialog-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-lg);
    padding: var(--spacing-md);
}

.qty-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--bg-primary);
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.qty-btn:active {
    transform: scale(0.95);
    background: var(--accent-primary);
}

.qty-value {
    font-size: 28px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

.quantity-dialog-confirm {
    width: calc(100% - var(--spacing-md) * 2);
    margin: 0 var(--spacing-md) var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--accent-primary);
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.quantity-dialog-confirm:active {
    background: var(--accent-secondary);
}

/* === Loading === */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: var(--radius-full);
    animation: spin 0.8s linear infinite;
}

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

/* === Utilities === */
.hidden {
    display: none !important;
}

/* === Dark Theme === */
body.dark-theme {
    --bg-primary: #1C1C1E;
    --bg-secondary: #2C2C2E;
    --text-primary: #FFFFFF;
    --text-secondary: #ABABAB;
    --text-tertiary: #6C6C70;
    --text-inverse: #1C1C1E;
    --border-color: #3A3A3C;
    --accent-primary: #D4A574;
    --accent-secondary: #7AB8B8;
    --accent-success: #30D158;
}

body.dark-theme .header {
    background: rgba(28, 28, 30, 0.95);
}

body.dark-theme .bottom-nav {
    background: rgba(28, 28, 30, 0.98);
    border-top-color: var(--border-color);
}

body.dark-theme .search-overlay {
    background: var(--bg-primary);
}

body.dark-theme .loading-overlay {
    background: rgba(28, 28, 30, 0.8);
}

body.dark-theme .quantity-dialog-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-theme .toast {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
