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

/* ================================================
   APEX MOTORS — Premium Car Showroom Theme (Enhanced)
   Version: 2.0
   Colors: Carbon Black + Racing Red + Chrome Silver
   ================================================ */

/* ---------- CSS RESET & GLOBAL IMPROVEMENTS ---------- */
:root {
  /* Backgrounds */
  --bg-primary: #000000;
  --bg-secondary: #0d0d0d;
  --bg-card: #111111;
  --bg-card-hover: #1a1a1a;

  /* Accents - Main */
  --accent-red: #E8001D;
  --accent-red-glow: rgba(232, 0, 29, 0.5);
  --accent-red-dim: rgba(232, 0, 29, 0.15);
  --accent-chrome: #C8C8C8;
  --accent-chrome-glow: rgba(200, 200, 200, 0.25);
  --accent-gold: #D4AF37;

  /* Text Colors */
  --text-main: #FFFFFF;
  --text-muted: #ADADAD;
  /* Increased contrast */
  --text-dim: #6C6C6C;

  /* UI & Glass */
  --glass-bg: rgba(17, 17, 17, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-red: rgba(232, 0, 29, 0.4);
  --glass-hover-bg: rgba(30, 30, 30, 0.95);

  /* Spacing & Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.6);
  --border-radius-md: 12px;
  --border-radius-lg: 20px;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.2;
}

/* ---------- BOOTSTRAP OVERRIDES (More Precise) ---------- */
.text-muted {
  color: var(--text-muted) !important;
}

.text-info {
  color: var(--accent-red) !important;
}

.bg-info {
  background-color: var(--accent-red) !important;
}

.border-info {
  border-color: var(--accent-red) !important;
}

.form-check-input:checked {
  background-color: var(--accent-red);
  border-color: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red-glow);
}

/* ---------- TYPOGRAPHY & GRADIENTS ---------- */
.text-gradient {
  background: linear-gradient(135deg, var(--accent-red) 0%, #FF4D4D 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.text-gradient-chrome {
  background: linear-gradient(120deg, #9E9E9E 0%, #F5F5F5 50%, #9E9E9E 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- GLASSMORPHISM COMPONENTS (Improved) ---------- */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-md);
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-md);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.4, 1.1), box-shadow 0.4s ease, border-color 0.3s ease;
  overflow: hidden;
}

.glass-card .position-relative {
  overflow: hidden;
  border-radius: var(--border-radius-md) var(--border-radius-md) 0 0;
}

.glass-card .position-relative img {
  transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  width: 100%;
  height: 240px;
  /* Ensures uniform height */
  object-fit: cover;
  display: block;
}

.glass-card:hover .position-relative img {
  transform: scale(1.05);
  /* Smoother, less extreme zoom */
}

.glass-card:hover {
  transform: translateY(-8px);
  border-color: var(--glass-border-red);
  box-shadow: var(--shadow-lg), 0 0 32px var(--accent-red-glow);
}

/* ---------- IMAGES (Performance & UX) ---------- */
img.img-car {
  opacity: 0;
  transition: opacity 0.4s ease-in;
}

img.img-car.loaded {
  opacity: 1;
}

img.img-car-fallback {
  opacity: 1;
  filter: brightness(0.9);
  background: #1a1a1a;
  /* Fallback color */
}

/* ---------- BUTTONS (Enhanced & Accessible) ---------- */
.btn-neon {
  background: transparent;
  color: #fff;
  border: 1.5px solid var(--accent-red);
  border-radius: 8px;
  padding: 10px 28px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
  z-index: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-neon::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--accent-red);
  z-index: -1;
  transition: left 0.35s ease-out;
}

.btn-neon:hover::before {
  left: 0;
}

.btn-neon:hover {
  color: #fff;
  box-shadow: 0 0 20px var(--accent-red-glow);
  transform: translateY(-2px);
}

