:root {
    /* Bauhaus Palette - Light Theme (Phase 1) */
    --bg-color: #F5F3EF;
    --surface-color: #FFFFFF;
    --surface-hover: #FFF0E0;
    --text-primary: #2B2622;
    --text-secondary: #6B6B6B;
    --accent-color: #C67C4E;
    --accent-contrast: #FFFFFF;
    --accent-light: rgba(198, 124, 78, 0.12);
    --separator: #E5E5E0;
    --destructive: #D94F4F;
    --success: #4CAF7D;
    --card-shadow: 0 2px 8px rgba(43, 38, 34, 0.06);

    /* Layout */
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
    --nav-height: 64px;
    --radius-small: 8px;
    --radius-medium: 14px;
    --radius-large: 20px;
    --radius-pill: 100px;

    /* Animation */
    --anim-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --anim-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme - Fixed Bauhaus colors (Phase 1) */
.dark-theme {
    --bg-color: #1C1916;
    --surface-color: #2B2622;
    --surface-hover: #3A2E26;
    --text-primary: #F5F3EF;
    --text-secondary: #A0A0A0;
    --accent-color: #D4A373;
    --accent-contrast: #1C1916;
    --accent-light: rgba(212, 163, 115, 0.2);
    --separator: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Browser fallback for dark mode detection */
@media (prefers-color-scheme: dark) {
    :root:not(.dark-theme) {
        --bg-color: #1C1916;
        --surface-color: #2B2622;
        --surface-hover: #3A2E26;
        --text-primary: #F5F3EF;
        --text-secondary: #A0A0A0;
        --separator: rgba(255, 255, 255, 0.08);
        --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 16px);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Loading Skeletons */
.skeleton {
    background: linear-gradient(90deg,
        var(--separator) 25%,
        rgba(198, 124, 78, 0.08) 50%,
        var(--separator) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-medium);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-item {
    height: 76px;
    margin-bottom: 12px;
    border-radius: var(--radius-medium);
}

.skeleton-header {
    height: 44px;
    margin-bottom: 16px;
    border-radius: var(--radius-medium);
}

/* Toast */
.toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-120px);
    background: var(--accent-color);
    color: var(--accent-contrast);
    padding: 14px 28px;
    font-size: 14px;
    font-weight: 600;
    z-index: 2000;
    transition: transform var(--anim-smooth);
    pointer-events: none;
    box-shadow: 0 4px 20px rgba(198, 124, 78, 0.3);
    border-radius: var(--radius-pill);
    letter-spacing: 0.3px;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
}

/* Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: rgba(255, 248, 240, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid var(--separator);
    display: flex;
    z-index: 1000;
}

.dark-theme .bottom-nav {
    background: rgba(26, 18, 16, 0.92);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    gap: 4px;
    cursor: pointer;
    transition: all var(--anim-smooth);
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 4px;
    background: var(--accent-color);
    border-radius: var(--radius-pill);
    transition: width var(--anim-smooth);
}

.nav-item:active {
    transform: scale(0.95);
}

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

.nav-item.active::before {
    width: 32px;
}

.nav-icon {
    font-size: 24px;
    position: relative;
    line-height: 1;
}

.badge {
    position: absolute;
    top: -4px;
    right: -8px;
    background: var(--accent-color);
    color: var(--accent-contrast);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    min-width: 18px;
    text-align: center;
    border-radius: var(--radius-pill);
    box-shadow: 0 2px 8px rgba(198, 124, 78, 0.3);
}

/* Tabs */
.tab-section {
    display: none;
    padding: 20px 16px;
    animation: fadeIn var(--anim-smooth);
}

.tab-section.active {
    display: block;
}

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

/* Header */
.header-block {
    margin-bottom: 20px;
}

.location-select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--separator);
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    appearance: none;
    cursor: pointer;
    transition: all var(--anim-fast);
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
}

.location-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* Categories - Simplified Telegram Style */
.categories-scroll {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 16px;
    margin-bottom: 12px;
    scrollbar-width: none;
}

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

.cat-chip {
    padding: 8px 16px;
    background: var(--surface-color);
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--separator);
    transition: all var(--anim-fast);
    border-radius: 8px;
}

.cat-chip:active {
    transform: scale(0.96);
}

.cat-chip.active {
    background: var(--accent-color);
    color: var(--accent-contrast);
    border-color: var(--accent-color);
}

/* Menu List - Telegram Native Style */
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--surface-color);
    border-radius: var(--radius-medium);
    overflow: hidden;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--surface-color);
    border-bottom: 1px solid var(--separator);
    cursor: pointer;
    transition: background var(--anim-fast);
    min-height: 64px;
}

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

