/* ============================================================
   Anuj Tandoori Chaap & Momos — Admin Panel Styles
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary:    #FF6B35;
  --primary-dk: #E85A20;
  --sidebar-bg: #1A1A2E;
  --sidebar-w:  260px;
  --white:      #FFFFFF;
  --bg:         #F0F2F5;
  --card:       #FFFFFF;
  --text:       #1A1A2E;
  --text-muted: #6B7280;
  --border:     #E5E7EB;
  --green:      #10b981;
  --red:        #ef4444;
  --blue:       #3b82f6;
  --yellow:     #f59e0b;
  --purple:     #8b5cf6;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
  --radius:     12px;
  --radius-sm:  8px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}

.sidebar-logo {
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, var(--primary), #FF9500);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(255,107,53,0.4);
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}

.sidebar-brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 400;
}

.sidebar-admin-badge {
  background: rgba(255,107,53,0.15);
  border: 1px solid rgba(255,107,53,0.3);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  display: inline-block;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
  scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.9);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255,107,53,0.25), rgba(255,107,53,0.1));
  color: var(--primary);
  border-left: 3px solid var(--primary);
}

.nav-icon { font-size: 18px; flex-shrink: 0; }

.nav-badge {
  margin-left: auto;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 7px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.nav-item.logout {
  color: rgba(239,68,68,0.7);
}

.nav-item.logout:hover {
  background: rgba(239,68,68,0.1);
  color: var(--red);
}

/* ---- Main Content ---- */
.admin-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title { font-size: 20px; font-weight: 700; }
.topbar-sub { font-size: 13px; color: var(--text-muted); margin-top: 1px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), #FF9500);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
}

.topbar-name { font-size: 14px; font-weight: 600; }
.topbar-time { font-size: 12px; color: var(--text-muted); }

.page-content { padding: 28px; flex: 1; }

/* ---- Stat Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.2s, box-shadow 0.2s;
  border-left: 4px solid transparent;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card.orange { border-left-color: var(--primary); }
.stat-card.green  { border-left-color: var(--green); }
.stat-card.blue   { border-left-color: var(--blue); }
.stat-card.purple { border-left-color: var(--purple); }
.stat-card.yellow { border-left-color: var(--yellow); }

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.stat-icon.orange { background: rgba(255,107,53,0.12); }
.stat-icon.green  { background: rgba(16,185,129,0.12); }
.stat-icon.blue   { background: rgba(59,130,246,0.12); }
.stat-icon.purple { background: rgba(139,92,246,0.12); }
.stat-icon.yellow { background: rgba(245,158,11,0.12); }

.stat-val {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* ---- Card ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title { font-size: 16px; font-weight: 700; }
.card-body  { padding: 22px; }

/* ---- Table ---- */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: #F9FAFB;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #FAFAFA; }

/* ---- Badges ---- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-pending   { background: rgba(245,158,11,0.12); color: #B45309; }
.badge-confirmed { background: rgba(59,130,246,0.12); color: #1D4ED8; }
.badge-preparing { background: rgba(139,92,246,0.12); color: #6D28D9; }
.badge-delivery  { background: rgba(6,182,212,0.12);  color: #0E7490; }
.badge-delivered { background: rgba(16,185,129,0.12); color: #047857; }
.badge-cancelled { background: rgba(239,68,68,0.12);  color: #B91C1C; }
.badge-present   { background: rgba(16,185,129,0.12); color: #047857; }
.badge-absent    { background: rgba(239,68,68,0.12);  color: #B91C1C; }
.badge-half      { background: rgba(245,158,11,0.12); color: #B45309; }
.badge-leave     { background: rgba(139,92,246,0.12); color: #6D28D9; }
.badge-avail     { background: rgba(16,185,129,0.12); color: #047857; }
.badge-unavail   { background: rgba(239,68,68,0.12);  color: #B91C1C; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dk); transform: translateY(-1px); }

.btn-success { background: var(--green); color: white; }
.btn-success:hover { opacity: 0.85; }

.btn-danger  { background: var(--red); color: white; }
.btn-danger:hover  { opacity: 0.85; }

.btn-info    { background: var(--blue); color: white; }
.btn-info:hover  { opacity: 0.85; }

.btn-warning { background: var(--yellow); color: white; }
.btn-warning:hover { opacity: 0.85; }

.btn-outline {
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ---- Form Elements ---- */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-control {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255,107,53,0.12);
}

