:root {
    --ios-red: #FF3B30;
    --ios-orange: #FF9500;
    --ios-blue: #007AFF;
    --ios-green: #34C759;
    --ios-purple: #AF52DE;

    --bg-primary: #F2F2F7;
    --bg-secondary: #FFFFFF;
    --bg-tertiary: #E5E5EA;
    --text-primary: #000000;
    --text-secondary: #8E8E93;
    --border-color: rgba(60, 60, 67, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --card-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);

    --nav-height: 60px;
    --header-height: 52px;
    --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", sans-serif;
}

body.dark-theme {
    --bg-primary: #000000;
    --bg-secondary: #1C1C1E;
    --bg-tertiary: #2C2C2E;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --border-color: rgba(84, 84, 88, 0.25);
    --glass-bg: rgba(28, 28, 30, 0.85);
    --card-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: var(--font-main); -webkit-tap-highlight-color: transparent; user-select: none; }
body { background-color: var(--bg-primary); color: var(--text-primary); padding-bottom: calc(var(--nav-height) + 24px); padding-top: var(--header-height); transition: background-color 0.3s, color 0.3s; }

/* HEADER */
header {
    position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
    background: var(--glass-bg); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 0.5px solid var(--border-color); display: flex; align-items: center; justify-content: space-between;
    padding: 0 12px; z-index: 100;
}
.header-title { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.3px; }
.icon-btn { background: var(--bg-tertiary); border: none; font-size: 1.1rem; cursor: pointer; width: 40px; height: 40px; border-radius: 50%; color: var(--text-primary); transition: transform 0.15s ease; touch-action: manipulation; }
.icon-btn:active { transform: scale(0.92); }

/* SEARCH BAR */
.search-bar {
    position: sticky; top: var(--header-height); z-index: 90;
    background: var(--bg-primary); padding: 10px 12px 6px 12px;
    border-bottom: 0.5px solid var(--border-color);
}
.search-input {
    width: 100%; padding: 10px 14px; border-radius: 10px;
    border: 1px solid var(--border-color); background: var(--bg-secondary);
    color: var(--text-primary); font-size: 0.9rem; font-family: var(--font-main);
    outline: none; -webkit-appearance: none;
}
.search-input::placeholder { color: var(--text-secondary); }

/* QUICK ACTIONS */
.quick-actions {
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
    padding: 8px 12px; background: var(--bg-primary);
}
.quick-btn {
    background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 12px; padding: 8px; font-size: 0.75rem; font-weight: 600;
    cursor: pointer; display: flex; flex-direction: column; align-items: center;
    gap: 4px; transition: background 0.15s, color 0.15s; color: var(--text-primary); touch-action: manipulation;
}
.quick-btn:active { background: var(--ios-blue); color: white; }
.quick-btn .icon { font-size: 1.3rem; }

/* HERO CARD */
.hero-card {
    background: var(--bg-secondary); color: var(--text-primary);
    margin: 12px; padding: 16px; border-radius: 16px;
    border: 0.5px solid var(--border-color); box-shadow: var(--card-shadow);
}
.countdown-title { font-size: 0.75rem; text-transform: uppercase; color: var(--text-secondary); font-weight: 600; letter-spacing: 0.5px; }
.countdown-value { font-size: 1.6rem; font-weight: 800; color: var(--ios-red); margin: 4px 0 8px 0; }

/* DAYS SCROLL BAR */
.days-bar {
    display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px;
    scroll-behavior: smooth; -webkit-overflow-scrolling: touch; scrollbar-width: none;
    background: var(--bg-primary); position: sticky; top: calc(var(--header-height) + 48px); z-index: 88;
}
.days-bar::-webkit-scrollbar { display: none; }
.day-chip {
    flex: 0 0 auto; background: var(--bg-secondary); color: var(--text-primary);
    border: 0.5px solid var(--border-color); padding: 8px 14px; border-radius: 10px;
    font-size: 0.8rem; font-weight: 600; cursor: pointer; text-align: center;
    transition: all 0.2s ease; white-space: nowrap; touch-action: manipulation;
}
.day-chip.active {
    background: var(--ios-blue); color: #FFF; border-color: var(--ios-blue);
    box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

/* CARDS & CONTENT */
.section-title { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.4px; margin: 16px 12px 10px 12px; }
.card {
    background: var(--bg-secondary); border-radius: 14px; border: 0.5px solid var(--border-color);
    padding: 14px; margin: 0 12px 10px 12px; box-shadow: var(--card-shadow);
    transition: opacity 0.2s;
}
.card.completed { opacity: 0.55; text-decoration: line-through; }

/* BADGES */
.badge { display: inline-flex; padding: 3px 8px; border-radius: 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; }
.badge-red { background: rgba(255, 59, 48, 0.1); color: var(--ios-red); }
.badge-blue { background: rgba(0, 122, 255, 0.1); color: var(--ios-blue); }
.badge-green { background: rgba(52, 199, 89, 0.1); color: var(--ios-green); }
.badge-purple { background: rgba(175, 82, 222, 0.1); color: var(--ios-purple); }
.badge-orange { background: rgba(255, 149, 0, 0.1); color: var(--ios-orange); }

/* CHINESE TEXT */
.zh-display {
    background: var(--bg-tertiary); border-radius: 10px; padding: 10px;
    margin: 8px 0; font-size: 1.3rem; font-weight: 700; color: var(--ios-red);
    text-align: center; cursor: pointer; transition: background 0.15s, color 0.15s; touch-action: manipulation;
}
.zh-display:active { background: var(--ios-red); color: white; }
.py-display { font-size: 0.75rem; color: var(--text-secondary); text-align: center; margin-top: 2px; }

/* ACTION BUTTONS */
.action-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 10px; }
.action-btn {
    background: rgba(0, 122, 255, 0.08); color: var(--ios-blue); border: none;
    padding: 8px 10px; border-radius: 8px; font-size: 0.75rem; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: background 0.15s, color 0.15s; display: flex;
    align-items: center; justify-content: center; gap: 4px; touch-action: manipulation;
}
.action-btn:active { background: var(--ios-blue); color: white; }
.action-btn.taxi { background: rgba(255, 149, 0, 0.08); color: var(--ios-orange); }
.action-btn.taxi:active { background: var(--ios-orange); color: white; }