.menu-item:active {
    background: var(--surface-hover);
}

.menu-item.unavailable {
    opacity: 0.4;
    pointer-events: none;
}

.item-thumb {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
    background: var(--accent-light);
    border-radius: 12px;
}

.item-details {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.item-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-price {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 17px;
    flex-shrink: 0;
    margin-left: auto;
}

.add-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    background: var(--accent-color);
    color: var(--accent-contrast);
    border: none;
    transition: all var(--anim-smooth);
    border-radius: 50%;
    flex-shrink: 0;
    font-weight: 600;
    box-shadow: 0 3px 10px rgba(198, 124, 78, 0.3);
}

.add-btn:active {
    transform: scale(0.9);
}

/* Cart */
.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.page-title::after {
    content: '';
    display: block;
    width: 40px;
    height: 3px;
    background: var(--accent-color);
    margin-top: 8px;
    border-radius: var(--radius-pill);
}

.empty-state {
    text-align: center;
    margin-top: 80px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 72px;
    margin-bottom: 20px;
    opacity: 0.25;
}

/* Location Cards (Phase 2) */
.location-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 20px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.location-card {
    background: var(--surface-color);
    border: 1px solid var(--separator);
    border-radius: var(--radius-medium);
    padding: 16px;
    cursor: pointer;
    transition: all var(--anim-fast);
}

.location-card:hover {
    background: var(--surface-hover);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: var(--card-shadow);
}

.location-card-name {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.location-card-address {
    font-size: 14px;
    color: var(--text-secondary);
}

.action-btn {
    margin-top: 20px;
    padding: 14px 28px;
    background: var(--accent-color);
    color: var(--accent-contrast);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--anim-smooth);
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 14px rgba(198, 124, 78, 0.3);
    font-family: 'Nunito', sans-serif;
}

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

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 140px;
    background: var(--surface-color);
    border-radius: var(--radius-medium);
    overflow: hidden;
}

.cart-item-row {
    background: var(--surface-color);
    border-bottom: 1px solid var(--separator);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--anim-fast);
}

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

.cart-total {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 16px);
    left: 16px;
    right: 16px;
    background: var(--accent-color);
    color: var(--accent-contrast);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 18px;
    z-index: 900;
}

.comment-block {
    margin-top: 16px;
    margin-bottom: 16px;
}

.comment-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--surface-color);
    border: 1px solid var(--separator);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
    transition: all var(--anim-smooth);
    border-radius: var(--radius-medium);
    box-shadow: var(--card-shadow);
}

.comment-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px var(--accent-light);
}

/* Profile - Simplified */
.profile-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--surface-color);
    border-radius: 12px;
}

.avatar {
    width: 52px;
    height: 52px;
    background: var(--accent-color);
    color: var(--accent-contrast);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 600;
    flex-shrink: 0;
    border-radius: 50%;
}

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

.p-phone {
    color: var(--text-secondary);
    margin-top: 2px;
    font-size: 14px;
}

/* Loyalty Card - Simplified */
.loyalty-card {
    background: var(--accent-color);
    color: var(--accent-contrast);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.loyalty-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.loyalty-card p {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 12px;
}

.cups-grid {
    position: relative;
    z-index: 1;
}

/* Loyalty Cups Progress */
.loyalty-cups-section {
    margin-bottom: 16px;
}

.cups-progress {
    display: flex;
    justify-content: space-between;
    gap: 4px;
    margin-bottom: 8px;
}

.cup-dot {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    border-radius: 50%;
    transition: all var(--anim-smooth);
}

.cup-dot.filled {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.cups-label {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}

.bonus-points-section {
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.bonus-amount {
    text-align: center;
    font-size: 36px;
    font-weight: 800;
    line-height: 1.1;
}

.bonus-label {
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.9;
    margin-top: 2px;
}

.bonus-hint {
    text-align: center;
    font-size: 12px;
    opacity: 0.7;
    margin-top: 4px;
}

.cup-circle {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    transition: all var(--anim-smooth);
    border-radius: 50%;
}

.cup-circle.active {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
    transform: scale(1.1);
}

/* Free drink alert */
.free-drink-msg {
    background: linear-gradient(135deg, #F5E6D3 0%, #E8D5C0 100%);
    color: var(--text-primary);
    border: none;
    margin-top: 12px;
    padding: 14px;
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    border-radius: var(--radius-medium);
    box-shadow: 0 3px 12px rgba(198, 124, 78, 0.15);
}

.dark-theme .free-drink-msg {
    background: linear-gradient(135deg, #3A2E26 0%, #4A3828 100%);
    color: var(--accent-color);
}

/* Orders */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    background: var(--surface-color);
    border-radius: 12px;
    overflow: hidden;
}

.order-card {
    background: var(--surface-color);
    border-bottom: 1px solid var(--separator);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background var(--anim-fast);
}

.order-card:last-child {
    border-bottom: none;
}

.order-card:active {
    background: var(--surface-hover);
}

.order-info {
    flex: 1;
}

.order-id {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

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

.order-status {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-pill);
}

.order-status.pending {
    background: rgba(245, 166, 35, 0.12);
    color: #E09422;
    border: 1px solid rgba(245, 166, 35, 0.2);
}

.order-status.confirmed,
.order-status.preparing {
    background: var(--accent-light);
    color: var(--accent-color);
    border: 1px solid rgba(198, 124, 78, 0.2);
}

.order-status.ready {
    background: rgba(76, 175, 125, 0.12);
    color: var(--success);
    border: 1px solid rgba(76, 175, 125, 0.2);
}

.order-status.completed {
    background: rgba(76, 175, 125, 0.12);
    color: var(--success);
    border: 1px solid rgba(76, 175, 125, 0.2);
}

/* Modal Sheet */
.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 24, 16, 0.4);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--anim-fast);
}

.sheet-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.sheet-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-color);
    border-radius: 16px 16px 0 0;
    padding: 16px;
    padding-bottom: calc(var(--safe-area-bottom) + 120px);
    z-index: 2100;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

