:root {
  --admin-bg: #0B1120;
  --admin-sidebar: #070D19;
  --admin-card: #0F172A;
  --admin-border: rgba(255, 255, 255, 0.08);
  --cyan: #00F0FF;
  --blue: #0077FE;
  --green: #10B981;
  --yellow: #F59E0B;
  --red: #EF4444;
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body.admin-body {
  background: var(--admin-bg);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar);
  border-right: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
}

.sidebar-brand {
  padding: 22px 18px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.sidebar-brand a {
  display: block;
  width: 100%;
}

.sidebar-brand img {
  height: 48px;
  width: auto;
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.sidebar-badge {
  display: inline-block;
  background: rgba(0, 240, 255, 0.15);
  color: var(--cyan);
  border: 1px solid var(--cyan);
  font-size: 0.70rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 4px;
  margin-top: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  list-style: none;
  padding: 20px 12px;
  flex: 1;
  overflow-y: auto;
}

.sidebar-item {
  margin-bottom: 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: all 0.2s;
}

.sidebar-link:hover, .sidebar-link.active {
  color: #fff;
  background: rgba(0, 119, 254, 0.2);
  border-left: 3px solid var(--cyan);
}

.sidebar-link i {
  font-size: 1.15rem;
  color: var(--cyan);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--admin-border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

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

.topbar-title h2 {
  font-size: 1.3rem;
  font-weight: 800;
  color: #fff;
}

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

.badge-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.badge-status.running {
  background: rgba(0, 240, 255, 0.15);
  color: var(--cyan);
  border: 1px solid var(--cyan);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

.admin-body-content {
  padding: 30px;
  flex: 1;
}

/* Stat Cards / KPIs */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.stat-card.highlight {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(0, 119, 254, 0.15) 0%, rgba(0, 240, 255, 0.08) 100%), var(--admin-card);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
}

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

.stat-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  font-size: 1.2rem;
}

.stat-card.highlight .stat-icon {
  background: var(--cyan);
  color: #070B19;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 900;
  color: #fff;
  margin-bottom: 4px;
}

.stat-card.highlight .stat-value {
  color: var(--cyan);
}

.stat-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Admin Sections / Panels */
.admin-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 30px;
}

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

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Forms & Sliders */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

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

.form-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: #E2E8F0;
  margin-bottom: 8px;
}

.form-group .form-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-control {
  width: 100%;
  background: #0B1120;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--cyan);
}

.input-group {
  display: flex;
  align-items: center;
}

.input-addon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--admin-border);
  border-right: none;
  padding: 10px 14px;
  border-radius: 8px 0 0 8px;
  color: var(--text-muted);
  font-weight: 700;
}

.input-group .form-control {
  border-radius: 0 8px 8px 0;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  color: #070B19;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #F87171;
  border: 1px solid #EF4444;
  border-radius: 8px;
  padding: 8px 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.admin-table th {
  background: #070D19;
  color: var(--text-muted);
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--admin-border);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

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

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

.product-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-thumb {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 6px;
  padding: 2px;
  object-fit: contain;
}

/* Status Badges */
.badge-pay {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-pay.approved {
  background: rgba(16, 185, 129, 0.2);
  color: #34D399;
}

.badge-pay.pending {
  background: rgba(245, 158, 11, 0.2);
  color: #FBBF24;
}

.badge-pay.rejected {
  background: rgba(239, 68, 68, 0.2);
  color: #F87171;
}

/* Terminal / Scraper Log Stream */
.terminal-window {
  background: #050810;
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 0.82rem;
  height: 280px;
  overflow-y: auto;
  padding: 14px;
  color: #10B981;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.terminal-line {
  line-height: 1.4;
  word-break: break-all;
}

.terminal-line.warning {
  color: #FBBF24;
}

.terminal-line.error {
  color: #F87171;
}

.terminal-line.info {
  color: #38BDF8;
}

/* Scraper Status Box */
.scraper-status-box {
  background: rgba(5, 8, 16, 0.75);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 0.84rem;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #E2E8F0;
}

.scraper-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scraper-status-label {
  font-weight: 700;
  color: var(--cyan);
  display: flex;
  align-items: center;
  gap: 6px;
}

.scraper-status-value {
  color: #FFFFFF;
  font-weight: 600;
}

/* Simulator Box */
.simulator-box {
  background: #0B132B;
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 18px;
  color: #FFFFFF;
}

.simulator-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.simulator-row.highlight-sale {
  font-size: 0.95rem;
  font-weight: 700;
  color: #FFFFFF;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 8px;
}

.simulator-row.highlight-sale span:last-child {
  color: var(--cyan);
}

.simulator-row.highlight-commission {
  font-size: 1.1rem;
  font-weight: 900;
  color: #FFFFFF;
  border-top: 1px solid rgba(0, 240, 255, 0.25);
  padding-top: 10px;
  margin-top: 10px;
}

.simulator-row.highlight-commission span:last-child {
  color: var(--cyan);
}
