/* ============================
   TTA Registry — Modern Dark Theme
   Mobile-First Responsive Design
   ============================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Updated to match history page colors */
  --bg-primary: #0d0d0f;
  --bg-secondary: #15151a;
  --bg-card: #1a1a22;
  --bg-card-hover: #22222d;

  /* Mapped for compatibility */
  --bg-surface: #111114;
  --bg-input: #1a1a22;

  --gold: #d4a017;
  --gold-light: #e8b84b;
  --gold-dark: #b8890f;
  --gold-glow: rgba(212, 160, 23, 0.25);

  --text-primary: #f0ece4;
  --text-secondary: #9a968e;
  --text-muted: #6b6860;

  --border: rgba(212, 160, 23, 0.12);
  --border-light: rgba(212, 160, 23, 0.25);

  --success: #4ade80;
  --danger: #e74c3c;
  --info: #3498db;
  --warning: #f39c12;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 4px 20px rgba(212, 160, 23, 0.15);

  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--gold);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--gold-light);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold-dark);
}

/* --- Header / Hero --- */
.site-header {
  background: linear-gradient(180deg, #111114 0%, var(--bg-primary) 100%);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.header-logo img {
  height: 50px;
  width: auto;
}

.header-logo .logo-text {
  display: flex;
  flex-direction: column;
}

.header-logo .site-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.header-logo .site-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(212, 160, 23, 0.08);
}

.nav-btn.primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #000;
  border-color: var(--gold);
}

.nav-btn.primary:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  box-shadow: var(--shadow-gold);
  color: #000;
}

/* Mobile hamburger */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 1.4rem;
  padding: 6px 10px;
  cursor: pointer;
}

/* --- Hero Section --- */
.hero {
  position: relative;
  background: linear-gradient(135deg, #111114 0%, #1a1510 50%, #111114 100%);
  padding: 40px 16px 30px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(212, 160, 23, 0.06) 0%, transparent 60%);
  pointer-events: none;
}

.hero h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 500px;
  margin: 0 auto;
}

.hero .car-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 8px 20px;
  background: rgba(212, 160, 23, 0.1);
  border: 1px solid rgba(212, 160, 23, 0.25);
  border-radius: 50px;
  font-size: 0.85rem;
  color: var(--gold);
  font-weight: 600;
}

.hero .car-count .count {
  font-size: 1.3rem;
  font-weight: 800;
}

/* --- Search & Filter Bar --- */
.search-bar {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-input-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

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

.filter-select {
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 160px;
  cursor: pointer;
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.filter-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* --- Car Cards Grid --- */
.cards-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 40px;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.car-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.car-card:hover {
  transform: translateY(-4px);
  border-color: var(--gold-dark);
  box-shadow: var(--shadow-gold);
  background: var(--bg-card-hover);
}

.car-card-thumb {
  width: 100%;
  height: 200px;
  background: var(--bg-surface);
  position: relative;
  overflow: hidden;
}

.car-card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.car-card:hover .car-card-thumb img {
  transform: scale(1.05);
}

.car-card-thumb .no-photo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--text-muted);
  font-size: 2.5rem;
}

.car-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #000;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 50px;
  letter-spacing: 0.02em;
}

.car-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.car-card-owner {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.car-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.car-card-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.car-card-meta svg {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.car-card-type {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.car-card-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.view-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.view-btn:hover {
  color: var(--gold-light);
  gap: 8px;
}

.photo-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* --- Modal Overlay --- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

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

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 2;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--gold);
}

.modal-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: var(--transition);
}

.modal-close:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.modal-body {
  padding: 24px;
}

/* Carousel in modal */
.modal-carousel {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
  background: var(--bg-surface);
}

.modal-carousel img {
  width: 100%;
  max-height: 450px;
  object-fit: contain;
  display: block;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.6);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: var(--transition);
  z-index: 3;
}

.carousel-btn:hover {
  background: var(--gold);
  color: #000;
}

.carousel-btn.prev {
  left: 12px;
}

.carousel-btn.next {
  right: 12px;
}

.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 10px;
}

.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-light);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.carousel-dot.active {
  background: var(--gold);
  width: 20px;
  border-radius: 4px;
}

.modal-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-item.full-width {
  grid-column: 1 / -1;
}

.detail-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  font-weight: 600;
}

.detail-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  font-weight: 500;
}

.detail-value.description {
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* --- Forms --- */
.page-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 16px 60px;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}

.form-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

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

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.form-control::placeholder {
  color: var(--text-muted);
}

.form-control.is-invalid {
  border-color: var(--danger);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a0a0b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.invalid-feedback {
  font-size: 0.78rem;
  color: var(--danger);
  margin-top: 4px;
  display: none;
}

.is-invalid~.invalid-feedback {
  display: block;
}

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

.form-hint a {
  color: var(--gold);
  font-weight: 600;
}

/* --- Drop Zone --- */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-surface);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--gold);
  background: rgba(212, 160, 23, 0.05);
}

.drop-zone svg {
  color: var(--text-muted);
  margin-bottom: 8px;
}

.drop-zone p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.drop-zone .browse-link {
  color: var(--gold);
  font-weight: 600;
  cursor: pointer;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 1;
  background: var(--bg-surface);
}

.preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(231, 76, 60, 0.9);
  color: #fff;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #000;
}

