﻿/* ===== Admin Dashboard Styles ===== */
:root {
  --admin-bg: #0c0e14;
  --admin-sidebar: #111420;
  --admin-card: #161927;
  --admin-stroke: rgba(255, 255, 255, 0.06);
  --admin-text: #e2e8f0;
  --admin-muted: #64748b;
  --admin-aqua: #2dd4bf;
  --admin-aqua-dim: rgba(45, 212, 191, 0.08);
  --admin-aqua-deep: #0d9488;
  --admin-danger: #ef4444;
  --admin-warn: #fbbf24;
  --admin-blue: #3b82f6;
  --admin-purple: #a855f7;
  --admin-radius: 10px;
}

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

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--admin-bg);
  color: var(--admin-text);
  display: flex;
  min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
  width: 240px;
  background: var(--admin-sidebar);
  border-right: 1px solid var(--admin-stroke);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s;
}

.sidebar-brand {
  padding: 24px 20px;
  border-bottom: 1px solid var(--admin-stroke);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-brand .mark {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--admin-aqua);
}

.sidebar-brand .label {
  font-size: 0.72rem;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.nav-section {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--admin-muted);
  padding: 12px 12px 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--admin-muted);
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--admin-aqua-dim);
  color: var(--admin-text);
}

.nav-item.active {
  background: var(--admin-aqua-dim);
  color: var(--admin-aqua);
  font-weight: 600;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--admin-stroke);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--admin-muted);
}

.sidebar-footer img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--admin-stroke);
}

.sidebar-footer .user-initial {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--admin-aqua-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
}

.sidebar-footer .user-name {
  font-weight: 600;
  color: var(--admin-text);
}

/* ===== Main Content ===== */
.main {
  flex: 1;
  margin-left: 240px;
  min-height: 100vh;
}

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

.topbar h1 {
  font-size: 1.2rem;
  font-weight: 700;
}

.topbar .topbar-actions {
  display: flex;
  gap: 10px;
}

.btn-sm {
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: all 0.2s;
}

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

.btn-primary:hover {
  background: var(--admin-aqua);
}

.btn-ghost {
  background: none;
  border: 1px solid var(--admin-stroke);
  color: var(--admin-muted);
}

.btn-ghost:hover {
  border-color: var(--admin-aqua);
  color: var(--admin-aqua);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--admin-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.btn-back-site {
  text-decoration: none;
}

.content {
  padding: 28px 32px;
}

/* ===== Tab Panels ===== */
.tab-panel {
  display: none;
}

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

/* ===== Dashboard Cards ===== */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-stroke);
  border-radius: var(--admin-radius);
  padding: 20px;
}

.metric-card .mc-label {
  font-size: 0.75rem;
  color: var(--admin-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.metric-card .mc-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  font-weight: 700;
}

.metric-card .mc-icon {
  float: right;
  font-size: 1.4rem;
  opacity: 0.5;
}

/* ===== Tables ===== */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--admin-card);
  border-radius: var(--admin-radius);
  overflow: hidden;
  border: 1px solid var(--admin-stroke);
}

.admin-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--admin-muted);
  border-bottom: 1px solid var(--admin-stroke);
  background: var(--admin-sidebar);
}

.admin-table td {
  padding: 12px 16px;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--admin-stroke);
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

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

.status-badge {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.status-badge.pending {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.status-badge.confirmed {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.status-badge.shipped {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.status-badge.delivered {
  background: rgba(45, 212, 191, 0.1);
  color: #2dd4bf;
}

.status-select {
  padding: 4px 8px;
  background: var(--admin-bg);
  color: var(--admin-text);
  border: 1px solid var(--admin-stroke);
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: inherit;
  cursor: pointer;
}

/* ===== CRUD Cards ===== */
.crud-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.crud-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-stroke);
  border-radius: var(--admin-radius);
  padding: 20px;
}

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

.crud-card .crud-header h4 {
  font-size: 0.9rem;
  font-weight: 700;
}

.crud-field {
  margin-bottom: 12px;
}

.crud-field label {
  display: block;
  font-size: 0.72rem;
  color: var(--admin-muted);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crud-field input,
.crud-field textarea,
.crud-field select {
  width: 100%;
  padding: 8px 12px;
  background: var(--admin-bg);
  color: var(--admin-text);
  border: 1px solid var(--admin-stroke);
  border-radius: 6px;
  font-size: 0.82rem;
  font-family: inherit;
}

.crud-field input:focus,
.crud-field textarea:focus {
  outline: none;
  border-color: var(--admin-aqua);
  box-shadow: 0 0 0 2px var(--admin-aqua-dim);
}

.crud-field textarea {
  resize: vertical;
  min-height: 60px;
}

.crud-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* ===== Settings ===== */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.settings-card {
  background: var(--admin-card);
  border: 1px solid var(--admin-stroke);
  border-radius: var(--admin-radius);
  padding: 24px;
}

.settings-card h3 {
  font-size: 0.95rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--admin-stroke);
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-overlay.show {
  display: flex;
}

.modal {
  background: var(--admin-card);
  border: 1px solid var(--admin-stroke);
  border-radius: var(--admin-radius);
  padding: 28px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal h3 {
  font-size: 1.1rem;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-stroke);
}

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

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px;
  color: var(--admin-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  opacity: 0.3;
  margin-bottom: 12px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--admin-aqua-deep);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 300;
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ===== Loading ===== */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--admin-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  font-size: 0.9rem;
  color: var(--admin-muted);
}

.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--admin-stroke);
  border-top-color: var(--admin-aqua);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
  vertical-align: middle;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Hamburger for mobile ===== */
.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--admin-text);
  font-size: 1.4rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .hamburger {
    display: block;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .content {
    padding: 20px 16px;
  }

  .topbar {
    padding: 12px 16px;
  }
}