:root {
    /* Colors */
    --bg-color: #ffffff;
    --surface-color: #f5f5f7;
    --text-primary: #1a1a1a;
    --text-secondary: #8e8e93;
    --accent-color: #2fab73;
    --accent-light: rgba(47, 171, 115, 0.1);
    --accent-contrast: #ffffff;
    --separator: #e5e5ea;
    --destructive: #ff3b30;
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);

    /* Layout */
    --safe-area-bottom: env(safe-area-inset-bottom, 20px);
    --nav-height: 60px;
    --header-height: 60px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;

    /* Animation */
    --anim-fast: 0.2s ease;
    --anim-smooth: 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    overflow-x: hidden;
    padding-bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 20px);
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 12px 24px;
    border-radius: 100px;
    font-size: 14px;
    font-weight: 500;
    z-index: 2000;
    transition: transform var(--anim-smooth);
    pointer-events: none;
    backdrop-filter: blur(10px);
}

.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: var(--bg-color);
    border-top: 0.5px solid var(--separator);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(20px);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 500;
    gap: 4px;
    cursor: pointer;
    transition: color var(--anim-fast), transform var(--anim-fast);
}

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

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

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

.badge {
    position: absolute;
    top: -6px;
    right: -10px;
    background: var(--destructive);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

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

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

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

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

.location-select {
    width: 100%;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    border: none;
    background-color: var(--surface-color);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 500;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    cursor: pointer;
    transition: background-color var(--anim-fast);
}

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

/* Categories */
.categories-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 0 12px;
    margin-bottom: 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

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

.cat-chip {
    padding: 10px 18px;
    border-radius: 100px;
    background: var(--surface-color);
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--anim-fast);
}

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

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

/* Menu List */
.menu-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform var(--anim-fast), box-shadow var(--anim-fast);
}

.menu-item:active {
    transform: scale(0.98);
}

.menu-item.unavailable {
    filter: grayscale(1);
    opacity: 0.5;
    pointer-events: none;
}

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

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

.item-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-price {
    font-weight: 700;
    color: var(--accent-color);
    font-size: 15px;
}

.add-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    cursor: pointer;
    background: var(--accent-color);
    color: white;
    border: none;
    transition: transform var(--anim-fast);
    flex-shrink: 0;
}

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

/* Cart Section */
.page-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 24px;
    letter-spacing: -0.5px;
}

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

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.action-btn {
    margin-top: 20px;
    padding: 14px 28px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--anim-fast);
}

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

.cart-items {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 100px;
}

.cart-item-row {
    background: var(--bg-color);
    border-bottom: 0.5px solid var(--separator);
    padding: 16px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.cart-total {
    position: fixed;
    bottom: calc(var(--nav-height) + var(--safe-area-bottom) + 10px);
    left: 16px;
    right: 16px;
    background: var(--bg-color);
    padding: 18px 20px;
    border-radius: var(--radius-lg);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 18px;
    z-index: 900;
}

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

.avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--accent-color), #1a8f5e);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}

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

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

/* Loyalty Card */
.loyalty-card {
    background: linear-gradient(135deg, #2fab73 0%, #1a8f5e 100%);
    color: white;
    padding: 24px;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(47, 171, 115, 0.3);
    margin-bottom: 20px;
}

.loyalty-card h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

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

.cups-grid {
    display: flex;
    justify-content: space-between;
    gap: 6px;
}

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

.cup-circle.active {
    background: white;
    color: var(--accent-color);
    transform: scale(1.1);
}

.free-drink-msg {
    background: rgba(255, 255, 255, 0.2);
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 700;
    font-size: 14px;
}

/* Order History */
.section-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.orders-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.order-card {
    background: var(--surface-color);
    padding: 16px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.order-info {
    flex: 1;
}

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

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

.order-status {
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
}

.order-status.pending {
    background: #fff3cd;
    color: #856404;
}

.order-status.confirmed {
    background: #d1ecf1;
    color: #0c5460;
}

.order-status.ready {
    background: #d4edda;
    color: #155724;
}

.order-status.completed {
    background: var(--accent-light);
    color: var(--accent-color);
}

/* Modal Sheet */
.sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--anim-smooth);
    backdrop-filter: blur(4px);
}

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

.sheet-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 20px 24px;
    padding-bottom: calc(var(--safe-area-bottom) + 100px);
    z-index: 2100;
    transform: translateY(100%);
    transition: transform var(--anim-smooth);
    max-height: 85vh;
    overflow-y: auto;
}

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

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

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

.sheet-title {
    font-size: 24px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.sheet-desc {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.5;
    font-size: 15px;
}

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

.sheet-options label {
    font-size: 13px;
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.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: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--surface-color);
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--anim-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Placeholder */
.placeholder-msg {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 15px;
}
