@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg: #faf8f5;
    --bg-deep: #f0ebe2;
    --card: #ffffff;
    --border: #e8e0d4;
    --border-light: #e2ddd5;
    --brown-dark: #2c2010;
    --brown: #5a4628;
    --brown-mid: #8b7d6b;
    --brown-light: #c4a882;
    --accent: #8b6f47;
    --accent-light: #a6844e;
    --accent-bg: #ede4cf;
    --accent-bg-light: #f5edd8;
    --green: #3b7d5f;
    --green-bg: #e8f5e9;
    --red: #9b2c2c;
    --red-bg: #fef2f2;
    --red-border: #f5c6c6;
    --orange: #b45309;
    --blue: #4285F4;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 20px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'DM Sans', sans-serif;
    background: linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
    color: #3d3425;
    min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══ LAYOUT ═══ */
.container { max-width: 780px; margin: 0 auto; padding: 20px 16px 80px; }

/* ═══ TOP BAR ═══ */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0 20px; border-bottom: 2px solid var(--border); margin-bottom: 28px;
    flex-wrap: wrap; gap: 12px;
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-brand .icon { font-size: 28px; }
.topbar-brand h1 {
    font-family: 'DM Serif Display', serif; font-size: 26px;
    font-weight: 400; color: var(--brown-dark);
}
.topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.topbar-name { font-size: 14px; font-weight: 600; color: var(--brown); }

