/* ===== Admin Panel — Modern Dark Sidebar Design ===== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar-w: 240px;
  --bg:        #f0f4f8;
  --white:     #ffffff;
  --slate-50:  #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --cyan-400:  #22d3ee;
  --cyan-500:  #06b6d4;
  --cyan-600:  #0891b2;
  --green-500: #22c55e;
  --amber-500: #f59e0b;
  --red-500:   #ef4444;
  --text:      #1e293b;
  --text-muted:#64748b;
  --border:    #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --radius:    12px;
  --radius-sm: 8px;
}

html, body { height: 100%; font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }

/* ═══════════════════ LAYOUT ═══════════════════ */
.app { display: flex; min-height: 100vh; }

/* ═══════════════════ SIDEBAR ═══════════════════ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--slate-900);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  box-shadow: 4px 0 24px rgba(0,0,0,.25);
}

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

.sidebar-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  letter-spacing: -.3px;
}

.sidebar-header h1 span {
  background: linear-gradient(135deg, var(--cyan-400), var(--cyan-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--slate-400);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .18s ease;
  margin: 1px 8px;
  border-radius: 8px;
  border-left: none;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,.06);
}

.nav-item.active {
  color: var(--white);
  background: rgba(6,182,212,.15);
  box-shadow: inset 0 0 0 1px rgba(6,182,212,.2);
}

.nav-item.active .nav-icon { color: var(--cyan-400); }

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

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

.btn-logout {
  width: 100%;
  padding: 9px 14px;
  background: rgba(239,68,68,.1);
  color: #fca5a5;
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}

.btn-logout:hover {
  background: rgba(239,68,68,.2);
  color: #fecaca;
}

/* ═══════════════════ MAIN CONTENT ═══════════════════ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 32px;
  min-height: 100vh;
  font-size: 14px;
}

/* ═══════════════════ AUTH ═══════════════════ */
.auth-section {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--slate-900) 0%, #0c1a2e 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
}

.auth-section.hidden { display: none; }

.auth-card {
  background: var(--white);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 25px 50px rgba(0,0,0,.4);
  text-align: center;
}

.auth-card h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 28px;
  color: var(--slate-800);
}

.auth-card .form-group { text-align: left; margin-bottom: 20px; }

.auth-card .btn-primary { width: 100%; padding: 13px; font-size: 15px; }

.error-message {
  color: var(--red-500);
  font-size: 13px;
  margin-top: 12px;
  min-height: 20px;
}

/* ═══════════════════ SECTIONS ═══════════════════ */
.section { animation: fadeIn .25s ease; }
.section.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--slate-800);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.header-actions select {
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: var(--white);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .18s;
}

.header-actions select:focus {
  outline: none;
  border-color: var(--cyan-500);
}

/* ═══════════════════ CARDS ═══════════════════ */
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  margin-bottom: 20px;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--slate-700);
  margin-bottom: 16px;
}

.card.hidden { display: none; }

.hint {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════ STAT CARDS ═══════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--slate-200);
  transition: box-shadow .2s, transform .2s;
}

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

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

.stat-card:nth-child(1) .stat-icon { background: rgba(6,182,212,.1); }
.stat-card:nth-child(2) .stat-icon { background: rgba(34,197,94,.1); }
.stat-card:nth-child(3) .stat-icon { background: rgba(245,158,11,.1); }
.stat-card:nth-child(4) .stat-icon { background: rgba(99,102,241,.1); }

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--slate-800);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

.table { width: 100%; border-collapse: collapse; }

thead { background: var(--slate-50); }

th {
  text-align: left;
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 13px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
}

tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--slate-50); }
tbody tr:last-child td { border-bottom: none; }

tr.status-paid   { background: rgba(34,197,94,.03); }
tr.status-hold   { background: rgba(245,158,11,.03); }
tr.status-cancelled { background: rgba(239,68,68,.03); }
tr.status-expired   { opacity: .55; }

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

