:root {
  --bg-dark: #060911;
  --bg-sidebar: #0b1120;
  --bg-surface: #111827;
  --bg-surface-hover: #1f293d;
  --bg-card: rgba(17, 24, 39, 0.85);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(245, 158, 11, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-gold: #f59e0b;
  --accent-gold-glow: rgba(245, 158, 11, 0.2);
  --accent-cyan: #06b6d4;
  --accent-purple: #8b5cf6;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 420px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: all 0.3s;
}

.toast.success { border-color: rgba(16, 185, 129, 0.5); }
.toast.error { border-color: rgba(239, 68, 68, 0.5); }
.toast.info { border-color: rgba(6, 182, 212, 0.5); }

.toast-icon { font-size: 20px; }
.toast-text { font-size: 13px; font-weight: 600; color: #fff; }

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

/* Login Overlay */
.login-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #111a2e 0%, #060911 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.brand-badge {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-gold);
  border: 1px solid rgba(245, 158, 11, 0.3);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}

.login-box h2 {
  font-size: 22px;
  font-weight: 800;
  margin-bottom: 8px;
}

.login-box p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.form-group {
  text-align: left;
  margin-bottom: 18px;
}

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

.password-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 14px;
  background: rgba(6, 9, 17, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.2s ease;
}

.password-input-wrapper input {
  padding-right: 46px !important;
}

.btn-toggle-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.2s;
  z-index: 2;
}

.btn-toggle-eye:hover {
  color: var(--accent-gold);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: none;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-family: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  border: none;
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: all 0.2s ease;
}

.btn-danger:hover {
  filter: brightness(1.1);
}

.error-msg {
  color: var(--accent-red);
  font-size: 12px;
  margin-top: 12px;
  font-weight: 600;
}

/* ==========================================================================
   Main Dashboard Layout & Sidebar
   ========================================================================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  width: 100vw;
  background: var(--bg-dark);
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
  padding: 0 8px;
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #ec4899);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.brand-text h3 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
}

.nav-item .icon {
  font-size: 18px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(139, 92, 246, 0.15));
  color: #fff;
  border-color: var(--border-glow);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-color);
}

.btn-mini-app-preview {
  display: block;
  text-align: center;
  text-decoration: none;
  padding: 10px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--accent-gold);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-mini-app-preview:hover {
  background: var(--accent-gold);
  color: #000;
}

.btn-logout {
  width: 100%;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
}

.btn-logout:hover {
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

/* ==========================================================================
   Main Content Area
   ========================================================================== */
.main-content {
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
  max-width: 1600px;
}

/* Top Navbar Header */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 32px;
}

.nav-title h2 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}

.nav-title p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

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

/* View Panels */
.view-panel {
  display: none;
}

.view-panel.active {
  display: block;
  animation: fadeIn 0.25s ease-out;
}

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

/* ==========================================================================
   Metrics Grid Cards
   ========================================================================== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}

.metric-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s, border-color 0.2s;
}

.metric-card:hover {
  transform: translateY(-2px);
}

.metric-card.gold { border-color: rgba(245, 158, 11, 0.35); }
.metric-card.green { border-color: rgba(16, 185, 129, 0.35); }
.metric-card.blue { border-color: rgba(6, 182, 212, 0.35); }
.metric-card.purple { border-color: rgba(139, 92, 246, 0.35); }

.metric-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.metric-details {
  display: flex;
  flex-direction: column;
}

.metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.metric-value {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  margin: 2px 0;
}

.metric-sub {
  font-size: 11px;
  color: var(--text-muted);
}

/* ==========================================================================
   Panel Boxes & Data Tables
   ========================================================================== */
.panel-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-top-bar h3 {
  font-size: 18px;
  font-weight: 700;
}

.panel-top-bar p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.panel-box {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  margin-bottom: 24px;
}

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

.panel-header h3 {
  font-size: 16px;
  font-weight: 700;
}

.btn-link {
  background: transparent;
  border: none;
  color: var(--accent-gold);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-link:hover {
  text-decoration: underline;
}

.search-box input {
  padding: 10px 16px;
  background: rgba(6, 9, 17, 0.8);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  width: 320px;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background: rgba(6, 9, 17, 0.6);
  padding: 14px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-color);
}

.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  display: inline-block;
}

.badge-status.paid {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-status.refunded {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-table-refund {
  background: rgba(239, 68, 68, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 5px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-table-refund:hover {
  background: var(--accent-red);
  color: #fff;
}

.code-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--accent-cyan);
  border: 1px solid rgba(6, 182, 212, 0.2);
}

/* ==========================================================================
   Product Manager Grid & Slideshow
   ========================================================================== */
.products-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.admin-product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s, border-color 0.2s;
}

.admin-product-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.slideshow-container {
  position: relative;
  width: 100%;
  height: 180px;
  background: #040711;
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.slideshow-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.slideshow-counter {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.slideshow-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.slideshow-nav-btn:hover {
  background: var(--accent-gold);
  color: #000;
}

.slideshow-prev { left: 8px; }
.slideshow-next { right: 8px; }

.slideshow-dots {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.slideshow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
}

.slideshow-dot.active {
  background: var(--accent-gold);
  width: 16px;
  border-radius: 4px;
}

.admin-product-content {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.admin-product-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.admin-product-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
}

.category-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

.admin-product-price {
  font-size: 16px;
  font-weight: 800;
  color: var(--accent-gold);
  white-space: nowrap;
}

.admin-product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border-color);
}

.btn-edit-prod {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.3);
  color: var(--accent-cyan);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-edit-prod:hover {
  background: var(--accent-cyan);
  color: #000;
}

.btn-del-prod {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-del-prod:hover {
  background: var(--accent-red);
  color: #fff;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
}

.modal-dialog {
  position: relative;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  max-width: 540px;
  width: 92%;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2;
}

.modal-dialog-sm {
  max-width: 440px;
  text-align: center;
}

@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

.confirm-icon-box {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px auto;
}

.confirm-dialog-content h3 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.confirm-dialog-content p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Responsive */
@media (max-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
  }
  .metrics-grid {
    grid-template-columns: 1fr;
  }
  .main-content {
    padding: 20px;
  }
}
