/* styles.css
   Mobile-first: written for small phone screens first.
   Buttons are at least 48px tall so they're easy to tap. */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-text: #1f2937;
  --color-bg: #f8fafc;
  --color-card: #ffffff;
  --color-border: #e2e8f0;

  /* Thali-remaining status colors */
  --color-green: #16a34a;
  --color-orange: #ea580c;
  --color-red: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
}

.hidden {
  display: none !important;
}

/* Buttons & inputs: big and easy to tap */
button {
  min-height: 48px;
  font-size: 16px;
  border-radius: 10px;
  border: none;
  background: var(--color-primary);
  color: white;
  padding: 0 16px;
  cursor: pointer;
}

button:active {
  background: var(--color-primary-dark);
}

input,
select {
  min-height: 48px;
  font-size: 16px;
  padding: 0 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  width: 100%;
  margin-bottom: 14px;
  background: white;
  color: var(--color-text);
}

label {
  font-size: 14px;
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

/* ---------- Login view ---------- */
#loginView {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-box {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 24px;
  width: 100%;
  max-width: 360px;
}

.login-box h1 {
  text-align: center;
  margin-top: 0;
}

.lang-btn {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  display: block;
  margin: 0 auto 20px auto;
  min-height: 40px;
}

.error-text {
  color: var(--color-red);
  font-size: 14px;
  min-height: 18px;
}

/* ---------- App view ---------- */
#appView {
  min-height: 100vh;
  padding-bottom: 72px; /* leaves room for the fixed bottom nav */
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
}

.top-bar h2 {
  margin: 0;
  font-size: 18px;
}

.top-bar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.top-bar .lang-btn {
  margin: 0;
  min-height: 40px;
  padding: 0 10px;
  font-size: 14px;
}

main {
  padding: 16px;
}

.screen h3 {
  margin-top: 0;
}

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
  padding: 6px;
  gap: 6px;
}

.nav-btn {
  flex: 1;
  background: transparent;
  color: var(--color-text);
  font-size: 13px;
  border-radius: 10px;
}

.nav-btn.active {
  background: var(--color-primary);
  color: white;
}

/* ---------- Status colors (plain text, used on cards) ---------- */
.status-green {
  color: var(--color-green);
}
.status-orange {
  color: var(--color-orange);
}
.status-red {
  color: var(--color-red);
}

/* ================================================================
   CUSTOMERS SCREEN
   ================================================================ */

.customers-toolbar {
  margin-bottom: 12px;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 14px;
}

.chip.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.customer-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 76px; /* room above the floating Add Customer button */
}

.empty-message {
  color: #64748b;
  text-align: center;
  margin-top: 24px;
}

.customer-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.customer-name {
  font-size: 16px;
  font-weight: 700;
}

.customer-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
  color: #64748b;
}

.badge {
  background: #eef2ff;
  color: var(--color-primary);
  border-radius: 6px;
  padding: 2px 8px;
  font-weight: 600;
  font-size: 12px;
}

.badge-pack {
  background: #f1f5f9;
  color: #475569;
}

.balance-pill {
  text-align: center;
  font-size: 20px;
  font-weight: 800;
  min-width: 56px;
  border-radius: 10px;
  padding: 6px 8px;
}

.balance-pill-label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.balance-green {
  background: #dcfce7;
  color: var(--color-green);
}
.balance-orange {
  background: #ffedd5;
  color: var(--color-orange);
}
.balance-red {
  background: #fee2e2;
  color: var(--color-red);
}

/* Floating "Add Customer" button, sits above the bottom nav */
.fab-btn {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 84px;
  max-width: 600px;
  margin: 0 auto;
}

/* ---------- Secondary / danger buttons (More screen, modal Cancel) ---------- */
.secondary-btn {
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  width: 100%;
  margin-bottom: 12px;
}

.danger-btn {
  background: var(--color-red);
  width: 100%;
  margin-bottom: 12px;
}

/* ================================================================
   MODAL (Add / Edit customer)
   ================================================================ */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 30;
}

.modal-content {
  background: var(--color-card);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px 16px 0 0;
  padding: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  margin: 0;
}

.modal-close-btn {
  background: transparent;
  color: var(--color-text);
  font-size: 26px;
  line-height: 1;
  min-height: auto;
  padding: 0 8px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.checkbox-row input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  margin-bottom: 0;
}