.badge-success { background: rgba(34,197,94,.12); color: #16a34a; }
.badge-warning { background: rgba(245,158,11,.12); color: #d97706; }
.badge-danger  { background: rgba(239,68,68,.12);  color: #dc2626; }
.badge-gray    { background: var(--slate-100);     color: var(--slate-500); }

/* ═══════════════════ BUTTONS ═══════════════════ */
.btn, .btn-primary, .btn-secondary, .btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  padding: 10px 20px;
  background: var(--cyan-500);
  color: var(--white);
  font-size: 13.5px;
  box-shadow: 0 1px 3px rgba(6,182,212,.3);
}

.btn-primary:hover { background: var(--cyan-600); box-shadow: 0 4px 12px rgba(6,182,212,.35); transform: translateY(-1px); }
.btn-primary:active { transform: none; }

.btn-secondary, .btn {
  padding: 9px 16px;
  background: var(--white);
  color: var(--slate-700);
  border: 1px solid var(--border);
  font-size: 13px;
}

.btn-secondary:hover, .btn:hover { background: var(--slate-50); border-color: var(--slate-300); }

.btn-danger {
  padding: 7px 14px;
  background: rgba(239,68,68,.1);
  color: var(--red-500);
  border: 1px solid rgba(239,68,68,.2);
  font-size: 12px;
}

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

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

/* ═══════════════════ FORMS ═══════════════════ */
.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color .18s, box-shadow .18s;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--cyan-500);
  box-shadow: 0 0 0 3px rgba(6,182,212,.12);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--slate-100);
}

/* ═══════════════════ EDITABLE CELLS ═══════════════════ */
.editable {
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  transition: all .18s;
  display: inline-block;
}

.editable:hover {
  background: var(--cyan-500);
  color: var(--white);
}

/* ═══════════════════ MODAL ═══════════════════ */
.modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0; visibility: hidden;
  transition: all .2s;
}

.modal.active { opacity: 1; visibility: visible; }

.modal-content {
  background: var(--white);
  padding: 28px;
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,.3);
  animation: slideUp .2s ease;
}

@keyframes slideUp {
  from { transform: translateY(20px) scale(.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

.modal-content h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--slate-800);
}

.modal-actions {
  display: flex; gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ═══════════════════ STOCK COLORS ═══════════════════ */
.stock-low  { color: var(--amber-500); font-weight: 600; }
.stock-zero { color: var(--red-500);   font-weight: 600; }
.stock-ok   { color: var(--green-500); font-weight: 600; }

/* ═══════════════════ PRODUCTS TABLE TOGGLES ═══════════════════ */
.toggle-active {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  border: none; cursor: pointer; font-family: inherit;
  transition: all .18s;
}
.toggle-active.on  { background: rgba(34,197,94,.12); color: #16a34a; }
.toggle-active.off { background: var(--slate-100); color: var(--slate-500); }
.toggle-active:hover { opacity: .8; }

/* ═══════════════════ PROMO CARD ═══════════════════ */
.promo-card {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--slate-100);
  gap: 12px;
  flex-wrap: wrap;
}
.promo-card:last-child { border-bottom: none; }
.promo-code {
  font-family: monospace;
  font-size: 15px;
  font-weight: 700;
  color: var(--slate-800);
  background: var(--slate-100);
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: .5px;
}
.promo-meta { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════ BLOCKED DATE CARD ═══════════════════ */
.blocked-date-row {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--slate-100);
}
.blocked-date-row:last-child { border-bottom: none; }
.blocked-date-badge {
  background: rgba(239,68,68,.1);
  color: var(--red-500);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px; font-weight: 700;
}

/* ═══════════════════ EMPTY STATE ═══════════════════ */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ═══════════════════ RESPONSIVE ═══════════════════ */
@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .section-header { flex-direction: column; align-items: flex-start; }
  th, td { padding: 10px 10px; }
  table { font-size: 13px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 20px; }
}

/* ═══════════════════ MOBILE TOP BAR ═══════════════════ */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--slate-900);
  z-index: 300;
  align-items: center;
  padding: 0 16px;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,.35);
}

.mobile-topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
}

