/* ============================================================
   eCarPass — Admin Panel Styles
   ============================================================ */

/* -----------------------------------------------------------
   Admin Layout
   ----------------------------------------------------------- */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  background: var(--surface-2);
  overflow-x: hidden;
}

/* Sidebar */
.admin-sidebar {
  width: 256px;
  background: var(--navy-800);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  transition: transform var(--transition);
}

.admin-sidebar-logo {
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

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

.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: rgba(255, 255, 255, .7);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.sidebar-close:hover,
.sidebar-close:focus-visible {
  color: var(--gold);
  border-color: var(--gold);
}

.admin-sidebar-logo .logo-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.06em;
}

.admin-sidebar-logo .logo-sub {
  font-size: 0.65rem;
  color: rgba(255,255,255,.4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.admin-nav {
  flex: 1;
  padding: 16px 12px;
}

.admin-nav-section {
  margin-bottom: 24px;
}

.admin-nav-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 0 8px;
  margin-bottom: 6px;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.7);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
  margin-bottom: 2px;
}

.admin-nav a:hover {
  color: #fff;
  background: rgba(255,255,255,.08);
}

.admin-nav a.active {
  color: var(--gold);
  background: rgba(201,168,76,.1);
}

.admin-nav a svg, .admin-nav a .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.admin-sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.admin-sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,.5);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all var(--transition);
}

.admin-sidebar-footer a:hover {
  color: #fca5a5;
  background: rgba(239,68,68,.1);
}

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

.admin-topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.admin-topbar-left h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0;
}

.admin-topbar-left p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 1px;
}

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

.admin-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  border-radius: 100px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

/* Mobile toggle */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
}

/* -----------------------------------------------------------
   Stats Cards
   ----------------------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: #111;
  border-radius: var(--radius-md);
  padding: 22px 22px 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  display: none;
}

.stat-card::after {
  content: '';
  position: absolute;
  width: 110px;
  height: 110px;
  right: -48px;
  bottom: -58px;
  border: 1px solid color-mix(in srgb, var(--stat-accent) 45%, transparent);
  border-radius: 50%;
  pointer-events: none;
}

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

.stat-card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--stat-accent);
  background: color-mix(in srgb, var(--stat-accent) 13%, #111);
  border: 1px solid color-mix(in srgb, var(--stat-accent) 35%, transparent);
  border-radius: 10px;
}

.stat-card-icon svg { width: 17px; height: 17px; }

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.stat-card.stat-pending  { --stat-accent: #f59e0b; }
.stat-card.stat-approved { --stat-accent: #10b981; }
.stat-card.stat-rejected { --stat-accent: #ef4444; }
.stat-card.stat-passes   { --stat-accent: #60a5fa; }

/* -----------------------------------------------------------
   Admin Tables
   ----------------------------------------------------------- */
.table-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  min-width: 0;
}

.table-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.table-header h2 {
  font-size: 1rem;
  font-weight: 700;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.search-input {
  display: flex;
  align-items: center;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color var(--transition);
}

.search-input:focus-within { border-color: var(--border-focus); }

.search-input input {
  background: none;
  border: none;
  outline: none;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary);
  width: 200px;
}

.search-input input::placeholder { color: var(--text-muted); }

.filter-select {
  padding: 8px 32px 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b6b8a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  appearance: none;
  transition: border-color var(--transition);
}

.filter-select:focus { border-color: var(--border-focus); }

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

.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  font-size: 0.875rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background var(--transition);
}

.data-table tbody tr:hover { background: var(--surface-2); }

.data-table .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.table-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* -----------------------------------------------------------
   Pagination
   ----------------------------------------------------------- */
.pagination {
  display: flex;
  gap: 4px;
}

.pagination a,
.pagination span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  text-decoration: none;
  transition: all var(--transition);
}

.pagination a:hover {
  background: var(--navy-800);
  color: var(--gold);
  border-color: var(--navy-800);
}

.pagination span.current {
  background: var(--navy-800);
  color: var(--gold);
  border-color: var(--navy-800);
}

/* -----------------------------------------------------------
   Admin Login
   ----------------------------------------------------------- */
.admin-login-page {
  min-height: 100vh;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.admin-login-page::before {
  content: '';
  position: absolute;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.04);
  top: -200px;
  right: -200px;
  pointer-events: none;
}

.admin-login-page::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.03);
  bottom: -100px;
  left: -100px;
  pointer-events: none;
}

.login-card {
  background: #111;
  border-radius: var(--radius-xl);
  padding: 44px;
  width: 100%;
  max-width: 420px;
  border: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  position: relative;
  z-index: 1;
  animation: slideUp 0.4s ease;
}

