/* ============================================================
   DineFlow ERP - Minimal UI Stylesheet
   ============================================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --sidebar-width: 220px;
  --topbar-height: 56px;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.5;
}

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

/* ---------- Layout ---------- */
.app-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: var(--gray-900);
  color: #fff;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  overflow-y: auto;
  z-index: 100;
  transition: transform .2s ease;
}
.sidebar-brand {
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--primary); display:inline-block; }
.sidebar-section { padding: 10px 20px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); margin-top: 8px; }
.sidebar-nav { list-style: none; margin: 0; padding: 4px 0; }
.sidebar-nav li a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 20px;
  color: var(--gray-300);
  font-size: 13.5px;
  border-left: 3px solid transparent;
}
.sidebar-nav li a:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar-nav li a.active { background: rgba(37,99,235,.15); border-left-color: var(--primary); color: #fff; font-weight: 600; }
.sidebar-nav li a .icon { width: 18px; text-align: center; }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
}
.topbar .left { display: flex; align-items: center; gap: 12px; }
.topbar .page-title { font-size: 16px; font-weight: 600; color: var(--gray-900); }
.topbar .right { display: flex; align-items: center; gap: 16px; }
.topbar .branch-badge {
  background: var(--gray-100); padding: 4px 10px; border-radius: var(--radius);
  font-size: 12px; color: var(--gray-600); font-weight: 500;
}
.topbar .user-menu { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-700); }
.topbar .menu-toggle { display: none; background: none; border: none; font-size: 20px; cursor: pointer; }

.page-body { padding: 20px; flex: 1; }

/* ---------- License banner ---------- */
.license-banner {
  padding: 8px 20px; font-size: 13px; text-align: center;
  background: #fef3c7; color: #92400e; border-bottom: 1px solid #fde68a;
}
.license-banner.expired { background: #fee2e2; color: #991b1b; border-bottom-color: #fecaca; }

/* ---------- Cards ---------- */
.card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.card-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 16px; }

/* ---------- Stat cards ---------- */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.stat-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 16px;
}
.stat-card .label { font-size: 12px; color: var(--gray-500); margin-bottom: 4px; }
.stat-card .value { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.stat-card .sub { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 13px; font-weight: 500;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  background: var(--gray-100); color: var(--gray-700);
  transition: background .15s;
}
.btn:hover { background: var(--gray-200); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--gray-700); }
.form-control {
  width: 100%; padding: 9px 12px; font-size: 13.5px;
  border: 1px solid var(--gray-300); border-radius: var(--radius);
  background: #fff; color: var(--gray-800);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 14px; }
.form-help { font-size: 12px; color: var(--gray-400); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
select.form-control { cursor: pointer; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th, table.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); text-align: left; }
table.data-table th { background: var(--gray-50); font-weight: 600; color: var(--gray-600); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.data-table tbody tr:hover { background: var(--gray-50); }
table.data-table td.right, table.data-table th.right { text-align: right; }
table.data-table td.center, table.data-table th.center { text-align: center; }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ---------- Alerts ---------- */
.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ---------- Login ---------- */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--gray-900), var(--gray-700));
  padding: 20px;
}
.auth-card { background: #fff; border-radius: 10px; padding: 32px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.2); }
.auth-card .logo { text-align: center; margin-bottom: 20px; }
.auth-card .logo .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); display: inline-block; margin-right: 6px; }
.auth-card .logo h1 { font-size: 22px; margin: 8px 0 0; }
.auth-card .logo p { color: var(--gray-500); font-size: 12px; margin: 4px 0 0; }

