/* Home Tiffin Service - one stylesheet for the customer site and admin. */

:root {
    --bg: #fbf8f3;
    --surface: #ffffff;
    --text: #2b2118;
    --muted: #7a6c5d;
    --border: #eadfce;
    --accent: #d9640f;
    --accent-dark: #b14f08;
    --accent-soft: #fdeedd;
    --green: #2e7d32;
    --red: #c62828;
    --blue: #1d5fa8;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(60, 40, 20, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
}

a { color: var(--accent-dark); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; margin-top: 1em; }

.container { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.page { padding-top: 20px; padding-bottom: 48px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { color: var(--muted); padding: 24px 0; }
.note { background: var(--accent-soft); padding: 10px 14px; border-radius: var(--radius); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header / footer ---------- */
.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text); text-decoration: none; }
.brand small { font-weight: 500; color: var(--muted); }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.site-nav a { color: var(--text); text-decoration: none; padding: 4px 0; }
.site-nav a:hover, .site-nav a.active { color: var(--accent-dark); }
.site-nav a.active { font-weight: 600; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8rem; text-align: center; }
.site-footer { border-top: 1px solid var(--border); padding: 20px 0; font-size: .9rem; background: var(--surface); }
.admin-header { background: #2b2118; }
.admin-header .brand, .admin-header .site-nav a { color: #fff; }
.admin-header .brand small { color: #d8c8b4; }
.admin-header .btn-ghost { color: #fff; border-color: #6d5c4a; }

/* ---------- hero / tabs ---------- */
.hero { padding: 8px 0 4px; }
.hero h1 { font-size: 1.8rem; }
.hero p { color: var(--muted); margin-top: 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 16px 0 12px; padding-bottom: 2px; }
.tab { flex: 0 0 auto; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-weight: 500; }
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dot-open { background: var(--green); }
.dot-closed { background: #bbb; }
.tab.active .dot-open { background: #c8f7c5; }

/* ---------- alerts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 12px; border: 1px solid transparent; }
.alert-success { background: #e8f5e9; border-color: #c8e6c9; color: #1b5e20; }
.alert-info    { background: #e8f1fb; border-color: #cfe0f5; color: #174a84; }
.alert-warning { background: #fff6e0; border-color: #f5e0a8; color: #7a5300; }
.alert-error   { background: #fdecea; border-color: #f5c6c2; color: #8e1c14; }

/* ---------- menu cards ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-top: 12px; }
.menu-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.menu-card.sold-out { opacity: .6; }
.menu-card-head { display: flex; align-items: flex-start; gap: 8px; }
.menu-card-head h3 { flex: 1; margin: 0; font-size: 1.05rem; }
.menu-card .muted { margin: 6px 0; font-size: .92rem; }
.price { font-weight: 700; white-space: nowrap; }
.stock { font-size: .85rem; color: #9a5b00; margin: 4px 0; }
.stock-out { color: var(--red); }
.add-form { display: flex; gap: 8px; margin-top: auto; padding-top: 10px; }
.add-form input { width: 70px; }
.add-form .btn { flex: 1; }

/* Indian veg / non-veg mark */
.veg-mark { display: inline-block; flex: 0 0 auto; width: 14px; height: 14px; border: 2px solid; border-radius: 2px; position: relative; margin-top: 4px; vertical-align: -2px; }
.veg-mark::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; }
.veg-mark.veg { color: var(--green); }
.veg-mark.nonveg { color: var(--red); }

/* ---------- buttons / forms ---------- */
.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent-dark); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--accent-soft); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { border-color: var(--border); color: var(--text); background: transparent; }
.btn-link { border: 0; background: none; padding: 4px 0; color: var(--accent-dark); font-weight: 500; text-decoration: underline; }
.btn-link.danger { color: var(--red); }
.btn-small { padding: 4px 10px; font-size: .88rem; }
.btn-block { display: block; width: 100%; padding: 12px; font-size: 1.05rem; }

input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #d6c8b5; border-radius: 8px; background: #fff; color: var(--text); max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.form .form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.form label, .form .label { font-weight: 600; font-size: .92rem; }
.form .radio, .form .checkbox { font-weight: 400; display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; }
.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.qty-input { width: 64px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.clear-cart { margin-top: 8px; }

/* ---------- panels / tables ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 16px 0; box-shadow: var(--shadow); }
.panel.narrow { max-width: 480px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table .num { text-align: right; white-space: nowrap; }
.table tfoot td { border-bottom: 0; }
.total-row td { font-weight: 700; font-size: 1.05rem; }
.row-cancelled td, .row-off td { color: var(--muted); }
.actions { white-space: nowrap; }
.link-list { padding-left: 20px; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }

/* ---------- order status ---------- */
.order-head { text-align: center; padding: 12px 0; }
.order-head .muted { margin: 0; }
.order-no { font-family: ui-monospace, Consolas, monospace; letter-spacing: .05em; }
.status { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: #eee; color: #444; vertical-align: middle; }
.status-pending { background: #fff3cd; color: #7a5300; }
.status-confirmed, .status-preparing { background: #e3eefc; color: var(--blue); }
.status-out_for_delivery { background: #ede4fb; color: #5b2ea6; }
.status-delivered { background: #e8f5e9; color: var(--green); }
.status-cancelled { background: #fdecea; color: var(--red); }
.progress { display: flex; list-style: none; padding: 0; margin: 16px 0; gap: 4px; counter-reset: step; }
.progress li { flex: 1; text-align: center; font-size: .8rem; color: var(--muted); border-top: 4px solid var(--border); padding-top: 6px; }
.progress li.done { border-color: var(--accent); color: var(--text); font-weight: 600; }

/* ---------- admin dashboard ---------- */
.toggles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 12px 0; }
.toggle-card { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.toggle-card.on { border-color: #a5d6a7; background: #f1f8f1; }
.toggle-card.off { border-color: #f5c6c2; background: #fdf3f2; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 12px 0; }
.stat { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; text-decoration: none; color: var(--text); }
.stat-label { color: var(--muted); font-size: .85rem; }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.two-col { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 2fr; } }
.prep-list { list-style: none; padding: 0; margin: 0; }
.prep-list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--border); }

@media print {
    .site-header, .site-footer, .btn, form { display: none !important; }
    body { background: #fff; }
    .panel { box-shadow: none; border: 0; }
}
