/* ═══════════════════════════════════════════════════════════════
   admin.css  –  Styles for the Arcade-Themed Admin Dashboard (IMS)
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

.admin-body {
  background-color: #060913;
  background-image: 
    linear-gradient(rgba(0, 240, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--color-bg-cream);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ── SIDEBAR (PLAYER MENU) ───────────────────────────────────── */

.admin-sidebar {
  width: 260px;
  background-color: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 4px solid hsl(140, 100%, 50%);
  box-shadow: 6px 0 20px rgba(0, 255, 0, 0.15);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-8) var(--space-6);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.sidebar-logo {
  height: 50px;
  width: auto;
  align-self: flex-start;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  box-shadow: 3px 3px 0 var(--color-ink);
}

.sidebar-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: hsl(330, 100%, 58%);
  text-shadow: 0 0 8px rgba(255,0,128,0.4);
  text-transform: uppercase;
  margin-top: var(--space-4);
  letter-spacing: -0.05em;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-12);
  flex: 1;
}

.sidebar-link {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: hsl(0, 0%, 75%);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: all var(--duration-fast) ease;
}

.sidebar-link:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255,255,255,0.1);
}

.sidebar-link.active {
  color: hsl(140, 100%, 50%) !important;
  background-color: rgba(16, 185, 129, 0.1);
  border: 2px solid hsl(140, 100%, 50%);
  text-shadow: 0 0 10px rgba(0, 255, 0, 0.5);
  box-shadow: inset 0 0 8px rgba(0, 255, 0, 0.1);
}

.sidebar-footer {
  margin-top: auto;
}

.logout-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: #ef4444 !important;
  cursor: pointer;
}

.logout-btn:hover {
  background-color: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

/* ── MAIN WORKSPACE ────────────────────────────────────────── */

.admin-workspace {
  flex: 1;
  padding: var(--space-10) var(--space-12);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-4);
  border-bottom: 2px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: var(--space-4);
}

.workspace-title {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(20px, 3.5vw, 28px);
  color: hsl(330, 100%, 58%);
  text-shadow: 0 0 12px rgba(255, 0, 128, 0.5);
  text-transform: uppercase;
}

.add-product-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  background-color: #f59e0b;
  color: var(--color-ink);
  border: var(--border-lg);
  border-radius: var(--radius-sm);
  padding: var(--space-4) var(--space-6);
  box-shadow: 6px 6px 0 var(--color-ink);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.add-product-btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 4px 4px 0 var(--color-ink);
}

.add-product-btn:active {
  transform: translate(6px, 6px);
  box-shadow: 0px 0px 0 var(--color-ink);
}

/* Stats quick-panel */
.admin-stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
}

.stat-card {
  background-color: #111422;
  border: var(--border-md);
  border-radius: var(--radius-md);
  padding: var(--space-6);
  box-shadow: 4px 4px 0 var(--color-ink);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.stat-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: hsl(0, 0%, 55%);
  text-transform: uppercase;
}

.stat-val {
  font-family: 'VT323', monospace;
  font-size: 36px;
  color: hsl(180, 100%, 50%);
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
  line-height: 1;
}

/* ── DATA TABLE ──────────────────────────────────────────────── */

.table-panel {
  background-color: #0b0e1a;
  border: var(--border-lg);
  border-radius: var(--radius-lg);
  box-shadow: 8px 8px 0 var(--color-ink);
  overflow: hidden;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

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

.admin-table th {
  background-color: #111528;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  color: hsl(200, 100%, 65%);
  text-shadow: 0 0 5px rgba(96,165,250,0.3);
  padding: var(--space-4);
  border-bottom: var(--border-lg);
  border-right: 2px solid rgba(0, 240, 255, 0.08);
}

.admin-table td {
  padding: var(--space-4);
  border-bottom: 2px solid rgba(0, 240, 255, 0.05);
  border-right: 2px solid rgba(0, 240, 255, 0.08);
  font-size: var(--text-sm);
  vertical-align: middle;
}

.admin-table tr {
  transition: background-color var(--duration-fast) ease;
}

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

/* Table elements */
.table-img-wrap {
  width: 44px;
  height: 44px;
  background-color: #161a30;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 var(--color-ink);
}

.table-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.table-name {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
}

.table-price {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: hsl(140, 100%, 50%);
  text-shadow: 0 0 5px rgba(0, 255, 0, 0.3);
}

/* Actions buttons */
.action-btn {
  background-color: var(--color-surface);
  color: var(--color-ink);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-sm);
  box-shadow: 2px 2px 0 var(--color-ink);
  cursor: pointer;
  transition: all var(--duration-fast) ease;
}

.action-btn:hover {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 var(--color-ink);
}

.action-btn.edit {
  background-color: hsl(180, 100%, 50%);
}

.action-btn.delete {
  background-color: #ef4444;
  color: #fff;
}

/* ── CUSTOM ARCADE ROCKER SWITCH ────────────────────────────── */

.rocker-switch-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.rocker-switch {
  position: relative;
  width: 80px;
  height: 30px;
  background-color: #121420;
  border: 3px solid var(--color-ink);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.rocker-switch input {
  display: none;
}

.rocker-slider {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-2);
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: hsl(0, 0%, 45%);
}

