/* =============================================================================
   NOVA RECARGAS · OWNER DASHBOARD STYLESHEET v2.0
   Modern Sidebar Layout + Cosmic Glass UI + Mobile Drawer
   ============================================================================= */

/* Reset & Root Variables */
:root {
  --sidebar-w: 260px;
  --topbar-h: 68px;
  --admin-bg: #090412;
  --sidebar-bg: rgba(14, 7, 30, 0.94);
  --sidebar-border: rgba(139, 92, 246, 0.18);
  --card-glass: rgba(22, 12, 45, 0.7);
  --card-border: rgba(139, 92, 246, 0.22);
  --card-border-hover: rgba(192, 132, 252, 0.5);
  --table-head-bg: rgba(255, 255, 255, 0.035);
  --table-row-hover: rgba(139, 92, 246, 0.08);
}

/* Base Body Override for Admin */
body.admin-body {
  background: var(--admin-bg);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: 'Outfit', sans-serif;
  color: #fff;
}

/* ---------------------------------------------------------------------------
   App Shell Layout (Sidebar + Main Content)
   --------------------------------------------------------------------------- */
.admin-app {
  display: flex;
  min-height: 100vh;
  width: 100%;
  position: relative;
}

/* Sidebar Backdrop (Mobile/Tablet) */
.admin-sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.admin-sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---------------------------------------------------------------------------
   Admin Sidebar
   --------------------------------------------------------------------------- */
.admin-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 999;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-sidebar::-webkit-scrollbar {
  width: 5px;
}
.admin-sidebar::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.25);
  border-radius: 4px;
}

/* Sidebar Brand Header */
.sidebar-header {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-brand-box {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.sidebar-logo-img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.5));
}

.sidebar-brand-text h2 {
  font-family: 'Lilita One', cursive;
  font-size: 16px;
  color: #fff;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1.1;
}

.sidebar-brand-text span {
  font-size: 10px;
  font-weight: 800;
  color: var(--accent-diamond);
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.sidebar-close-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color 0.2s;
}

.sidebar-close-btn:hover {
  color: #fff;
}

/* Sidebar User Profile Card */
.sidebar-user-chip {
  margin: 14px 14px 10px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #c084fc);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  flex-shrink: 0;
}

.sidebar-user-meta {
  flex: 1;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-role-badge {
  font-size: 10px;
  font-weight: 800;
  color: #c084fc;
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pulse-dot-online {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 8px #34d399;
  flex-shrink: 0;
}

/* Sidebar RocketPass Live Balance Pill */
.sidebar-balance-box {
  margin: 0 14px 14px;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.04) 100%);
  border: 1px solid rgba(16, 185, 129, 0.28);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sidebar-balance-box:hover {
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.15);
}

.balance-box-left {
  display: flex;
  flex-direction: column;
}

.balance-box-label {
  font-size: 9px;
  font-weight: 800;
  color: #34d399;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.balance-box-amount {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  font-family: monospace;
}

/* Sidebar Navigation Links */
.sidebar-nav {
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.sidebar-nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.sidebar-nav-item svg {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: color 0.2s ease, transform 0.2s ease;
}

.sidebar-nav-item:hover {
  background: rgba(139, 92, 246, 0.1);
  color: #fff;
  border-color: rgba(139, 92, 246, 0.2);
}

.sidebar-nav-item:hover svg {
  color: var(--accent-diamond);
  transform: translateX(2px);
}

.sidebar-nav-item.active {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.3) 0%, rgba(139, 92, 246, 0.08) 100%);
  color: #fff;
  border-color: rgba(168, 85, 247, 0.45);
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.25);
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background: #c084fc;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px #c084fc;
}

.sidebar-nav-item.active svg {
  color: #c084fc;
}

.sidebar-nav-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: #f59e0b;
  color: #000;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-link-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-link-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #fff;
  border-color: var(--border-glow);
}

.sidebar-link-logout {
  color: #f87171;
}

.sidebar-link-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.35);
}

/* ---------------------------------------------------------------------------
   Main Admin Content Area
   --------------------------------------------------------------------------- */
.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
  position: relative;
}

/* Topbar */
.admin-topbar {
  height: var(--topbar-h);
  background: rgba(11, 5, 24, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-hamburger {
  display: none;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid var(--sidebar-border);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.admin-hamburger:hover {
  background: rgba(139, 92, 246, 0.3);
  border-color: var(--border-glow);
}

.topbar-title-wrap h1 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  color: #fff;
  line-height: 1.1;
}

.topbar-title-wrap p {
  font-size: 11px;
  color: var(--text-dim);
  margin: 2px 0 0;
  font-weight: 600;
}

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

.topbar-pill-balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
}

.topbar-pill-balance:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.6);
}

.topbar-pill-balance strong {
  color: #34d399;
  font-family: monospace;
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.topbar-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  color: #fff;
  border-color: var(--border-glow);
}

/* Content Body */
.admin-content-body {
  padding: 24px 28px 60px;
  flex: 1;
}

/* ---------------------------------------------------------------------------
   Metrics & KPI Cards (Cosmic Glass)
   --------------------------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--card-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  border-color: var(--card-border-hover);
  box-shadow: var(--shadow-card-hover);
}

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

.metric-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.3px;
}

.metric-icon-box {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-diamond);
}

.metric-value {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.metric-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------------------------------------------------------------------------
   Tables & Data Presentation
   --------------------------------------------------------------------------- */
.table-container {
  background: var(--card-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-card);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}

.admin-table th {
  padding: 14px 16px;
  background: var(--table-head-bg);
  color: var(--text-muted);
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 11px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--card-border);
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: #fff;
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: var(--table-row-hover);
}

/* Product thumbnail in table */
.table-prod-thumb {
  width: 40px;
  height: 40px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius-sm);
  padding: 3px;
  display: block;
}

/* Status Chips */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.3px;
}

.status-completed {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-dispatching {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Action Buttons */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-sm:hover {
  transform: translateY(-1px);
}

.btn-success { background: #10b981; color: #fff; }
.btn-success:hover { background: #059669; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: #7c3aed; }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-warning { background: #f59e0b; color: #000; }
.btn-warning:hover { background: #d97706; }

.btn-secondary { background: rgba(255, 255, 255, 0.08); color: #fff; border: 1px solid var(--border-subtle); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.15); border-color: var(--border-glow); }

/* ---------------------------------------------------------------------------
   Responsive Breakpoints (Mobile Drawer & Tablet Adjustments)
   --------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 275px;
    transform: translateX(-100%);
    box-shadow: none;
  }

  .admin-sidebar.open {
    transform: translateX(0);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8);
  }

  .sidebar-close-btn {
    display: block;
  }

  .admin-hamburger {
    display: flex;
  }

  .admin-topbar {
    padding: 0 16px;
  }

  .admin-content-body {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .topbar-pill-balance {
    display: none;
  }

  .topbar-title-wrap h1 {
    font-size: 16px;
  }

  .topbar-title-wrap p {
    display: none;
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }
}