.sheet-modal.visible {
    transform: translateY(0);
}

.sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--separator);
    margin: 0 auto 16px;
    border-radius: 2px;
}

.sheet-image-emoji {
    font-size: 64px;
    text-align: center;
    margin-bottom: 12px;
}

.sheet-title {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
}

.sheet-desc {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.4;
    font-size: 14px;
}

.sheet-options {
    margin-bottom: 20px;
}

.sheet-options label {
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-weight: 600;
}

.size-selector {
    display: flex;
    gap: 8px;
}

.size-selector .cat-chip {
    flex: 1;
    text-align: center;
    padding: 12px;
}

.sheet-footer {
    display: flex;
    justify-content: center;
}

.qty-control {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 22px;
    font-weight: 700;
}

.qty-btn {
    width: 44px;
    height: 44px;
    background: var(--surface-color);
    border: 1px solid var(--separator);
    font-size: 20px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--anim-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 50%;
    box-shadow: var(--card-shadow);
    font-family: 'Nunito', sans-serif;
}

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

/* Admin */
.admin-inv-item {
    flex-direction: column;
    align-items: stretch;
}

.admin-tab-content {
    animation: fadeIn var(--anim-smooth);
}

/* Placeholder */
.placeholder-msg {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
}

/* Responsive - 480px */
@media (max-width: 480px) {
    .admin-inv-item .qty-btn {
        min-width: 36px;
        min-height: 36px;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}

/* Responsive - 420px */
@media (max-width: 420px) {
    .admin-inv-item {
        padding: 12px;
    }

    .admin-inv-item .qty-btn {
        min-width: 32px;
        min-height: 32px;
        width: 32px;
        height: 32px;
        font-size: 14px;
        padding: 0;
    }
}

/* Responsive - 375px */
@media (max-width: 375px) {
    .tab-section {
        padding: 16px 12px;
    }

    .page-title {
        font-size: 24px;
        margin-bottom: 16px;
    }

    .menu-item {
        padding: 12px;
        gap: 12px;
    }

    .item-thumb {
        width: 48px;
        height: 48px;
        font-size: 26px;
    }

    .item-title {
        font-size: 14px;
    }

    .item-price {
        font-size: 15px;
    }

    .add-btn {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .profile-header {
        padding: 16px;
    }

    .avatar {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .loyalty-card {
        padding: 20px;
    }

    .cat-chip {
        padding: 8px 16px;
        font-size: 13px;
    }

    .cup-dot {
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .bonus-amount {
        font-size: 28px;
    }
}

/* Responsive - 320px */
@media (max-width: 320px) {
    .tab-section {
        padding: 12px 10px;
    }

    .page-title {
        font-size: 22px;
    }

    .menu-item {
        padding: 10px;
        gap: 10px;
    }

    .item-thumb {
        width: 44px;
        height: 44px;
        font-size: 24px;
    }

    .cat-chip {
        padding: 8px 12px;
        font-size: 12px;
    }

    .cup-dot {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }

    .loyalty-card {
        padding: 16px;
    }

    .cart-total {
        left: 10px;
        right: 10px;
        padding: 14px 18px;
        font-size: 16px;
    }
}