@media (max-width: 768px) {
  .mobile-topbar { display: flex; }
  .main-content  { padding-top: calc(56px + 20px) !important; }
}

/* ═══════════════════ HAMBURGER ═══════════════════ */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--white);
  border-radius: 2px;
  transition: all .25s ease;
}

/* ═══════════════════ SIDEBAR OVERLAY ═══════════════════ */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ═══════════════════ REVENUE CHART ═══════════════════ */
.chart-card { margin-bottom: 20px; }

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.chart-header h3 { margin: 0; font-size: 15px; }

.chart-period-btns { display: flex; gap: 6px; }

.chart-period-btn {
  padding: 5px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  color: var(--slate-600);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}
.chart-period-btn:hover  { border-color: var(--cyan-500); color: var(--cyan-600); }
.chart-period-btn.active { background: var(--cyan-500); border-color: var(--cyan-500); color: var(--white); }

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

.chart-unavailable {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px;
  font-size: 13px;
}

/* ═══════════════════ FILTERS ROW ═══════════════════ */
.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-wrap { position: relative; flex: 1; min-width: 200px; }

.search-icon {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--slate-400);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit;
  color: var(--text); background: var(--white);
  transition: border-color .18s, box-shadow .18s;
}
.search-input:focus {
  outline: none;
  border-color: var(--cyan-500);
  box-shadow: 0 0 0 3px rgba(6,182,212,.1);
}

.date-filters { display: flex; align-items: center; gap: 6px; }

.date-input {
  padding: 9px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px; font-family: inherit;
  color: var(--text); background: var(--white);
  transition: border-color .18s;
  cursor: pointer;
}
.date-input:focus { outline: none; border-color: var(--cyan-500); }

.date-sep { color: var(--slate-400); font-size: 13px; }

@media (max-width: 640px) {
  .filters-row { gap: 8px; }
  .date-filters { width: 100%; }
  .date-input { flex: 1; }
}

/* ═══════════════════ PAGINATION ═══════════════════ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 4px;
  flex-wrap: wrap;
  gap: 10px;
}
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-btns { display: flex; gap: 5px; flex-wrap: wrap; }

/* ═══════════════════ BOOKING ROW HOVER ═══════════════════ */
.booking-row { cursor: pointer; }
.booking-row:hover { background: rgba(6,182,212,.05) !important; }

/* ═══════════════════ AUTO-REFRESH STATUS ═══════════════════ */
.auto-refresh-status {
  font-size: 11px;
  color: rgba(255,255,255,.3);
  text-align: center;
  padding: 0 4px 10px;
  line-height: 1.4;
}

/* ═══════════════════ BOOKING DETAIL MODAL ═══════════════════ */
.modal-content-lg {
  max-width: 580px;
  max-height: 88vh;
  overflow-y: auto;
}

.modal-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}
.modal-detail-header h3 { font-size: 18px; font-weight: 700; color: var(--slate-800); margin: 0; }

.modal-close {
  width: 32px; height: 32px;
  border: none; background: var(--slate-100);
  color: var(--slate-500); border-radius: 8px;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all .18s; font-family: inherit; flex-shrink: 0;
}
.modal-close:hover { background: var(--slate-200); color: var(--slate-700); }

.detail-section {
  border: 1px solid var(--slate-100);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.detail-section-title {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: 10px;
}

.detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--slate-50);
  font-size: 13.5px;
}
.detail-row:last-child { border-bottom: none; padding-bottom: 0; }
.detail-label { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.detail-total { font-size: 15px; }

.detail-items { display: flex; flex-direction: column; gap: 6px; }

.detail-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--slate-50);
  border-radius: 8px;
  font-size: 13.5px;
  gap: 10px;
}
.detail-item span:first-child { flex: 1; }
.detail-item span:nth-child(2) { color: var(--text-muted); white-space: nowrap; }
.detail-item span:last-child   { font-weight: 600; white-space: nowrap; }

.detail-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 4px;
}

/* ═══════════════════ TABLE WRAP ═══════════════════ */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