.rocker-slider::before {
  content: 'ON';
  color: transparent;
}
.rocker-slider::after {
  content: 'OFF';
  color: transparent;
}

/* Glowing toggle rocker node */
.rocker-slider-node {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: 36px;
  background-color: #ef4444;
  border: 2px solid var(--color-ink);
  border-radius: var(--radius-xs);
  transition: transform var(--duration-base) cubic-bezier(0.25, 1, 0.5, 1), background-color var(--duration-base) ease;
  box-shadow: 
    0 2px 4px rgba(0,0,0,0.4),
    0 0 8px rgba(239,68,68,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace;
  font-size: 6px;
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}

.rocker-switch input:checked + .rocker-slider .rocker-slider-node {
  transform: translateX(36px);
  background-color: #10b981;
  box-shadow: 
    0 2px 4px rgba(0,0,0,0.4),
    0 0 10px rgba(16,185,129,0.6);
}

/* ── MODAL HIGH-SCORE ENTRY STYLE ─────────────────────────────── */

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background-color: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-base) ease;
  padding: var(--space-4);
}

.admin-modal.active {
  opacity: 1;
  pointer-events: all;
}

.admin-modal-content {
  background-color: #0b0e1a;
  border: 12px solid #2d3139;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: 
    0 0 30px rgba(0, 240, 255, 0.2),
    8px 8px 0 var(--color-ink);
  overflow: hidden;
  position: relative;
  transform: scale(0.92);
  transition: transform var(--duration-base) var(--ease-bounce);
}

.admin-modal.active .admin-modal-content {
  transform: scale(1);
}

/* Modal Bezel screen header */
.modal-bezel-header {
  background-color: #161a30;
  border-bottom: 4px solid var(--color-ink);
  padding: var(--space-4);
  text-align: center;
}

.modal-bezel-title {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  color: hsl(330, 100%, 58%);
  text-shadow: 0 0 8px rgba(255, 0, 128, 0.4);
  text-transform: uppercase;
}

.modal-form {
  padding: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  background-color: #090b11;
  position: relative;
}

/* Subtle CRT overlay inside modal */
.modal-form::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(18,16,16,0) 50%, rgba(0,0,0,0.15) 50%);
  background-size: 100% 4px;
  z-index: 5;
}

.modal-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}

.modal-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  position: relative;
  z-index: 6;
}

.modal-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  color: hsl(140, 100%, 50%);
  text-transform: uppercase;
  text-shadow: 0 0 5px rgba(0,255,0,0.3);
}

.modal-input {
  background-color: #111528;
  border: 3px solid var(--color-ink);
  border-radius: var(--radius-sm);
  padding: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: #fff;
  outline: none;
  transition: all var(--duration-fast) ease;
}

.modal-input:focus {
  border-color: hsl(180, 100%, 50%);
  box-shadow: 0 0 8px rgba(0, 240, 255, 0.5);
  background-color: #151a32;
}

.modal-textarea {
  resize: none;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-top: var(--space-3);
  position: relative;
  z-index: 6;
}

.modal-btn {
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  padding: var(--space-4) 0;
  border: var(--border-lg);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform var(--duration-fast) ease;
}

.modal-btn:hover {
  transform: translate(2px, 2px);
}

.modal-btn.save {
  background-color: hsl(330, 100%, 58%);
  color: #fff;
  box-shadow: 4px 4px 0 var(--color-ink);
}
.modal-btn.save:hover {
  box-shadow: 2px 2px 0 var(--color-ink);
}

.modal-btn.cancel {
  background-color: #374151;
  color: #fff;
  box-shadow: 4px 4px 0 var(--color-ink);
}
.modal-btn.cancel:hover {
  box-shadow: 2px 2px 0 var(--color-ink);
}

/* ── RESPONSIVE DESIGN FOR ADMIN ────────────────────────────── */
@media (max-width: 768px) {
  .admin-body {
    flex-direction: column !important;
  }
  .admin-sidebar {
    width: 100% !important;
    border-right: none !important;
    border-bottom: 4px solid hsl(140, 100%, 50%) !important;
    box-shadow: 0 6px 20px rgba(0, 255, 0, 0.15) !important;
    padding: var(--space-4) !important;
    gap: var(--space-4) !important;
  }
  .sidebar-menu {
    flex-direction: row !important;
    flex-wrap: wrap !important;
    margin-top: var(--space-4) !important;
    gap: var(--space-2) !important;
  }
  .sidebar-link {
    padding: var(--space-2) var(--space-3) !important;
    font-size: 8px !important;
  }
  .sidebar-footer {
    margin-top: var(--space-2) !important;
    align-self: flex-start;
  }
  .admin-workspace {
    padding: var(--space-6) var(--space-4) !important;
  }
  .modal-row {
    grid-template-columns: 1fr !important;
  }
  .modal-actions {
    grid-template-columns: 1fr !important;
    gap: var(--space-2) !important;
  }
  .modal-input {
    font-size: 16px !important; /* Prevents auto-zoom on iOS admin */
  }
}

@media (max-width: 480px) {
  .workspace-header {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .add-product-btn {
    text-align: center;
    width: 100%;
  }
  .admin-stats-row {
    grid-template-columns: 1fr !important;
  }
}
