:root {
    --bg: #12100e;
    --bg-deep: #0a0908;
    --surface: rgba(18, 15, 12, 0.85);
    --orange: #e8881a;
    --orange-bright: #f5a623;
    --orange-glow: rgba(245, 166, 35, 0.45);
    --orange-dim: rgba(245, 166, 35, 0.22);
    --text: #ffffff;
    --text-dim: #8a8a8a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "Segoe UI", Roboto, -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    position: relative;
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    padding: 0 16px 80px;
    isolation: isolate;
}

#app > *:not(.bg-layer) { position: relative; z-index: 1; }

/* ── Background ── */
.bg-layer {
    position: fixed;
    inset: 0;
    max-width: 430px;
    margin: 0 auto;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.bg-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 50% at 50% -5%, rgba(245, 166, 35, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 70% 40% at 50% 105%, rgba(245, 166, 35, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse 40% 60% at -5% 50%, rgba(245, 166, 35, 0.06) 0%, transparent 45%),
        radial-gradient(ellipse 40% 60% at 105% 50%, rgba(245, 166, 35, 0.06) 0%, transparent 45%),
        linear-gradient(180deg, #1a1612 0%, #12100e 35%, #100e0b 70%, #0a0908 100%);
    box-shadow:
        inset 0 0 100px rgba(245, 166, 35, 0.04),
        inset 0 0 0 1px rgba(245, 166, 35, 0.12);
}

.bg-texture {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    background-size: 180px 180px;
    mix-blend-mode: overlay;
}

#app[data-view="home"] .title-row { display: none; }
#app[data-view="home"] .header-row { margin-bottom: 22px; }

/* ── Header ── */
.header { padding-top: 12px; }

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}

.compass {
    width: 36px;
    height: 36px;
    color: var(--orange);
    filter: drop-shadow(0 0 6px var(--orange-glow));
}

.compass svg { width: 100%; height: 100%; }

.cart-btn {
    position: relative;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1.5px solid var(--orange);
    border-radius: 10px;
    color: var(--orange);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px var(--orange-glow), inset 0 0 8px rgba(245, 166, 35, 0.05);
}

.cart-btn svg { width: 22px; height: 22px; }

.cart-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: var(--orange-bright);
    color: #000;
    font-size: 11px;
    font-weight: 800;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 8px var(--orange-glow);
}

.title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.page-title {
    flex: 1;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    text-align: center;
    color: var(--text);
}

.page-title:empty { display: none; }

.title-row:has(.page-title:empty) { display: none; }

.nav-back {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 14px;
    background: rgba(245, 166, 35, 0.12);
    border: 1.5px solid var(--orange);
    border-radius: 12px;
    color: var(--orange-bright);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 14px var(--orange-dim);
    text-align: left;
}

.nav-back.hidden { display: none; }

.nav-back-icon {
    font-size: 18px;
    line-height: 1;
    font-weight: 400;
}

/* ── Footer ornament ── */
.footer-ornament {
    position: fixed;
    bottom: 12px;
    right: 12px;
    width: 100px;
    height: 70px;
    color: var(--orange);
    opacity: 0.55;
    pointer-events: none;
    filter: drop-shadow(0 0 4px var(--orange-glow));
}

.footer-ornament svg { width: 100%; height: 100%; }

/* ── List cards (categories / subcategories) ── */
.content { display: flex; flex-direction: column; gap: 10px; }

.list-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1.5px solid var(--orange);
    border-radius: 14px;
    background: var(--surface);
    cursor: pointer;
    box-shadow: 0 0 14px var(--orange-dim), inset 0 0 20px rgba(245, 166, 35, 0.03);
    transition: box-shadow 0.15s;
}

.list-card:active { box-shadow: 0 0 22px var(--orange-glow); }

.list-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    color: var(--orange);
    filter: drop-shadow(0 0 5px var(--orange-glow));
}

.list-icon svg { width: 100%; height: 100%; }

.list-name {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.3;
}

.list-arrow {
    color: var(--orange);
    font-size: 20px;
    font-weight: 300;
    opacity: 0.9;
    filter: drop-shadow(0 0 4px var(--orange-glow));
}

/* ── Products ── */
.product-card {
    border: 1.5px solid var(--orange);
    border-radius: 14px;
    background: var(--surface);
    overflow: hidden;
    box-shadow: 0 0 10px var(--orange-dim);
}

.product-card.expanded {
    border-color: var(--orange-bright);
    box-shadow: 0 0 16px var(--orange-glow);
}

