/* =========================================================
   GLOBAL TEA CAFE - ADMIN PANEL STYLING
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --admin-sidebar-bg: #07281c;
  --admin-sidebar-hover: #0e4d36;
  --admin-primary: #0b3b28;
  --admin-primary-light: #166534;
  --admin-gold: #d4af37;
  --admin-bg: #f8fafc;
  --admin-surface: #ffffff;
  --admin-border: #e2e8f0;
  --admin-text-main: #0f172a;
  --admin-text-muted: #64748b;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar-bg);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid rgba(212, 175, 55, 0.25);
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.sidebar-brand h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.sidebar-brand p {
  font-size: 0.68rem;
  color: var(--admin-gold);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.sidebar-nav {
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--admin-sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: rgba(212, 175, 55, 0.18);
  border-color: var(--admin-gold);
  color: #fef08a;
  font-weight: 600;
}

.nav-item-icon {
  font-size: 1.15rem;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  color: #94a3b8;
}

.server-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  padding: 4px 10px;
  border-radius: 9999px;
  margin-bottom: 6px;
  font-weight: 600;
}

.status-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  border-radius: 50%;
  animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

/* Main Content Area */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Top Bar */
.admin-topbar {
  background: #ffffff;
  border-bottom: 1px solid var(--admin-border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--admin-primary);
}

.topbar-title p {
  font-size: 0.8rem;
  color: var(--admin-text-muted);
}

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

.btn-admin {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--admin-border);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  text-decoration: none;
  color: var(--admin-text-main);
}

.btn-admin:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-admin-primary {
  background: var(--admin-primary);
  color: #fff;
  border-color: var(--admin-primary);
}

.btn-admin-primary:hover {
  background: var(--admin-primary-light);
  border-color: var(--admin-primary-light);
  color: #fff;
}

.btn-admin-gold {
  background: var(--admin-gold);
  color: #07281c;
  border-color: var(--admin-gold);
  font-weight: 700;
}

.btn-admin-gold:hover {
  background: #e5b842;
}

.btn-admin-danger {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
  font-weight: 700;
}

.btn-admin-danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

/* Page Container */
.admin-content {
  padding: 24px 28px;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

/* Metric Cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  position: relative;
  overflow: hidden;
}

.metric-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.metric-card-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-card-icon {
  font-size: 1.25rem;
  padding: 6px;
  background: #f8fafc;
  border-radius: var(--radius-md);
}

.metric-card-val {
  font-family: 'Outfit', sans-serif;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--admin-primary);
  line-height: 1;
  margin-bottom: 4px;
}

.metric-card-sub {
  font-size: 0.75rem;
  color: var(--admin-text-muted);
}

/* Section Box */
.section-panel {
  background: var(--admin-surface);
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  overflow: hidden;
}

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

.panel-title h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--admin-text-main);
}

.panel-title p {
  font-size: 0.78rem;
  color: var(--admin-text-muted);
}

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

/* Filters Bar */
.filter-bar {
  padding: 14px 20px;
  background: #f8fafc;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input {
  padding: 8px 14px;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  min-width: 240px;
  background: #fff;
}

.select-filter {
  padding: 8px 12px;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  background: #fff;
  cursor: pointer;
}

/* Data Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  text-align: left;
}

.admin-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 600;
  color: var(--admin-text-muted);
  border-bottom: 1px solid var(--admin-border);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.5px;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-text-main);
  vertical-align: middle;
}

.admin-table tr:hover {
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 9999px;
  font-size: 0.74rem;
  font-weight: 600;
}

.badge-chai   { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.badge-burger { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.badge-pizza  { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-15off  { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.badge-25off  { background: #f5f3ff; color: #6d28d9; border: 1px solid #ddd6fe; }
.badge-miss   { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

.badge-redeemed { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.badge-pending  { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

.coupon-code-pill {
  font-family: monospace;
  font-size: 0.82rem;
  font-weight: 700;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 4px;
  color: #0f172a;
  border: 1px dashed #cbd5e1;
}

/* Action Button inside Table */
.btn-sm-action {
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-redeem {
  background: #16a34a;
  color: #fff;
}
.btn-redeem:hover { background: #15803d; }

.btn-copy {
  background: #e2e8f0;
  color: #334155;
}
.btn-copy:hover { background: #cbd5e1; }

/* Cashier Terminal Box */
.cashier-box {
  max-width: 600px;
  margin: 20px auto;
  background: #fff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  text-align: center;
}

.cashier-input-group {
  display: flex;
  gap: 10px;
  margin: 18px 0;
}

.cashier-input {
  flex: 1;
  padding: 14px 18px;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  border: 2px solid var(--admin-border);
  border-radius: var(--radius-md);
  text-align: center;
}

.cashier-input:focus {
  outline: none;
  border-color: var(--admin-primary);
}

/* Network Info Callout */
.network-info-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.network-info-text h4 {
  font-size: 0.85rem;
  color: #1e40af;
  margin-bottom: 2px;
}

.network-info-text p {
  font-size: 0.78rem;
  color: #3b82f6;
}

/* Outlets Grid */
.outlets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  padding: 20px;
}

.outlet-admin-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 4px solid var(--admin-primary);
}

.outlet-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.outlet-card-code {
  font-family: monospace;
  font-weight: 700;
  font-size: 0.8rem;
  background: #e2e8f0;
  padding: 2px 6px;
  border-radius: 4px;
}

.outlet-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--admin-primary);
}

