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

:root {
    --bg: #ffffff;
    --text: #111111;
    --gray-light: #f7f7f7;
    --gray-mid: #e5e5e5;
    --gray-dark: #6c6c6c;
    --border: #d1d1d1;
    --accent: #000000;
    --shadow: 0 4px 12px rgba(0,0,0,0.04);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Иконки Material Symbols */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    line-height: 1;
}

.spinning {
    animation: spin 1s linear infinite;
}

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

/* HEADER */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-wrap: wrap;
    gap: 16px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo {
    height: 44px;
    width: auto;
    object-fit: contain;
}

.brand-name {
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.header-center {
    display: flex;
}

.nav-btn {
    background: var(--gray-light);
    border: 1px solid var(--border);
    padding: 10px 22px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 40px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    transition: background 0.15s;
    margin-right: 22px;
}

.nav-btn:hover {
    background: var(--gray-mid);
}

.header-right {
    display: flex;
    align-items: center;
}

.search-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 48px;
    background: white;
    padding-left: 16px;
}

.search-icon {
    color: var(--gray-dark);
    font-size: 22px;
}

.search-input {
    border: none;
    padding: 12px 8px 12px 4px;
    font-size: 1rem;
    min-width: 240px;
    outline: none;
    background: transparent;
}

.search-select {
    border: none;
    border-left: 1px solid var(--border);
    padding: 0 12px;
    background: white;
    font-size: 0.95rem;
    outline: none;
    cursor: pointer;
    height: 48px;
}

.search-btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 0 48px 48px 0;
    transition: opacity 0.15s;
}

.search-btn:hover {
    opacity: 0.85;
}

/* BREADCRUMB */
.breadcrumb {
    padding: 16px 28px 8px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 0.95rem;
    color: var(--gray-dark);
    border-bottom: 1px solid var(--gray-mid);
}

.breadcrumb-item {
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 30px;
    transition: background 0.1s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.breadcrumb-item:hover {
    background: var(--gray-light);
}

.breadcrumb-item.active {
    font-weight: 600;
    color: #000;
    pointer-events: none;
}

.breadcrumb-separator {
    color: var(--gray-dark);
    user-select: none;
    margin: 0 2px;
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    padding: 28px;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px;
    font-size: 1.4rem;
    color: var(--gray-dark);
}

/* Сетки категорий / брендов / товаров */
.section-title {
    font-size: 1.9rem;
    font-weight: 600;
    margin-bottom: 28px;
}

.category-grid, .brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
    margin-bottom: 48px;
}

.category-card, .brand-card {
    background: var(--gray-light);
    border-radius: 20px;
    padding: 24px 12px;
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform 0.1s, box-shadow 0.1s;
}

.category-card:hover, .brand-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
}

.category-icon, .brand-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 48px;
}

.category-name, .brand-name {
    font-weight: 500;
    font-size: 1.1rem;
}

/* Товарная сетка */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 24px;
}

.product-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    transition: box-shadow 0.15s;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: var(--shadow);
}

.product-image {
    aspect-ratio: 1 / 1;
    background: #fafafa;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

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

.product-info {
    padding: 16px 16px 20px;
}

.product-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-price {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.installment-hint {
    font-size: 0.85rem;
    color: var(--gray-dark);
}

/* ===== СТРАНИЦА ТОВАРА ===== */
.product-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}

/* Левая колонка — галерея */
.product-gallery {
    position: sticky;
    top: 20px;
}

.main-image-container {
    background: #fbfbfb;
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    cursor: pointer;
    user-select: none;
}

.main-image {
    max-width: 100%;
    max-height: 450px;
    object-fit: contain;
}

.thumbnail-list {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.thumbnail {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: white;
    padding: 6px;
    cursor: pointer;
    transition: border 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.thumbnail.active {
    border: 2px solid #000;
}

.thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Правая колонка — информация */
.product-details {
    padding-top: 8px;
}

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

.product-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    color: var(--gray-dark);
}

.product-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.price-block {
    margin: 28px 0 24px;
}

.current-price {
    font-size: 2.8rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.installment-section {
    background: var(--gray-light);
    border-radius: 24px;
    padding: 24px;
    margin: 28px 0;
}

.installment-title {
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.installment-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.installment-card {
    background: white;
    border-radius: 16px;
    padding: 16px 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.installment-months {
    font-weight: 600;
    margin-bottom: 6px;
}

.installment-value {
    font-size: 1.3rem;
    font-weight: 700;
}

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

.description-title {
    font-weight: 600;
    margin-bottom: 16px;
}

.description-text {
    color: var(--gray-dark);
    line-height: 1.7;
    white-space: pre-line;
}

/* Кнопка "Назад" на странице товара (в breadcrumb уже есть, но можно добавить и отдельную) */
.back-button-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-dark);
}

/* Уведомления (тосты) */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: #1e1e1e;
    color: white;
    padding: 14px 24px;
    border-radius: 60px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    font-size: 1rem;
    font-weight: 500;
    max-width: 400px;
    animation: slideIn 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast.error {
    background: #c62828;
}

.toast.success {
    background: #1b5e20;
}

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

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 60px;
    color: var(--gray-dark);
    font-size: 1.3rem;
}

/* Адаптивность */
@media (max-width: 900px) {
    .product-page {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    .product-gallery {
        position: static;
    }
    .main-image-container {
        min-height: 300px;
    }
}

@media (max-width: 700px) {
    .header {
        padding: 12px 16px;
    }
    .search-wrapper {
        width: 100%;
    }
    .search-input {
        min-width: 0;
        flex: 1;
    }
    .brand-name {
        font-size: 1.6rem;
    }
    .installment-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* PWA o'rnatish tugmasi - faqat Android */
.pwa-install-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: #2e7d32; /* success yashil rangi */
    color: white;
    border: none;
    border-radius: 40px;
    padding: 10px 20px;
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(5px);
    min-width: 120px;
    text-transform: none;
    letter-spacing: 0.3px;
}

.pwa-install-btn:hover {
    background-color: #1b5e20;
    box-shadow: 0 6px 18px rgba(27, 94, 32, 0.5);
    transform: translateY(-2px);
}

.pwa-install-btn:active {
    transform: translateY(0) scale(0.96);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

.pwa-install-btn .material-symbols-outlined {
    font-size: 20px;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* Mobil qurilmalar uchun moslashtirish */
@media (max-width: 768px) {
    .pwa-install-btn {
        bottom: 16px;
        right: 16px;
        padding: 8px 16px;
        font-size: 13px;
        min-width: 110px;
    }
    
    .pwa-install-btn .material-symbols-outlined {
        font-size: 18px;
    }
}