.login-card::before {
  content: '';
  display: block;
  height: 3px;
  width: 56px;
  margin: -44px auto 36px;
  background: var(--gold);
  border-radius: 0 0 3px 3px;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-name {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.05em;
}

.login-logo .logo-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 4px;
}

.login-logo .logo-divider {
  width: 32px;
  height: 3px;
  background: var(--gold);
  border-radius: 2px;
  margin: 12px auto 0;
}

.login-title { font-size: 1.5rem; margin-bottom: 6px; color: #fff; }
.login-sub   { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 28px; }

.login-card .form-label {
  color: #fff;
}

.login-card .form-control {
  background: #1b1b1b;
  border-color: rgba(255, 255, 255, .2);
  color: #fff;
}

.login-card .form-control:hover {
  border-color: rgba(255, 255, 255, .4);
}

.login-card .form-control:focus {
  background: #222;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 168, 76, .16);
}

.login-card .btn-primary {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

.login-card .btn-primary:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  color: #000;
}

.reject-dialog {
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

/* -----------------------------------------------------------
   QR Pass Print Card
   ----------------------------------------------------------- */
.pass-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 2px solid var(--navy-800);
  overflow: hidden;
  width: 340px;
  box-shadow: var(--shadow-md);
}

.pass-card-header {
  background: var(--navy-800);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pass-card-header .header-logo-text .logo-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.pass-card-header .header-logo-text .logo-sub {
  font-size: 0.6rem;
  color: rgba(255,255,255,.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pass-card-body {
  display: flex;
  padding: 20px;
  gap: 16px;
  align-items: center;
}

.pass-card-qr img {
  width: 110px;
  height: 110px;
  image-rendering: pixelated;
  border-radius: var(--radius-sm);
  border: 2px solid var(--surface-2);
}

.pass-card-info { flex: 1; min-width: 0; }

.pass-card-info .pass-name {
  font-size: 0.9375rem;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pass-card-info .pass-vehicle {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.pass-card-footer {
  background: var(--surface-2);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

.pass-card-footer .serial {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

/* -----------------------------------------------------------
   Animations
   ----------------------------------------------------------- */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@media (max-width: 768px) {
  .admin-sidebar {
    width: min(256px, 88vw);
    transform: translateX(-100%);
  }

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

  .sidebar-close { display: inline-flex; }

  .admin-main { margin-left: 0; }
  .admin-content { padding: 16px; }
  .admin-topbar {
    min-height: 72px;
    height: auto;
    padding: 12px 16px;
    gap: 12px;
  }
  .admin-topbar-left { min-width: 0; }
  .admin-topbar-left > div { min-width: 0; }
  .admin-topbar-left h1,
  .admin-topbar-left p { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin-topbar-right { flex-shrink: 0; }
  .admin-user-chip { display: none; }
  .sidebar-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .table-header { align-items: stretch; }
  .table-toolbar { width: 100%; }
  .table-toolbar form { flex: 1; min-width: 0; }
  .search-input { flex: 1; min-width: 0; }
  .search-input input { width: 100%; min-width: 0; }
  .data-table { display: table; min-width: 900px; }
  .table-footer { flex-wrap: wrap; gap: 12px; }
  .login-card { padding: 36px 24px; }

  .sidebar-toggle,
  .admin-topbar-right .btn {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .admin-content { padding: 12px; }
  .admin-topbar { padding: 10px 12px; }
  .admin-topbar-right .btn { padding: 8px 10px; font-size: 0.75rem; }
  .admin-topbar-left h1 { font-size: 1rem; }
  .admin-topbar-left p { font-size: 0.7rem; }
  .stats-grid { grid-template-columns: 1fr; }
  .table-header { padding: 16px; }
  .table-toolbar,
  .table-toolbar form { flex-direction: column; align-items: stretch; }
  .table-toolbar .btn,
  .filter-select,
  .search-input { width: 100%; }
  .table-footer { padding: 14px 16px; }
  .pagination { width: 100%; justify-content: center; }
  .login-card { padding: 32px 20px; }
}

@media (max-width: 360px) {
  .admin-content { padding: 8px; }
  .admin-topbar { gap: 6px; padding: 8px; }
  .admin-topbar-right .btn {
    width: 44px;
    overflow: hidden;
    padding: 8px;
    font-size: 0;
  }
  .admin-topbar-right .btn svg { margin: 0; }
  .table-header,
  .table-footer { padding-left: 12px; padding-right: 12px; }
  .login-card { padding: 28px 16px; }
}

@media (max-width: 480px) {
  .reject-dialog {
    padding: 24px 20px !important;
    width: calc(100% - 24px) !important;
    max-height: calc(100vh - 24px);
  }
}

/* Print styles */
@media print {
  .no-print { display: none !important; }
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .admin-topbar { display: none; }

  .pass-card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 2px solid #000;
  }

  .passes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}
