/* css/style.css — Table Order waiter app */

:root {
  --primary: #2C5AA0;
  --accent: #2F8F5B;
  --bg: #F5F7FA;
  --surface: #FFFFFF;
  --border: #E1E5EA;
  --text: #1F2937;
  --text-muted: #6B7280;
  --danger: #DC2626;
  --radius: 10px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }

.muted { color: var(--text-muted); }
.muted-inline { font-size: 0.8rem; color: var(--text-muted); }

/* ---------------- Login ---------------- */

#view-login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--primary), var(--accent)); padding: 1.5rem; }
.login-card { background: var(--surface); padding: 2rem; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,0.15); width: 100%; max-width: 360px; }
.login-card h1 { margin: 0 0 0.25rem; font-size: 1.4rem; }
#login-form label { display: block; font-size: 0.85rem; font-weight: 600; margin: 1rem 0 0.35rem; }
#login-form input { width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.95rem; }
#login-form input:focus { outline: none; border-color: var(--primary); }

button.big { width: 100%; padding: 0.75rem; font-size: 1rem; border-radius: var(--radius); font-weight: 700; cursor: pointer; border: none; }
button.primary { background: var(--primary); color: white; }
button.primary:disabled { opacity: 0.55; cursor: not-allowed; }
button.secondary { background: var(--surface); color: var(--text); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 0.55rem 1rem; font-weight: 700; cursor: pointer; }
button.danger { background: var(--danger); color: white; border: none; border-radius: var(--radius); padding: 0.4rem 0.8rem; cursor: pointer; }
button.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; border-radius: 6px; }

.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 0.75rem; }

.back-btn { background: none; border: none; color: var(--text-muted); font-size: 0.9rem; cursor: pointer; padding: 0.4rem 0; margin-bottom: 0.75rem; font-weight: 600; }

/* ---------------- App shell ---------------- */

.app-header {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 1rem;
  padding: 0.9rem 1.1rem; background: var(--primary); color: white;
}
.header-whoami { font-weight: 700; font-size: 0.95rem; }

.alerts-bell { position: relative; background: none; border: none; font-size: 1.3rem; cursor: pointer; margin-left: auto; color: white; }
.alerts-badge {
  position: absolute; top: -4px; right: -6px; background: var(--danger); color: white; font-size: 0.65rem;
  font-weight: 800; border-radius: 999px; min-width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

.link-btn-header { background: none; border: none; color: rgba(255,255,255,0.85); font-size: 0.85rem; cursor: pointer; text-decoration: underline; }

.view { padding: 1.1rem; max-width: 720px; margin: 0 auto; }
.view h1 { font-size: 1.2rem; margin: 0 0 1rem; }

.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--text); color: white;
  padding: 0.65rem 1.1rem; border-radius: 999px; font-size: 0.85rem; z-index: 300; box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.toast.error { background: var(--danger); }

/* ---------------- My Tables grid (dark tiles, same language as admin floor plan) ---------------- */

#tables-grid { display: grid; grid-template-columns: repeat(auto-fill, 92px); gap: 0.9rem; background: #1C2333; border-radius: 14px; padding: 1.25rem; justify-content: start; }

.waiter-table-tile {
  width: 92px; height: 92px; border-radius: 50%; background: #2A3348; border: 3px solid var(--status-color, #94A3B8);
  color: #F1F5F9; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  cursor: pointer; position: relative; font-family: inherit;
}
.waiter-table-number { font-size: 1.3rem; font-weight: 800; }
.waiter-table-status { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.8; }