.btn-gold:hover {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:hover {
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  background: #27ae60;
}

.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* --- Alerts --- */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.alert-success {
  background: rgba(46, 204, 113, 0.1);
  border: 1px solid rgba(46, 204, 113, 0.3);
  color: var(--success);
}

.alert-error {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: var(--danger);
}

.alert-info {
  background: rgba(52, 152, 219, 0.1);
  border: 1px solid rgba(52, 152, 219, 0.3);
  color: var(--info);
}

/* --- VIN Lookup --- */
.lookup-container {
  max-width: 700px;
  margin: 0 auto;
  padding: 40px 16px 60px;
  text-align: center;
}

.lookup-input-group {
  display: flex;
  gap: 10px;
  margin: 24px 0;
}

.lookup-input-group .form-control {
  flex: 1;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 14px 18px;
}

.lookup-result {
  margin-top: 24px;
  text-align: left;
}

.lookup-result table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.8rem;
}

.lookup-result th {
  background: rgba(212, 160, 23, 0.05);
  color: var(--gold);
  font-weight: 700;
  padding: 10px 8px;
  text-align: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lookup-result td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 24px 16px;
  text-align: center;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-links a {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--gold);
}

.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Admin Styles --- */
.admin-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.85rem;
}

.admin-table th {
  background: rgba(212, 160, 23, 0.05);
  color: var(--gold);
  font-weight: 700;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(212, 160, 23, 0.05);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active {
  background: rgba(46, 204, 113, 0.15);
  color: var(--success);
}

.badge-pending {
  background: rgba(243, 156, 18, 0.15);
  color: var(--warning);
}

.badge-count {
  background: var(--gold);
  color: #000;
  min-width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 800;
}

/* --- Loading Spinner --- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 40px auto;
}

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

/* --- No Results --- */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.no-results svg {
  margin-bottom: 16px;
}

.no-results h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.no-results p {
  font-size: 0.85rem;
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: var(--gold);
  color: #000;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  opacity: 0;
  visibility: hidden;
  z-index: 50;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-gold);
}

/* ============================
   RESPONSIVE BREAKPOINTS
   ============================ */

/* Small phones (> 360px) */
@media (min-width: 360px) {
  .preview-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablets (> 600px) */
@media (min-width: 600px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-row {
    grid-template-columns: 1fr 1fr;
  }

  .modal-details {
    grid-template-columns: 1fr 1fr;
  }

  .hero h1 {
    font-size: 2.4rem;
  }

  .preview-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Small desktop (> 900px) */
@media (min-width: 900px) {
  .cards-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .header-inner {
    padding: 14px 24px;
  }

  .header-logo img {
    height: 60px;
  }

  .header-logo .site-title {
    font-size: 1.3rem;
  }

  .hero {
    padding: 50px 24px 40px;
  }

  .hero h1 {
    font-size: 2.8rem;
  }

  .search-bar {
    padding: 20px 24px;
    flex-wrap: nowrap;
  }

  .cards-container {
    padding: 0 24px 60px;
  }

  .page-container {
    padding: 40px 24px 80px;
  }
}

/* Large desktop (> 1200px) */
@media (min-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Mobile nav toggle */
@media (max-width: 599px) {
  .mobile-menu-toggle {
    display: block;
  }

  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px 16px;
    gap: 8px;
  }

  .header-nav.open {
    display: flex;
  }

  .nav-btn {
    width: 100%;
    justify-content: center;
  }

  .header-logo .logo-text {
    display: none;
  }

  .search-bar {
    flex-direction: column;
  }

  .filter-select {
    width: 100%;
  }

  .modal-content {
    border-radius: var(--radius-md);
  }

  .modal-header {
    padding: 16px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-details {
    grid-template-columns: 1fr;
  }

  .lookup-input-group {
    flex-direction: column;
  }

  .admin-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-table {
    font-size: 0.78rem;
  }

  .admin-table th,
  .admin-table td {
    padding: 8px 6px;
  }

  .registry-table {
    font-size: 0.78rem;
  }

  .registry-table th,
  .registry-table td {
    padding: 8px 6px;
  }
}

/* ============================
   VIEW TOGGLE (Card / Table)
   ============================ */
.view-toggle {
  display: flex;
  gap: 4px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.view-toggle-btn:hover {
  color: var(--text-primary);
}

.view-toggle-btn.active {
  background: var(--gold);
  color: #000;
}

/* --- Registry Table View --- */
.table-view-wrap {
  display: none;
  overflow-x: auto;
}

.table-view-wrap.active {
  display: block;
}

.cards-grid-wrap {
  display: block;
}

.cards-grid-wrap.hidden {
  display: none;
}

.registry-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 0.85rem;
}

.registry-table th {
  background: rgba(212, 160, 23, 0.05);
  color: var(--gold);
  font-weight: 700;
  padding: 12px 14px;
  text-align: left;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.registry-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

.registry-table tr {
  cursor: pointer;
  transition: var(--transition);
}

.registry-table tbody tr:hover td {
  background: rgba(212, 160, 23, 0.06);
}

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

.registry-table .car-number-cell {
  color: var(--gold);
  font-weight: 700;
}

.registry-table .type-cell {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.registry-table .view-cell .view-btn {
  padding: 4px 0;
}

/* ============================
   IMAGE EDITOR (Cropper.js)
   ============================ */
.editor-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.editor-overlay.active {
  display: flex;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.editor-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--gold);
}

.editor-toolbar {
  display: flex;
  gap: 8px;
}

.editor-tool-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.editor-tool-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.editor-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
}

.editor-canvas-wrap img {
  max-width: 100%;
  max-height: 100%;
  display: block;
}

.editor-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 599px) {
  .editor-toolbar {
    flex-wrap: wrap;
    gap: 4px;
  }

  .editor-tool-btn {
    padding: 6px 10px;
    font-size: 0.72rem;
  }

  .editor-footer {
    flex-direction: column;
  }

  .editor-footer .btn {
    width: 100%;
  }
}