:root {
    --bg-color: #171717;
    --card-bg: #262626;
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --accent: #34d399;
    --btn-bg: #ffffff;
}

body {
    margin: 0; padding: 0;
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
    padding-bottom: 90px;
}

.hidden { display: none !important; }
.container { padding: 16px; }

/* Header & Categories */
header { margin: 8px 0 24px 0; }
header h1 { font-size: 28px; font-weight: 900; line-height: 1.1; margin: 0; }
header span { color: var(--text-muted); }
header p { color: var(--text-muted); font-size: 14px; margin-top: 8px; }

.category-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.category-card {
    background-color: var(--card-bg);
    border: 1px solid #404040; border-radius: 16px;
    padding: 24px 16px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center; cursor: pointer;
}
.category-card:active { transform: scale(0.96); transition: 0.1s; }
.cat-icon { font-size: 32px; background: rgba(255,255,255,0.05); padding: 12px; border-radius: 50%; margin-bottom: 12px; }
.cat-name { font-weight: 700; font-size: 15px; }
.cat-count { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Product List */
.nav-header { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.back-btn { background: none; border: none; color: var(--text-muted); padding: 4px; cursor: pointer; }
.product-list { display: flex; flex-direction: column; gap: 12px; }

.product-card {
    background-color: var(--card-bg);
    border: 1px solid #404040; border-radius: 12px;
    overflow: hidden;
    display: flex;
    height: 124px; /* Чуть увеличил высоту для эффектов */
    cursor: pointer;
}
.product-card:active { background-color: #303030; }

.prod-img { width: 110px; height: 100%; object-fit: cover; flex-shrink: 0; }

.prod-info {
    flex: 1;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-width: 0; /* ВАЖНО: Исправляет исчезновение кнопки */
}

.prod-header { margin-bottom: 4px; }
.prod-title {
    font-weight: 700; font-size: 15px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prod-desc {
    font-size: 11px; color: var(--text-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    margin-top: 2px;
}

/* Новые мини-теги */
.mini-tags { display: flex; gap: 4px; margin-top: 6px; overflow: hidden; }
.mini-tag {
    font-size: 9px; background: #333; color: #ccc;
    padding: 2px 6px; border-radius: 4px; border: 1px solid #444; white-space: nowrap;
}

.prod-footer {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: auto; /* Прижимает цену к низу */
}
.prod-price { color: var(--accent); font-weight: 700; font-size: 15px; }

.add-btn-mini {
    background: var(--btn-bg); color: black;
    border: none; border-radius: 8px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; /* Запрещает кнопке сжиматься */
}

/* Product Modal */
.product-detail {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--bg-color); z-index: 50;
    overflow-y: auto;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.detail-img-container { position: relative; height: 380px; width: 100%; }
.detail-img { width: 100%; height: 100%; object-fit: cover; }
.close-detail {
    position: absolute; top: 16px; left: 16px;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(10px);
    color: white; border: none; border-radius: 50%;
    width: 40px; height: 40px; font-size: 24px; cursor: pointer;
    z-index: 60;
}
.detail-content {
    background-color: var(--bg-color); border-radius: 24px 24px 0 0;
    margin-top: -24px; position: relative; padding: 24px; min-height: 50vh;
}
.drag-handle { width: 48px; height: 6px; background: #404040; border-radius: 3px; margin: 0 auto 24px auto; }
.detail-price { font-size: 24px; color: var(--accent); font-weight: 700; margin-bottom: 24px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; }
.detail-text { color: #d4d4d4; line-height: 1.5; margin-bottom: 24px; }
.tag-container { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tag { background: #333; color: #d4d4d4; padding: 4px 12px; border-radius: 8px; font-size: 13px; border: 1px solid #404040; }
.add-to-cart-lg {
    width: 100%; background: var(--btn-bg); color: black;
    font-weight: 700; font-size: 16px; padding: 16px;
    border-radius: 12px; border: none; cursor: pointer;
}

/* Cart Button */
.sticky-cart {
    position: fixed; bottom: 24px; left: 16px; right: 16px;
    background: var(--btn-bg); color: black;
    padding: 14px 24px; border-radius: 16px;
    display: flex; justify-content: space-between; align-items: center;
    font-weight: 700; font-size: 18px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5); z-index: 40;
    cursor: pointer;
    animation: bounceIn 0.4s;
}
.badge { background: black; color: white; font-size: 12px; padding: 2px 8px; border-radius: 6px; margin-right: 8px; }

/* Animations */
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes bounceIn { 0% { transform: scale(0.9); opacity: 0; } 70% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
.animate-slide-in { animation: slideIn 0.2s ease-out; }

/* Стили для Корзины */
.cart-item {
    background-color: var(--card-bg);
    border: 1px solid #404040; border-radius: 12px;
    padding: 12px; display: flex; align-items: center; gap: 12px;
}
.cart-img { width: 60px; height: 60px; border-radius: 8px; object-fit: cover; }
.cart-info { flex: 1; }
.cart-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.cart-price { color: var(--accent); font-size: 13px; font-weight: 700; }

.cart-controls {
    display: flex; align-items: center; gap: 8px;
    background: #1a1a1a; padding: 4px; border-radius: 8px;
}
.qty-btn {
    width: 28px; height: 28px;
    background: #333; color: white; border: none; border-radius: 6px;
    display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.qty-val { font-size: 14px; font-weight: 700; min-width: 20px; text-align: center; }

/* Поля ввода */
.input-field {
    width: 100%; box-sizing: border-box;
    background: var(--card-bg); border: 1px solid #404040;
    color: white; padding: 14px; border-radius: 12px;
    font-size: 16px; margin-bottom: 8px; outline: none;
    font-family: inherit;
}
.input-field:focus { border-color: var(--text-muted); }
.input-field::placeholder { color: #666; }

/* Стили для подсказок города */
.suggestions-box {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--card-bg);
    border: 1px solid #404040;
    border-radius: 12px;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    margin-top: 4px;
}
.suggestion-item {
    padding: 12px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    font-size: 14px;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover { background-color: #333; }

/* Неактивное поле */
.input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #1a1a1a;
}