.product-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
}

.product-details {
    padding: 12px 12px 0;
}

.product-card.expanded .product-row {
    border-top: 1px solid var(--orange-dim);
    margin-top: 10px;
}

.product-details-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 10px;
    border: 1px solid var(--orange-dim);
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 48px;
}

.product-details-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-specs,
.product-desc {
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.55;
    margin-top: 10px;
}

.product-specs p,
.product-desc p {
    margin: 0 0 8px;
}

.product-specs p:last-child,
.product-desc p:last-child {
    margin-bottom: 0;
}

.row-thumb {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--orange-dim);
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-size: 22px;
}

.row-thumb img { width: 100%; height: 100%; object-fit: cover; }

.row-info { flex: 1; min-width: 0; }

.row-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 3px;
}

.row-price {
    font-size: 14px;
    font-weight: 800;
    color: var(--orange-bright);
    text-shadow: 0 0 8px var(--orange-glow);
}

.row-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.add-btn,
.edit-btn,
.visibility-btn {
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1.5px solid var(--orange);
    border-radius: 8px;
    color: var(--orange-bright);
    cursor: pointer;
    box-shadow: 0 0 10px var(--orange-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.add-btn svg,
.edit-btn svg,
.visibility-btn svg { width: 18px; height: 18px; }

.product-card.dimmed {
    opacity: 0.4;
}

.qty-controls {
    display: flex;
    align-items: center;
    gap: 2px;
    border: 1.5px solid var(--orange);
    border-radius: 8px;
    padding: 2px 4px;
    box-shadow: 0 0 10px var(--orange-dim);
}

.qty-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    color: var(--orange-bright);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.qty-num {
    min-width: 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: var(--orange-bright);
}

.add-product-card {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 72px;
    padding: 10px 12px;
    border: 1.5px dashed var(--orange);
    border-radius: 14px;
    background: var(--surface);
    color: var(--orange-bright);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 10px var(--orange-dim);
}

.add-product-card:active { box-shadow: 0 0 16px var(--orange-glow); }

/* ── Cart ── */
.cart-empty, .loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 14px;
}

.cart-empty small { display: block; margin-top: 8px; font-size: 11px; color: #666; }

.cart-total-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 430px;
    padding: 14px 16px 20px;
    background: linear-gradient(to top, var(--bg) 80%, transparent);
    border-top: 1.5px solid var(--orange-dim);
}

.cart-total-bar .total {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.cart-total-bar .total span {
    color: var(--orange-bright);
    text-shadow: 0 0 8px var(--orange-glow);
}

/* ── Buttons ── */
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--orange-bright);
    border: none;
    border-radius: 12px;
    color: #000;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 0 16px var(--orange-glow);
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1.5px solid var(--orange-dim);
    border-radius: 12px;
    color: var(--text);
    font-size: 14px;
    margin-top: 8px;
    cursor: pointer;
}

.btn-danger {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid #c0392b;
    border-radius: 12px;
    color: #e74c3c;
    font-size: 14px;
    margin-bottom: 8px;
    cursor: pointer;
}

/* ── Modals ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.visible { display: flex; }

.modal-content {
    background: var(--surface);
    border: 1.5px solid var(--orange);
    border-radius: 16px;
    padding: 22px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 0 30px var(--orange-glow);
}

.modal-content h2 { margin-bottom: 14px; font-size: 16px; letter-spacing: 1px; }

.modal-content input,
.modal-content textarea {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--bg);
    border: 1px solid var(--orange-dim);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    outline: none;
}

.modal-content textarea { height: 80px; resize: none; }

.modal-total { font-size: 15px; font-weight: 700; margin-bottom: 14px; text-align: center; }
.modal-total span { color: var(--orange-bright); }

.delivery-label {
    font-size: 12px;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.delivery-options {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 14px;
}

.delivery-btn {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    background: transparent;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 11px;
    line-height: 1.25;
    text-align: center;
    cursor: pointer;
}

.delivery-btn.active {
    border-color: var(--orange);
    color: var(--orange-bright);
    box-shadow: 0 0 10px var(--orange-dim);
}

.image-preview {
    width: 100%;
    height: 120px;
    margin-bottom: 10px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--orange-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview:empty::before { content: "Нет изображения"; color: var(--text-dim); font-size: 12px; }

/* ── Admin ── */
.admin-bar,
.admin-bar.hidden { display: none; }