/* ═══ BADGES ═══ */
.badge {
    display: inline-block; padding: 2px 10px; border-radius: 20px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-admin { background: rgba(180,83,9,.1); color: var(--orange); }
.badge-user { background: rgba(59,125,95,.1); color: var(--green); }
.badge-google { background: rgba(66,133,244,.1); color: var(--blue); }

/* ═══ BUTTONS ═══ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border: none; border-radius: var(--radius);
    font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: #fff; box-shadow: 0 4px 16px rgba(139,111,71,.2);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(139,111,71,.3); }
.btn-secondary {
    background: none; border: 2px solid #d4c4a0; color: var(--brown);
}
.btn-secondary:hover { background: #f5f0e8; }
.btn-ghost {
    background: none; border: none; color: var(--brown-mid); font-weight: 600;
}
.btn-ghost:hover { color: var(--accent); }
.btn-logout {
    padding: 6px 14px; background: none; border: 1.5px solid #d4c4a0;
    border-radius: var(--radius-sm); font-size: 13px; font-weight: 600;
    color: var(--brown-mid); font-family: 'DM Sans', sans-serif; cursor: pointer;
}
.btn-logout:hover { background: #f5f0e8; }
.btn-danger {
    background: var(--red-bg); border: 1.5px solid var(--red-border);
    color: var(--red); border-radius: var(--radius-sm); padding: 6px 12px;
    font-size: 13px; font-weight: 600; cursor: pointer; font-family: 'DM Sans', sans-serif;
}
.btn-danger:hover { background: #fde8e8; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--radius-sm); }

/* ═══ FORMS ═══ */
.form-group { margin-bottom: 12px; }
.form-label {
    display: block; font-size: 12px; font-weight: 700; color: var(--brown-mid);
    text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 4px;
}
.form-input {
    width: 100%; padding: 10px 14px; border: 2px solid var(--border-light);
    border-radius: 10px; font-size: 14px; font-family: 'DM Sans', sans-serif;
    background: var(--bg); transition: border-color 0.2s;
}
.form-input:focus { outline: none; border-color: var(--brown-light); }
.form-select {
    padding: 6px 10px; border: 1.5px solid var(--border-light); border-radius: var(--radius-sm);
    font-size: 13px; font-family: 'DM Sans', sans-serif; background: var(--bg); cursor: pointer;
}

/* ═══ FLASH MESSAGES ═══ */
.flash {
    padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px;
    animation: fadeInDown 0.3s ease;
}
.flash-error { background: var(--red-bg); border: 1.5px solid var(--red-border); color: var(--red); }
.flash-success { background: var(--green-bg); border: 1.5px solid #c3e6cb; color: #276749; }
.flash-info { background: #eff6ff; border: 1.5px solid #bfdbfe; color: #1e40af; }

/* ═══ AUTH PAGE ═══ */
.auth-wrap {
    display: flex; justify-content: center; align-items: center; min-height: 85vh;
}
.auth-card {
    width: 100%; max-width: 420px; background: var(--card); border-radius: var(--radius-xl);
    border: 2px solid var(--border); padding: 36px; box-shadow: 0 8px 40px rgba(0,0,0,.06);
}
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-header .icon { font-size: 44px; margin-bottom: 8px; }
.auth-header h2 {
    font-family: 'DM Serif Display', serif; font-size: 28px; color: var(--brown-dark);
}
.auth-header p { font-size: 14px; color: var(--brown-mid); margin-top: 4px; }

.auth-tabs { display: flex; border-radius: 10px; border: 2px solid var(--border); overflow: hidden; margin-bottom: 24px; }
.auth-tab {
    flex: 1; padding: 10px 0; background: none; border: none;
    font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600;
    cursor: pointer; color: var(--brown-mid); text-align: center;
    text-decoration: none; display: block;
}
.auth-tab.active, .auth-tab:hover { background: var(--accent); color: #fff; text-decoration: none; }

.divider { text-align: center; margin: 20px 0; position: relative; border-top: 1px solid var(--border); }
.divider span {
    background: var(--card); padding: 0 12px; font-size: 13px;
    color: var(--brown-mid); position: relative; top: -10px;
}

.google-btn {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 11px 0; background: #fff; border: 2px solid var(--border-light);
    border-radius: var(--radius); font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: 'DM Sans', sans-serif; color: #3d3425;
    transition: all 0.2s; text-decoration: none;
}
.google-btn:hover { background: #f5f0e8; border-color: var(--brown-light); text-decoration: none; }

.auth-hint { font-size: 12px; color: var(--brown-mid); text-align: center; margin-top: 20px; }

/* ═══ ADMIN TABS ═══ */
.admin-tabs {
    display: flex; border-radius: var(--radius); border: 2px solid var(--border);
    overflow: hidden; background: var(--card); margin-bottom: 28px;
}
.admin-tab {
    flex: 1; padding: 12px 0; background: none; border: none;
    font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 600;
    cursor: pointer; color: var(--brown-mid); text-align: center;
    text-decoration: none; display: block; transition: background 0.2s;
}
.admin-tab.active, .admin-tab:hover { background: var(--accent); color: #fff; text-decoration: none; }

/* ═══ CARDS ═══ */
.card {
    background: var(--card); border-radius: var(--radius-lg); border: 2px solid var(--border);
    padding: 20px; margin-bottom: 14px; animation: fadeInUp 0.4s ease both;
    transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,.07); }

.card-mini {
    background: var(--card); border-radius: var(--radius); border: 1.5px solid var(--border);
    padding: 14px 16px; margin-bottom: 10px;
}

.card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-header .day-icon { font-size: 22px; }
.card-header h2, .card-header h3 {
    font-family: 'DM Serif Display', serif; font-weight: 400; color: var(--brown-dark);
}
.card-header h2 { font-size: 22px; }
.card-header h3 { font-size: 18px; }

/* ═══ SOUP CHIP ═══ */
.soup-chip {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px; background: var(--bg); border-radius: 10px;
    margin-bottom: 12px; border: 1.5px solid var(--border);
    cursor: pointer; transition: all 0.2s;
}
.soup-chip:hover { background: var(--accent-bg); }
.soup-chip.selected { background: #d4c4a0; }
.soup-label { font-size: 13px; font-weight: 600; color: var(--brown-mid); white-space: nowrap; }

/* ═══ MEAL OPTION ═══ */
.meal-option {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius);
    border: 2px solid var(--border-light); background: var(--bg);
    cursor: pointer; transition: all 0.2s; margin-bottom: 8px;
}
.meal-option:hover { border-color: var(--brown-light); background: #f5f0e8; }
.meal-option.selected {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent-bg-light), var(--accent-bg));
    box-shadow: 0 2px 12px rgba(139,111,71,.15);
}
.meal-option input[type="radio"] { display: none; }
.radio-dot {
    width: 20px; height: 20px; border-radius: 50%; border: 2px solid #ccc;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 2px; transition: border-color 0.2s;
}
.meal-option.selected .radio-dot { border-color: var(--accent); }
.radio-dot-inner {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--accent); display: none;
}
.meal-option.selected .radio-dot-inner { display: block; }
.meal-text { font-size: 15px; font-weight: 500; line-height: 1.4; }

/* ═══ MEAL INPUT ROW (editor) ═══ */
.meal-input-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.meal-input-row .form-input { flex: 1; margin-bottom: 0; }

.add-meal-btn {
    padding: 6px 12px; background: none; border: none;
    color: var(--accent); font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: 'DM Sans', sans-serif;
}
.add-meal-btn:hover { text-decoration: underline; }

/* ═══ WEEK BADGE ═══ */
.week-badge {
    display: inline-block; padding: 4px 14px; background: var(--accent-bg);
    border-radius: 20px; font-size: 13px; font-weight: 600;
    color: var(--brown); margin-bottom: 16px;
}

/* ═══ SECTION TITLE ═══ */
.section-title {
    font-family: 'DM Serif Display', serif; font-size: 20px;
    color: var(--brown-dark); margin-bottom: 16px;
}

/* ═══ EMPTY STATE ═══ */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .icon { font-size: 48px; }
.empty-state p { margin-top: 12px; color: var(--brown-mid); }

/* ═══ USER ROW (admin) ═══ */
.user-row {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 16px; background: var(--card); border-radius: var(--radius);
    border: 1.5px solid var(--border); margin-bottom: 8px;
    flex-wrap: wrap;
}
.user-info { flex: 1; min-width: 200px; }
.user-info .name { font-size: 14px; font-weight: 600; }
.user-info .email { font-size: 12px; color: var(--brown-mid); margin-top: 2px; }
.user-actions { display: flex; gap: 8px; align-items: center; }

/* ═══ ORDER ROW ═══ */
.order-day-row {
    display: flex; gap: 8px; font-size: 13px; padding: 3px 0; color: #6b5d4d;
}
.order-day-label { font-weight: 600; min-width: 65px; }

/* ═══ SUMMARY ITEM ═══ */
.summary-soup { font-size: 13px; color: var(--brown-mid); margin-top: 6px; }
.summary-meal { font-size: 13px; color: var(--brown); margin-top: 3px; }

/* ═══ FOOTER ═══ */
.order-footer {
    margin-top: 28px; display: flex; flex-direction: column;
    align-items: center; gap: 14px;
}
.order-count { font-size: 14px; color: var(--brown-mid); font-weight: 500; }
.order-confirmed { font-size: 16px; font-weight: 600; color: var(--green); }

/* ═══ UPLOAD AREA ═══ */
.upload-area {
    border: 3px dashed #d4c4a0; border-radius: var(--radius-lg);
    padding: 32px; text-align: center; background: var(--bg);
    cursor: pointer; transition: all 0.3s;
}
.upload-area:hover { border-color: var(--accent); background: #f5f0e8; }

/* ═══ ACTIONS ROW ═══ */
.actions-row { display: flex; gap: 12px; margin-top: 20px; flex-wrap: wrap; }

/* ═══ ANIMATIONS ═══ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 600px) {
    .auth-card { padding: 24px 20px; }
    .topbar { padding: 10px 0 16px; }
    .topbar-brand h1 { font-size: 20px; }
    .user-row { flex-direction: column; align-items: flex-start; }
    .user-actions { width: 100%; }
}

/* ═══ LOCKED CARD ═══ */
.card-locked { opacity: 0.65; background: #f5f3ef; }
.card-locked:hover { transform: none; box-shadow: none; }
.card-locked .meal-option { cursor: default; }
.card-locked .meal-option:hover { border-color: var(--border-light); background: var(--bg); }
.card-locked .soup-chip { cursor: default; }
.card-locked .soup-chip:hover { background: var(--bg) !important; }

.badge-cadmin { background: rgba(59,80,150,.1); color: #3b5096; }

/* ═══ DETAILS ═══ */
details summary { padding: 8px 0; }
details summary:hover { color: var(--accent); }

.disabled { opacity: 0.5; cursor: default !important; pointer-events: none; }

/* ═══ PRICE TAG ═══ */
.price-tag {
    font-size: 13px; font-weight: 600; color: var(--accent);
    white-space: nowrap; padding: 2px 8px;
    background: rgba(139,111,71,.08); border-radius: 6px;
}

/* ═══ QR MODAL ═══ */
.qr-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.qr-modal {
    position: relative; background: #fff; border-radius: 20px;
    padding: 32px; max-width: 360px; width: 90%;
    text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: fadeInUp 0.3s ease;
}

.btn-qr {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 12px; background: none; border: 1.5px solid #d4c4a0;
    border-radius: 8px; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: 'DM Sans', sans-serif; color: var(--brown);
    transition: all 0.2s;
}
.btn-qr:hover { background: var(--accent-bg); border-color: var(--accent); }

.addr-dropdown {
    position: absolute; left: 0; right: 0; top: 100%; z-index: 100;
    background: #fff; border-radius: 0 0 10px 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12);
    overflow: hidden;
}
.addr-item {
    padding: 10px 14px; font-size: 14px; cursor: pointer; border-bottom: 1px solid var(--border);
}
.addr-item:hover { background: var(--accent-bg); }