select.form-control { cursor: pointer; }

/* ---- Toggle Switch ---- */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #D1D5DB;
  border-radius: 999px;
  cursor: pointer;
  transition: 0.3s;
}
.toggle-slider:before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.3s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-box {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95);
  transition: transform 0.2s;
}

.modal-overlay.open .modal-box { transform: scale(1); }

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: #F3F4F6;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s;
}
.modal-close:hover { background: var(--red); color: white; }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ---- POS Layout ---- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  height: calc(100vh - 80px);
  overflow: hidden;
}

.pos-menu-panel {
  overflow-y: auto;
  scrollbar-width: thin;
}

.pos-bill-panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-bill-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--primary), var(--primary-dk));
  color: white;
}

.pos-bill-header h3 { font-size: 16px; font-weight: 700; }
.pos-bill-header p  { font-size: 12px; opacity: 0.8; margin-top: 2px; }

.pos-items-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
}

.pos-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.pos-item-row:hover { background: #F9FAFB; }

.pos-item-name { flex: 1; font-size: 13px; font-weight: 500; }
.pos-item-price { font-size: 13px; color: var(--text-muted); min-width: 60px; text-align: right; }
.pos-item-total { font-size: 14px; font-weight: 700; min-width: 70px; text-align: right; color: var(--primary); }

.pos-qty-ctrl { display: flex; align-items: center; gap: 6px; }
.pos-qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: white;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  line-height: 1;
}
.pos-qty-btn:hover { background: var(--primary-dk); }
.pos-qty-val { min-width: 20px; text-align: center; font-weight: 700; font-size: 14px; }

.pos-bill-footer {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
}

.pos-total-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.pos-total-line.grand {
  font-size: 20px;
  font-weight: 800;
  border-top: 2px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
}

.pos-total-line.grand .val { color: var(--primary); }

.pos-action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

/* ---- Menu Items Grid (POS) ---- */
.pos-menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  padding: 4px;
}

.pos-menu-card {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 12px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.pos-menu-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(255,107,53,0.15);
  transform: translateY(-2px);
}

.pos-menu-card.added {
  border-color: var(--primary);
  background: rgba(255,107,53,0.04);
}

.pos-menu-icon { font-size: 32px; margin-bottom: 8px; }
.pos-menu-name { font-size: 12px; font-weight: 600; line-height: 1.3; margin-bottom: 4px; }
.pos-menu-price { font-size: 14px; font-weight: 700; color: var(--primary); }

/* ---- Analytics Charts ---- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 20px;
}

.chart-container {
  position: relative;
  height: 320px;
}

/* ---- Attendance Grid ---- */
.att-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px,1fr));
  gap: 4px;
}

.att-day {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.att-day.present { background: rgba(16,185,129,0.15); color: #047857; border-color: rgba(16,185,129,0.3); }
.att-day.absent  { background: rgba(239,68,68,0.12);  color: #B91C1C; border-color: rgba(239,68,68,0.3); }
.att-day.half    { background: rgba(245,158,11,0.12); color: #B45309; border-color: rgba(245,158,11,0.3); }
.att-day.leave   { background: rgba(139,92,246,0.12); color: #6D28D9; border-color: rgba(139,92,246,0.3); }
.att-day.none    { background: #F3F4F6; color: var(--text-muted); }
.att-day:hover { transform: scale(1.15); }

/* ---- Toast ---- */
#adminToast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-msg {
  background: white;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastSlide 0.3s ease;
  border-left: 4px solid var(--green);
}

.toast-msg.error { border-left-color: var(--red); }
.toast-msg.info  { border-left-color: var(--blue); }

@keyframes toastSlide {
  from { opacity:0; transform: translateX(40px); }
  to   { opacity:1; transform: translateX(0); }
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .admin-content { margin-left: 0; }
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .charts-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
