/* =========================================
   Prime Performance — Admin Panel
   ========================================= */
:root {
  --red: #c8102e;
  --red-dark: #a00d24;
  --black: #0d0d0d;
  --dark: #111;
  --dark-2: #1a1a1a;
  --dark-3: #222;
  --gray: #333;
  --gray-mid: #555;
  --gray-light: #888;
  --white: #f0f0f0;
  --green: #16a34a;
  --yellow: #b45309;
  --font: 'Inter', Arial, sans-serif;
  --sidebar-width: 220px;
  --radius: 6px;
  --transition: 0.15s ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--black); color: var(--white); display: flex; min-height: 100vh; }

/* --- SIDEBAR --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  border-right: 1px solid var(--gray);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 50;
}

.sidebar-logo {
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--gray);
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--white);
}
.sidebar-logo span { color: var(--red); }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  color: var(--gray-light);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: all var(--transition);
}

.sidebar-nav a:hover { color: var(--white); background: var(--dark-2); }
.sidebar-nav a.active { color: var(--white); border-left-color: var(--red); background: var(--dark-2); }
.sidebar-nav .nav-icon { width: 18px; text-align: center; }

.sidebar-section {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gray-mid);
  padding: 0.75rem 1rem 0.25rem;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--gray);
  font-size: 0.75rem;
  color: var(--gray-mid);
}

/* --- MAIN CONTENT --- */
.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--dark);
  border-bottom: 1px solid var(--gray);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.page-title { font-size: 1rem; font-weight: 700; }
.topbar-actions { display: flex; gap: 0.75rem; align-items: center; }

.content { padding: 1.5rem; flex: 1; }

/* --- CARDS / STATS --- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--dark-2);
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.stat-card .label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-light);
  margin-bottom: 0.5rem;
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}

.stat-card.red .value { color: var(--red); }
.stat-card.green .value { color: var(--green); }

.card {
  background: var(--dark-2);
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  overflow: hidden;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 { font-size: 0.875rem; font-weight: 700; }
.card-body { padding: 1.25rem; }

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--red); color: white; }
.btn-primary:hover { background: var(--red-dark); }
.btn-secondary { background: var(--dark-3); color: var(--white); border: 1px solid var(--gray); }
.btn-secondary:hover { border-color: var(--white); }
.btn-success { background: var(--green); color: white; }
.btn-danger { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: #991b1b; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }
.btn-lg { padding: 0.85rem 1.75rem; font-size: 0.95rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* --- TABLE --- */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

thead th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-light);
  border-bottom: 1px solid var(--gray);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--gray);
  transition: background var(--transition);
}

tbody tr:hover { background: var(--dark-3); }
tbody td { padding: 0.65rem 0.75rem; vertical-align: middle; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.badge-green { background: #14532d; color: #86efac; }
.badge-red { background: #7f1d1d; color: #fca5a5; }
.badge-yellow { background: #451a03; color: #fcd34d; }
.badge-gray { background: var(--gray); color: var(--gray-light); }

/* --- FORMS --- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-light);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
select,
textarea {
  background: var(--dark-3);
  border: 1px solid var(--gray);
  color: var(--white);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-family: var(--font);
  width: 100%;
  transition: border-color var(--transition);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
}

textarea { resize: vertical; min-height: 80px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--red);
}

/* --- SCAN SCREEN --- */
.scan-screen {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
}

.scan-input-wrap {
  background: var(--dark-2);
  border: 2px solid var(--gray);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition);
}

.scan-input-wrap:focus-within { border-color: var(--red); }

.scan-input-wrap input {
  background: transparent;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  width: 100%;
  letter-spacing: 4px;
}

.scan-input-wrap input:focus { outline: none; }

.scan-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--gray-light);
  margin-bottom: 0.75rem;
}

.scan-result {
  background: var(--dark-2);
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1rem;
}

.scan-result-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--gray);
}

.scan-result-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

/* --- PHOTO UPLOAD --- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 4/3;
  background: var(--dark-3);
  border-radius: 4px;
  overflow: hidden;
  border: 2px solid transparent;
}

.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-thumb.primary { border-color: var(--red); }

.photo-thumb-del {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.8);
  border: none;
  color: white;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
}

.drop-zone {
  border: 2px dashed var(--gray);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition);
  font-size: 0.875rem;
  color: var(--gray-light);
}

.drop-zone:hover, .drop-zone.dragover { border-color: var(--red); color: var(--white); }

/* --- SEARCH BAR --- */
.search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.search-bar input, .search-bar select {
  flex: 1;
  min-width: 180px;
}

/* --- ALERTS --- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
}
.alert-success { background: #14532d22; border-color: var(--green); color: #86efac; }
.alert-error { background: #7f1d1d22; border-color: var(--red); color: #fca5a5; }
.alert-warning { background: #45180322; border-color: var(--yellow); color: #fcd34d; }

/* --- SKELETON --- */
.skeleton {
  background: linear-gradient(90deg, var(--dark-2) 25%, var(--dark-3) 50%, var(--dark-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* --- TOAST --- */
#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--dark-2);
  border: 1px solid var(--gray);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  font-size: 0.875rem;
  z-index: 999;
  display: none;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* --- MOBILE --- */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