/* INFO BOX */
.info-box { background: rgba(175, 82, 222, 0.06); border-radius: 8px; padding: 8px 10px; margin-top: 8px; font-size: 0.8rem; line-height: 1.3; color: var(--text-primary); }
.info-label { font-weight: 700; color: var(--ios-purple); }

/* PRICE & TIME */
.price-time {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-tertiary); border-radius: 8px; padding: 8px 10px;
    margin-top: 8px; font-size: 0.85rem; font-weight: 600;
}
.price-time .price { color: var(--ios-green); }
.price-time .time { color: var(--ios-orange); }

/* CHECKLIST & CHECKBOXES */
.checkbox-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 0.5px solid var(--border-color); cursor: pointer; }
.checkbox-row:last-child { border-bottom: none; }
.checkbox-box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--ios-blue); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; color: white; flex-shrink: 0; }
.checkbox-row.checked .checkbox-box { background: var(--ios-blue); }
.checkbox-row.checked span { text-decoration: line-through; color: var(--text-secondary); }

/* RESTAURANT FOOD CARDS GRID */
.rest-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rest-card { background: var(--bg-secondary); border-radius: 12px; border: 0.5px solid var(--border-color); padding: 12px; text-align: center; cursor: pointer; }
.rest-card .icon { font-size: 2rem; margin-bottom: 4px; }
.rest-card .zh { font-size: 1.1rem; font-weight: 800; color: var(--ios-red); margin: 4px 0; }
.rest-card .ru { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); }

/* VOUCHER QR EDIT ITEM CARD */
.qr-edit-card {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
}

/* MODAL */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    z-index: 300; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease; display: flex; justify-content: center; align-items: flex-end;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal-card {
    background: var(--bg-secondary); border-radius: 20px 20px 0 0;
    padding: 24px 20px 32px 20px; width: 100%; text-align: center;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.2);
    transform: translateY(100%); transition: transform 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
    will-change: transform; max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal-card { transform: translateY(0); }
.modal-zh-big { font-size: 2.2rem; font-weight: 900; color: var(--ios-red); line-height: 1.3; margin: 14px 0; word-break: break-all; }
.modal-btn {
    width: 100%; background: var(--ios-blue); color: white; border: none;
    padding: 12px; border-radius: 10px; font-weight: 600; font-size: 0.9rem;
    margin-top: 8px; cursor: pointer; touch-action: manipulation; transition: background 0.2s;
}

/* BOTTOM NAV */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-height);
    background: var(--glass-bg); backdrop-filter: blur(25px); -webkit-backdrop-filter: blur(25px);
    border-top: 0.5px solid var(--border-color); display: flex; justify-style: space-around;
    align-items: center; z-index: 100;
}
.nav-item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    background: none; border: none; color: var(--text-secondary); font-size: 0.62rem;
    font-weight: 500; cursor: pointer; width: 20%; padding: 4px 0; touch-action: manipulation;
}
.nav-item.active { color: var(--ios-red); font-weight: 700; }
.nav-item .icon { font-size: 1.25rem; }

/* DRAWER */
.drawer {
    position: fixed; top: 0; left: 0; width: 280px; height: 100%;
    background: var(--bg-secondary); z-index: 200;
    transform: translateX(-100%); transition: transform 0.25s cubic-bezier(0.1, 0.9, 0.2, 1);
    will-change: transform; padding: 20px 16px; display: flex; flex-direction: column; gap: 8px;
    overflow-y: auto;
}
.drawer.open { transform: translateX(0); }
.drawer-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4); z-index: 199; opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-btn {
    background: var(--bg-tertiary); color: var(--text-primary); border: none;
    padding: 12px 14px; border-radius: 10px; text-align: left; font-size: 0.85rem;
    font-weight: 600; cursor: pointer; transition: background 0.15s, color 0.15s; touch-action: manipulation;
}
.drawer-btn:active { background: var(--ios-blue); color: white; }

/* QR CODE DISPLAY */
.qr-box { background: #FFF; padding: 12px; border-radius: 12px; display: inline-block; box-shadow: 0 2px 10px rgba(0,0,0,0.1); margin: 8px 0; }
.qr-box img { max-width: 100%; height: auto; display: block; border-radius: 6px; }

/* FORM INPUTS */
.input-group { margin-bottom: 12px; text-align: left; }
.input-label { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 4px; display: block; }
.form-control { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--bg-primary); color: var(--text-primary); font-size: 0.9rem; }