.checkbox-row label {
  margin-bottom: 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions button {
  flex: 1;
  margin-bottom: 0;
}

.modal-delete-btn {
  background: var(--color-red);
}

/* ---------- Paid badge and profile line ---------- */
.badge-paid {
  background: #dcfce7;
  color: var(--color-green);
}

.paid-status {
  color: var(--color-green);
  font-weight: 700;
  margin: 0 0 12px 0;
}

/* ================================================================
   HOME SCREEN
   ================================================================ */

.home-date {
  font-size: 18px;
  margin-bottom: 12px;
}

.meal-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab-btn {
  flex: 1;
  background: var(--color-card);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  font-weight: 700;
}

.tab-btn.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.served-counter {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 12px 0;
}

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

.home-row {
  cursor: default;
  gap: 10px;
}

.home-row.is-served {
  background: #f0fdf4;
}

.left-text {
  font-weight: 700;
}

.badge-extra {
  background: #ffedd5;
  color: var(--color-orange);
}

.serve-area {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.serve-btn {
  min-width: 100px;
  min-height: 52px;
  font-size: 17px;
  font-weight: 800;
}

.served-label {
  color: var(--color-green);
  font-weight: 800;
  font-size: 15px;
}

.undo-btn {
  min-height: 40px;
  min-width: 100px;
  font-size: 14px;
  font-weight: 700;
  background: transparent;
  color: var(--color-red);
  border: 1px solid var(--color-red);
}

.undo-btn:active {
  background: #fee2e2;
}

/* ================================================================
   PAYMENT DUE, PAYMENT ALERT and RENEW
   ================================================================ */

.payment-due-box {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  padding: 0 12px;
  margin-bottom: 14px;
}

.payment-due-summary {
  line-height: 48px;
  font-weight: 800;
  color: var(--color-red);
  cursor: pointer;
}

.payment-due-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
}

.due-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.due-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.small-btn {
  min-height: 44px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 700;
}

.whatsapp-btn {
  background: var(--color-green);
}

.whatsapp-btn:active {
  background: #15803d;
}

.alert-text {
  font-size: 17px;
  margin: 12px 0 18px 0;
}

.alert-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.alert-actions button {
  width: 100%;
  margin-bottom: 0;
}

.renew-name {
  font-size: 16px;
  font-weight: 700;
  margin: 8px 0 14px 0;
}

.renew-preview {
  font-size: 20px;
  font-weight: 800;
  text-align: center;
  margin: 0 0 8px 0;
}

.renew-note {
  font-size: 13px;
  color: #64748b;
  text-align: center;
  margin: 0 0 8px 0;
}

/* ================================================================
   HOLIDAYS, HOLIDAY BANNER and TOMORROW CARD
   ================================================================ */

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.full-btn {
  width: 100%;
}

.section-title {
  margin: 24px 0 10px 0;
  font-size: 16px;
}

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

.holiday-row {
  cursor: default;
  gap: 10px;
}

.small-danger {
  background: var(--color-red);
  flex-shrink: 0;
}

.holiday-banner {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #92400e;
  font-weight: 700;
  text-align: center;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
}

.tomorrow-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.tomorrow-title {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 8px;
}

.tomorrow-counts {
  display: flex;
  gap: 10px;
}

.count-box {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 6px;
}

.count-num {
  font-size: 22px;
  font-weight: 800;
}

.count-holiday {
  font-size: 16px;
  line-height: 33px;
  color: var(--color-orange);
}

.count-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

/* ================================================================
   PROFILE SCREEN
   ================================================================ */

.profile-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.back-btn {
  background: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  min-height: 40px;
  min-width: 40px;
  padding: 0 12px;
  font-size: 18px;
}

.profile-header h3 {
  margin: 0;
  flex: 1;
}

.profile-balance-block {
  text-align: center;
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  padding: 18px 10px;
  margin-bottom: 16px;
}

.profile-balance-number {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
}

.balance-caption {
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  margin-top: 6px;
  text-transform: uppercase;
}

.profile-details-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.profile-actions {
  display: flex;
  gap: 10px;
  margin: 16px 0;
}

.profile-actions button {
  flex: 1;
  margin-bottom: 0;
}

.meal-history-group {
  margin-bottom: 8px;
}

.meal-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}

.meal-history-row:last-child {
  border-bottom: none;
}

/* ================================================================
   REPORTS SCREEN
   ================================================================ */

.reports-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.reports-stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.reports-stat-num {
  font-size: 26px;
  font-weight: 800;
}

.reports-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-top: 4px;
}