.waiter-table-tile.status-empty { --status-color: #94A3B8; }
.waiter-table-tile.status-occupied { --status-color: #F59E0B; }
.waiter-table-tile.status-order_placed { --status-color: #3B82F6; }
.waiter-table-tile.status-preparing { --status-color: #FB7185; }
.waiter-table-tile.status-ready { --status-color: #10B981; }
.waiter-table-tile.status-served { --status-color: #A78BFA; }
.waiter-table-tile.status-needs_bill { --status-color: #EC4899; }

.waiter-table-alert-badge {
  position: absolute; top: -6px; right: -6px; background: var(--danger); color: white; font-size: 0.65rem;
  font-weight: 800; border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center;
}

/* ---------------- Table detail ---------------- */

.detail-actions { display: flex; gap: 0.6rem; margin-bottom: 1.25rem; flex-wrap: wrap; }

.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 0.85rem; }
.order-card-header { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.order-card-total { margin-left: auto; }

.order-item-row { display: flex; justify-content: space-between; align-items: center; font-size: 0.9rem; padding: 0.3rem 0; }
.order-item-notes { margin: -0.2rem 0 0.3rem; }

.status-badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 999px; font-size: 0.72rem; font-weight: 700; }
.status-received { background: #DBEAFE; color: #1E40AF; }
.status-preparing { background: #FED7AA; color: #9A3412; }
.status-ready { background: #DCFCE7; color: #166534; }
.status-served { background: #E0E7FF; color: #3730A3; }
.status-paid { background: #DCFCE7; color: #166534; }
.status-cancelled { background: #FEE2E2; color: #991B1B; }
.status-item-new { background: #F3F4F6; color: #4B5563; }
.status-item-preparing { background: #FED7AA; color: #9A3412; }
.status-item-ready { background: #DCFCE7; color: #166534; }

/* ---------------- Modals (status reset, add order) ---------------- */

.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.55); display: flex; align-items: center; justify-content: center; padding: 1.25rem; z-index: 200; }
.modal-card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; max-width: 380px; width: 100%; max-height: 88vh; overflow-y: auto; position: relative; }
.modal-card-wide { max-width: 560px; }
.modal-close { position: absolute; top: 0.8rem; right: 0.9rem; background: none; border: none; font-size: 1.4rem; color: var(--text-muted); cursor: pointer; }

.form-field { margin-bottom: 1rem; }
.form-field label { display: block; font-size: 0.82rem; font-weight: 700; margin-bottom: 0.35rem; }
.form-field input, .form-field select {
  width: 100%; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.9rem; font-family: inherit;
}

/* ---------------- Waiter menu (inside Add Order modal) ---------------- */

.waiter-menu-category { margin-bottom: 1rem; }
.waiter-menu-category-title { font-weight: 800; font-size: 0.85rem; margin-bottom: 0.5rem; text-transform: uppercase; color: var(--text-muted); }
.waiter-menu-item-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
.waiter-menu-item-name { flex: 1; font-size: 0.9rem; font-weight: 600; }
.waiter-menu-item-price { font-size: 0.85rem; color: var(--primary); font-weight: 700; }

.quick-add-popover { background: #F9FAFB; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.85rem; margin: 0.4rem 0; }
.modifier-group-block-sm { margin-bottom: 0.6rem; }
.modifier-group-label-sm { font-size: 0.82rem; font-weight: 700; margin-bottom: 0.3rem; }
.modifier-option-sm { display: block; font-size: 0.85rem; padding: 0.2rem 0; }
.required-tag { color: var(--danger); font-size: 0.7rem; font-weight: 700; }

.qty-stepper { display: flex; align-items: center; gap: 0.7rem; }
.qty-stepper button { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); background: var(--surface); font-size: 1rem; cursor: pointer; }
.qa-qty-row { display: flex; justify-content: space-between; align-items: center; margin: 0.6rem 0; font-size: 0.85rem; font-weight: 700; }
.qa-notes-input { width: 100%; padding: 0.4rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius); font-size: 0.85rem; margin-bottom: 0.5rem; }

.waiter-draft-summary { border-top: 1px solid var(--border); margin-top: 1rem; padding-top: 1rem; }
.cart-line { display: flex; align-items: center; gap: 0.6rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.6rem 0.75rem; margin-bottom: 0.5rem; }
.cart-line-info { flex: 1; display: flex; flex-direction: column; gap: 0.1rem; }
.cart-line-name { font-weight: 700; font-size: 0.85rem; }
.cart-line-modifiers { font-size: 0.75rem; color: var(--text-muted); }
.cart-line-price { font-size: 0.8rem; color: var(--primary); font-weight: 700; }
.cart-line-remove { background: none; border: none; font-size: 1.2rem; color: var(--text-muted); cursor: pointer; }
.cart-summary-row { display: flex; justify-content: space-between; padding: 0.5rem 0; font-size: 0.95rem; }

/* ---------------- Alerts drawer ---------------- */

.alerts-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 320px; max-width: 90vw; background: var(--surface);
  box-shadow: -8px 0 30px rgba(0,0,0,0.2); z-index: 250; display: flex; flex-direction: column;
}
.alerts-drawer-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border); }
.alerts-drawer-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--text-muted); }

.alert-row { display: flex; justify-content: space-between; align-items: center; padding: 0.85rem 1rem; border-bottom: 1px solid var(--border); }
.alert-row-actions { display: flex; gap: 0.4rem; }