.btn-outline-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  border-radius: 8px;
  padding: 8px 20px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  letter-spacing: 0.05em;
  transition: all 0.25s ease;
  cursor: pointer;
}

.btn-outline-glass:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent-chrome);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 12px var(--accent-chrome-glow);
}

/* ---------- NAVBAR (Refined Active State) ---------- */
.navbar-glass {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(232, 0, 29, 0.25);
  transition: all 0.3s ease;
}

.navbar-brand {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 800;
  font-size: 1.7rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #fff 30%, var(--accent-red) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.navbar-dark .navbar-nav .nav-link {
  color: var(--text-muted);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  transition: all 0.3s;
  padding: 0.5rem 1rem;
  position: relative;
}

.navbar-dark .navbar-nav .nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--accent-red);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.navbar-dark .navbar-nav .nav-link:hover::after,
.navbar-dark .navbar-nav .nav-link.active::after {
  width: 70%;
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active {
  color: var(--accent-red);
  text-shadow: 0 0 8px var(--accent-red-glow);
}

/* ---------- FORM ELEMENTS (Better Focus States) ---------- */
.form-control-glass,
.form-select-glass {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #fff;
  border-radius: 8px;
  transition: all 0.25s ease;
  padding: 10px 14px;
}

.form-control-glass:focus,
.form-select-glass:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-red);
  box-shadow: 0 0 0 3px var(--accent-red-dim);
  color: #fff;
  outline: none;
}

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

.input-group-text {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  border-radius: 8px;
}

/* ---------- DASHBOARD SIDEBAR (Improved Layout) ---------- */
.sidebar {
  min-height: calc(100vh - 76px);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  border-right: 1px solid var(--glass-border);
}

.sidebar .nav-link {
  color: var(--text-muted);
  border-radius: 10px;
  margin-bottom: 6px;
  padding: 12px 20px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all 0.25s;
  border-left: 3px solid transparent;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  border-left: 3px solid var(--accent-red);
  transform: translateX(4px);
}

/* ---------- BADGES & TAGS ---------- */
.badge-glass {
  background: var(--accent-red-dim);
  border: 1px solid var(--glass-border-red);
  color: var(--accent-red);
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 6px 12px;
  border-radius: 50px;
  backdrop-filter: blur(4px);
}

/* ---------- PAGINATION (Cleaner Design) ---------- */
.page-link {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid var(--glass-border) !important;
  color: #fff !important;
  border-radius: 8px !important;
  margin: 0 4px !important;
  transition: all 0.2s !important;
}

.page-link:hover {
  border-color: var(--accent-red) !important;
  color: var(--accent-red) !important;
  transform: scale(1.05);
}

.page-item.active .page-link {
  background: var(--accent-red-dim) !important;
  border-color: var(--accent-red) !important;
  color: var(--accent-red) !important;
  font-weight: bold;
}

/* ---------- FOOTER (Subtle Refinements) ---------- */
footer {
  border-top: 1px solid rgba(232, 0, 29, 0.2);
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  margin-top: 4rem;
}

footer a {
  color: var(--text-muted);
  transition: color 0.25s;
  text-decoration: none;
}

footer a:hover {
  color: var(--accent-red);
  text-decoration: underline;
}

/* ---------- CANVAS BACKGROUND (Keep it hidden, but ready) ---------- */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0.6;
  /* Less distraction */
}

/* ---------- RESPONSIVE & UTILITIES ---------- */
@media (max-width: 768px) {
  .navbar-brand {
    font-size: 1.4rem;
    letter-spacing: 2px;
  }

  .display-3 {
    font-size: 2.2rem;
  }

  .glass-card .position-relative img {
    height: 180px;
  }

  .sidebar {
    min-height: auto;
    margin-bottom: 20px;
  }
}

/* Helper class to prevent text selection on buttons/badges */
.no-select {
  user-select: none;
  -webkit-user-select: none;
}