/* ---------- POS Layout ---------- */
.pos-layout { display: grid; grid-template-columns: 1fr 360px; gap: 12px; height: calc(100vh - 56px); }
.pos-menu { overflow-y: auto; padding: 12px; }
.pos-cart { background: #fff; border-left: 1px solid var(--gray-200); display: flex; flex-direction: column; height: 100%; }
.pos-categories { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--gray-200); }
.pos-category-btn {
  flex-shrink: 0; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--gray-300);
  background: #fff; font-size: 13px; cursor: pointer; font-weight: 500; white-space: nowrap;
}
.pos-category-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pos-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.pos-item-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 10px; cursor: pointer; text-align: left; transition: border-color .1s;
}
.pos-item-card:hover { border-color: var(--primary); }
.pos-item-card .name { font-size: 13px; font-weight: 600; margin-bottom: 4px; line-height: 1.3; }
.pos-item-card .price { font-size: 12px; color: var(--gray-500); }
.pos-item-card .veg-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 5px; }
.veg-dot.veg { background: #16a34a; }
.veg-dot.non_veg { background: #dc2626; }
.veg-dot.egg { background: #d97706; }

.pos-cart-header { padding: 12px 14px; border-bottom: 1px solid var(--gray-200); font-weight: 700; }
.pos-cart-items { flex: 1; overflow-y: auto; padding: 8px 14px; }
.pos-cart-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--gray-100); }
.pos-cart-item .info { flex: 1; }
.pos-cart-item .info .name { font-size: 13px; font-weight: 500; }
.pos-cart-item .info .price { font-size: 11px; color: var(--gray-500); }
.pos-cart-item .qty-control { display: flex; align-items: center; gap: 6px; }
.pos-cart-item .qty-control button { width: 22px; height: 22px; border-radius: 4px; border: 1px solid var(--gray-300); background: #fff; cursor: pointer; font-size: 14px; line-height: 1; }
.pos-cart-footer { padding: 14px; border-top: 1px solid var(--gray-200); }
.pos-cart-totals .row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.pos-cart-totals .row.total { font-size: 16px; font-weight: 700; border-top: 1px solid var(--gray-200); padding-top: 8px; margin-top: 4px; }
.pos-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }

/* ---------- Floor map ---------- */
.floor-map { position: relative; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); min-height: 500px; padding: 20px; }
.floor-table {
  position: absolute; width: 90px; height: 70px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 2px solid var(--gray-300); background: #fff; cursor: pointer; font-size: 12px; font-weight: 600;
}
.floor-table.available { border-color: var(--success); background: #f0fdf4; }
.floor-table.occupied { border-color: var(--danger); background: #fef2f2; }
.floor-table.reserved { border-color: var(--warning); background: #fffbeb; }
.floor-table .cap { font-size: 10px; color: var(--gray-400); font-weight: 400; }

/* ---------- KOT / Kitchen ---------- */
.kitchen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.kot-card { background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.kot-card .kot-header { padding: 10px 12px; background: var(--gray-900); color: #fff; display: flex; justify-content: space-between; font-size: 13px; }
.kot-card .kot-body { padding: 10px 12px; }
.kot-card .kot-item { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; border-bottom: 1px dashed var(--gray-100); }
.kot-card .kot-footer { padding: 10px 12px; display: flex; gap: 8px; }
.kot-card.pending { border-left: 4px solid var(--warning); }
.kot-card.preparing { border-left: 4px solid var(--primary); }
.kot-card.ready { border-left: 4px solid var(--success); }

/* ---------- Print styles (KOT / Receipt) ---------- */
@media print {
  body * { visibility: hidden; }
  .print-area, .print-area * { visibility: visible; }
  .print-area { position: absolute; top: 0; left: 0; width: 100%; }
  .no-print { display: none !important; }
}
.receipt { width: 280px; font-family: 'Courier New', monospace; font-size: 12px; margin: 0 auto; }
.receipt h2 { text-align: center; margin: 4px 0; font-size: 15px; }
.receipt .center { text-align: center; }
.receipt hr { border: none; border-top: 1px dashed #000; margin: 6px 0; }
.receipt table { width: 100%; font-size: 11px; }
.receipt table td { padding: 1px 0; }

/* ---------- Misc ---------- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--gray-500); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gray-200); margin-bottom: 16px; }
.tabs a { padding: 8px 14px; font-size: 13px; color: var(--gray-600); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray-400); }
.empty-state .icon { font-size: 40px; margin-bottom: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .topbar .menu-toggle { display: block; }
  .pos-layout { grid-template-columns: 1fr; }
  .pos-cart { border-left: none; border-top: 1px solid var(--gray-200); }
}