.outlet-card-loc {
  font-size: 0.75rem;
  color: var(--admin-text-muted);
}

.outlet-card-progress {
  background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.74rem;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-weight: 600;
}

.progress-bar-bg {
  height: 6px;
  background: #e2e8f0;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--admin-primary);
  border-radius: 9999px;
}

.outlet-card-quotas {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.quota-tag {
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #334155;
  font-weight: 600;
}

.outlet-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.outlet-card-actions .btn-admin {
  flex: 1;
  padding: 6px 10px;
  font-size: 0.76rem;
  justify-content: center;
}

/* Responsive */
@media (max-width: 900px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
}

/* =========================================================
   ADMIN AUTHENTICATION & LOGIN SCREEN
   ========================================================= */

.admin-login-wrapper {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 10% 20%, rgba(11, 59, 40, 0.95) 0%, rgba(7, 40, 28, 0.98) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.admin-login-card {
  background: #ffffff;
  border-radius: 20px;
  max-width: 420px;
  width: 100%;
  padding: 36px 30px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(212, 175, 55, 0.4);
  position: relative;
  overflow: hidden;
  animation: login-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.admin-login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  background: linear-gradient(90deg, #0b3b28 0%, #d4af37 50%, #0b3b28 100%);
}

@keyframes login-pop {
  0% { opacity: 0; transform: scale(0.92) translateY(20px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  height: 60px;
  width: auto;
  object-fit: contain;
  margin-bottom: 12px;
}

.login-brand h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #07281c;
  letter-spacing: 0.5px;
}

.login-brand p {
  font-size: 0.8rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}

.admin-login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group-login {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-login label {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .icon {
  position: absolute;
  left: 14px;
  font-size: 1.05rem;
  color: #94a3b8;
  pointer-events: none;
}

.login-input {
  width: 100%;
  padding: 12px 14px 12px 44px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s;
  background: #f8fafc;
}

.login-input:focus {
  outline: none;
  border-color: #0b3b28;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(11, 59, 40, 0.12);
}

.btn-toggle-pass {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #64748b;
}

.btn-login-submit {
  width: 100%;
  background: linear-gradient(135deg, #0b3b28 0%, #166534 100%);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.5px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(11, 59, 40, 0.25);
  transition: all 0.2s;
  margin-top: 4px;
}

.btn-login-submit:hover {
  background: linear-gradient(135deg, #166534 0%, #0b3b28 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(11, 59, 40, 0.35);
}

.login-error-alert {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  text-align: center;
}

.default-creds-hint {
  text-align: center;
  font-size: 0.75rem;
  color: #64748b;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 4px;
}

.default-creds-hint code {
  background: #e2e8f0;
  padding: 2px 5px;
  border-radius: 4px;
  font-weight: 700;
  color: #0f172a;
}

.btn-logout {
  width: 100%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  margin-top: 6px;
}

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

/* =========================================================
   MODAL DIALOG SYSTEM (ADD / EDIT OUTLETS)
   ========================================================= */

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  animation: modal-fade 0.2s ease;
}

.admin-modal-box {
  background: #ffffff;
  border-radius: 16px;
  max-width: 520px;
  width: 100%;
  padding: 28px 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--admin-border);
  position: relative;
  animation: modal-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-pop {
  from { opacity: 0; transform: scale(0.92) translateY(15px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

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

.admin-modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--admin-primary);
}

.btn-modal-close {
  background: #f1f5f9;
  border: none;
  font-size: 1.1rem;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  transition: all 0.2s;
}

.btn-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.outlet-empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 56px 24px;
  background: #ffffff;
  border: 2px dashed #cbd5e1;
  border-radius: 16px;
}

.outlet-empty-state .empty-icon {
  font-size: 3.5rem;
  margin-bottom: 14px;
  display: block;
}

.outlet-empty-state h4 {
  font-size: 1.3rem;
  font-family: 'Outfit', sans-serif;
  color: var(--admin-primary);
  margin-bottom: 8px;
}

.outlet-empty-state p {
  font-size: 0.9rem;
  color: var(--admin-text-muted);
  max-width: 500px;
  margin: 0 auto 24px auto;
  line-height: 1.5;
.btn-admin-danger {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.btn-admin-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* =========================================================
   OUTLET QR & LANDING PAGE PREVIEW MODAL
   ========================================================= */

.qr-modal-preview-box {
  background: #ffffff;
  border: 2px solid var(--admin-primary);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 200px;
  margin: 0 auto 16px auto;
  box-shadow: 0 8px 20px rgba(11, 59, 40, 0.1);
}

.qr-modal-preview-box canvas,
.qr-modal-preview-box img {
  width: 172px !important;
  height: 172px !important;
  display: block;
  border-radius: 4px;
}

.url-showcase-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
  text-align: left;
}

.url-showcase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #334155;
}

.url-showcase-body {
  display: flex;
  align-items: center;
  gap: 8px;
}

.url-showcase-code {
  flex: 1;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qr-target-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 14px;
  border: 1px solid #e2e8f0;
}

.qr-target-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #64748b;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.qr-target-tab-btn.active {
  background: #ffffff;
  color: var(--admin-primary);
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

