﻿/* GREENPREMIUM Web App — Telegram-тема (светлая/тёмная через themeParams) */
:root {
    --bg: #f5f6f0;
    --bg-soft: #eceee4;
    --card: #ffffff;
    --text: #24312a;
    --muted: #7a857d;
    --accent: #2e5d3a;
    --accent-text: #ffffff;
    --accent-2: #3f7d4e;
    --green: #3f7d4e;
    --line: #e2e5da;
    --radius: 14px;
    --shadow: 0 1px 6px rgba(46,93,58,.08);
}

.tg-dark {
    --bg: #121a15;
    --bg-soft: #1b271f;
    --card: #18221b;
    --text: #e8efe9;
    --muted: #8fa395;
    --line: #23312a;
    --shadow: 0 2px 10px rgba(0,0,0,.3);
    --green: #8fd4a0;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
}
.hidden { display: none !important; }
.view { padding: 0 16px 24px; animation: fade .25s; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Topbar — градиентная шапка, бренд по центру, кнопки по краям */
.topbar {
    position: relative; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    padding: 14px 12px 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-text);
    border-radius: 0 0 18px 18px;
    margin: -16px -16px 0;
    min-height: 52px;
}
.topbar .cart-btn, .topbar .back-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(255,255,255,.18); color: var(--accent-text); border: 1px solid rgba(255,255,255,.3);
    border-radius: 20px; cursor: pointer;
}
.topbar .cart-btn { right: 12px; padding: 8px 14px; font-size: 14px; }
.topbar .back-btn { left: 8px; width: 40px; height: 40px; font-size: 20px; background: none; border: none; color: var(--accent-text); }
.topbar .brand, .topbar .brand.small { color: var(--accent-text); }
.topbar .brand span { color: rgba(255,255,255,.9); }
.brand { font-weight: 700; font-size: 18px; letter-spacing: .5px; }
.brand-mark { color: var(--green); }
.brand.small { font-size: 15px; }

/* Hero */
.hero-banner { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text); border-radius: 0; padding: 6px 16px 20px; margin: 0; }
.hero-banner h1 { font-size: 24px; margin-bottom: 6px; font-weight: 700; }
.hero-banner p { font-size: 14px; opacity: .92; line-height: 1.5; }
.hero-badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.h-badge { background: rgba(255,255,255,.15); backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.25); border-radius: 20px; padding: 5px 12px; font-size: 12px; color: var(--accent-text); }

/* Секции (заголовки как в Telegram) */
.section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); padding: 6px 2px 8px; }
.section-title.sub { padding-top: 18px; }

/* Категории */
.cats { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 4px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat-chip {
    background: var(--bg-soft); border: 1px solid var(--line); border-radius: 18px;
    padding: 8px 15px; font-size: 13px; white-space: nowrap; cursor: pointer; color: var(--text); transition: all .2s;
}
.cat-chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }

/* Сетка товаров — карточки-строки (Telegram-вид) */
.grid { display: flex; flex-direction: column; gap: 10px; }
.card {
    display: flex; align-items: center; gap: 12px; background: var(--card);
    border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
    cursor: pointer; transition: background .15s;
}
.card:active { background: var(--bg-soft); }
.card-img { width: 64px; height: 64px; border-radius: 12px; object-fit: cover; background: var(--bg-soft); flex: 0 0 64px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.card-body { flex: 1; min-width: 0; }
.card-name { font-weight: 600; font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-weight { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.card-price { color: var(--accent); font-weight: 700; font-size: 17px; }
.card-add { background: var(--accent); color: var(--accent-text); border: none; border-radius: 10px; padding: 5px 16px; font-size: 13px; font-weight: 600; cursor: pointer; min-width: 62px; }
.card-add:active { opacity: .85; }

/* Карточка товара */
.product-hero { width: 100%; height: 240px; object-fit: cover; border-radius: var(--radius); background: var(--bg-soft); }
.product-name { font-size: 22px; font-weight: 700; margin: 12px 0 4px; }
.product-price { font-size: 20px; color: var(--accent); font-weight: 700; margin-bottom: 12px; }
.product-section { margin: 12px 0; }
.product-section h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); letter-spacing: 1px; margin-bottom: 4px; }
.product-section p { font-size: 14px; }
.bju-row { display: flex; gap: 8px; }
.bju-item { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px; text-align: center; }
.bju-item b { display: block; font-size: 15px; color: var(--accent); }
.bju-item span { font-size: 11px; color: var(--muted); }
.btn-add-big { width: 100%; background: var(--accent); color: var(--accent-text); border: none; border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 600; cursor: pointer; margin-top: 12px; }

/* Корзина */
.cart-item { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 10px; padding: 10px; margin-bottom: 8px; box-shadow: var(--shadow); }
.cart-item img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; }
.cart-item-info { flex: 1; }
.cart-item-name { font-size: 14px; font-weight: 600; }
.cart-item-price { font-size: 13px; color: var(--accent); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 16px; cursor: pointer; }
.qty span { min-width: 20px; text-align: center; }
.promo { display: flex; gap: 8px; margin: 12px 0; }
.promo input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 14px; background: var(--card); color: var(--text); }
.promo button { background: var(--accent); color: var(--accent-text); border: none; border-radius: 8px; padding: 10px 14px; cursor: pointer; font-size: 13px; font-weight: 600; }
.cart-total { font-size: 18px; font-weight: 700; text-align: right; margin: 12px 0; }
.btn-primary { width: 100%; background: var(--accent); color: var(--accent-text); border: none; border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 600; cursor: pointer; }

/* Чекаут */
#checkout-form { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
#checkout-form label { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
#checkout-form input, #checkout-form select, #checkout-form textarea {
    border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 15px; font-family: inherit; color: var(--text);
    background: var(--card);
}
#checkout-form input:focus, #checkout-form select:focus, #checkout-form textarea:focus { outline: 1px solid var(--accent); }
.pay-note { font-size: 12px; color: var(--muted); text-align: center; }
.disclaimer { font-size: 11px; color: var(--muted); text-align: center; margin: 2px 0; }
.consent { flex-direction: row !important; align-items: flex-start; gap: 8px !important; font-size: 12px !important; color: var(--muted) !important; cursor: pointer; }
.consent input { width: 18px; height: 18px; margin-top: 2px; flex: 0 0 auto; }
.consent a { color: var(--accent); }

/* Подтверждение */
.done-box { text-align: center; padding: 60px 20px; }
.done-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: var(--accent-text); font-size: 30px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }
.done-box h2 { margin-bottom: 8px; }
.done-box p { color: var(--muted); margin-bottom: 24px; }

/* Плейсхолдеры фото */
.photo-ph {
    background: var(--bg-soft);
    display: flex; align-items: center; justify-content: center;
    color: var(--muted); font-size: 11px;
    border-radius: 8px;
}
.cart-photo { width: 48px; height: 48px; flex: 0 0 48px; font-size: 10px; }

/* Картинки товаров */
.card-img img, .product-hero img, .cart-photo img {
    width: 100%; height: 100%; object-fit: cover; border-radius: inherit; display: block;
}

