/* 
   Car Dealership "Carbon Edition" Design System
   Modern Simplistic | Light/Dark Mode | Automotive Aesthetics
*/

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

:root {
  /* --- Light Mode (Default) --- */
  --bg-base: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  /* Glass-like light */

  --text-main: #1a1a1a;
  --text-muted: #595959;
  --border-color: rgba(0, 0, 0, 0.1);

  --c-accent-primary: #ff3b30;
  /* Sporty Red */
  --c-accent-hover: #ff5e55;
  --c-accent-secondary: #007aff;
  /* Electric Blue */

  /* Glassmorphism Light */
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: 1px solid rgba(0, 0, 0, 0.05);
  --glass-blur: blur(12px);

  /* Spacing */
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 40px;

  /* Radius */
  --rad-sm: 8px;
  --rad-md: 16px;
  --rad-lg: 24px;

  /* Shadows */
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.05);
}

/* --- Dark Mode Override --- */
[data-theme="dark"] {
  --bg-base: #121212;
  --bg-surface: #1e1e1e;
  --bg-card: rgba(30, 30, 30, 0.7);

  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --border-color: rgba(255, 255, 255, 0.1);

  --glass-bg: rgba(30, 30, 30, 0.7);
  --glass-border: 1px solid rgba(255, 255, 255, 0.08);
  --shadow-card: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

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

/* Smooth scrolling global */
html {
  scroll-behavior: smooth;
  height: 100%;
  overflow: hidden; /* Prevent root scroll */
}

body {
  font-family: "Inter", sans-serif;
  background-color: var(--bg-base);
  color: var(--text-main);
  overflow: hidden; /* Prevent body scroll, let children scroll */
  width: 100%;
  height: 100vh; /* Fallback */
  height: 100dvh; /* Dynamic viewport height for mobile */
  display: flex;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
  overscroll-behavior: none; /* Prevent scroll chaining/bounce on mobile */
  -webkit-overflow-scrolling: touch;
}

/* --- Background Texture (Optional for Light Mode, Mandatory for Dark) --- */
.bg-carbon {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  transition: opacity 0.3s ease;
  opacity: 0.05;
  /* Faint texture in light mode */
  background-color: var(--bg-base);
  background-image:
    linear-gradient(
      45deg,
      #000 25%,
      transparent 25%,
      transparent 75%,
      #000 75%,
      #000
    ),
    linear-gradient(
      45deg,
      #000 25%,
      transparent 25%,
      transparent 75%,
      #000 75%,
      #000
    );
  background-size: 4px 4px;
  background-position:
    0 0,
    2px 2px;
}

/* --- Brand Logo --- */
.brand-logo {
  max-width: 180px;
  height: auto;
  display: block;
}

.logo-dark {
  display: none;
}

.logo-light {
  display: block;
}

[data-theme="dark"] .logo-light {
  display: none;
}

[data-theme="dark"] .logo-dark {
  display: block;
}

[data-theme="dark"] .bg-carbon {
  opacity: 1;
  background-color: #0a0a0a;
  background-image:
    linear-gradient(
      45deg,
      #1a1a1a 25%,
      transparent 25%,
      transparent 75%,
      #1a1a1a 75%,
      #1a1a1a
    ),
    linear-gradient(
      45deg,
      #1a1a1a 25%,
      transparent 25%,
      transparent 75%,
      #1a1a1a 75%,
      #1a1a1a
    );
  background-size: 8px 8px;
  background-position:
    0 0,
    4px 4px;
}

/* Overlay gradient only for dark mode mostly */
[data-theme="dark"] .bg-carbon::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(
    circle at top left,
    rgba(20, 20, 20, 0.8),
    rgba(0, 0, 0, 0.95)
  );
  z-index: -1;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
.brand-font {
  font-family: "Michroma", sans-serif;
  /* Tech/Automotive feel */
  text-transform: uppercase;
  letter-spacing: 1px;
}

a {
  text-decoration: none;
  color: inherit;
}

/* --- Layout --- */
#app {
  display: flex;
  width: 100%;
  height: 100%;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: var(--sp-lg);
  z-index: 100;
  transition:
    background 0.3s,
    border-color 0.3s;
  position: relative;
  overflow-y: auto; /* Enable scrolling for sidebar if clear vertical space is low */
  scrollbar-width: none; /* Hide scrollbar Firefox */
  -ms-overflow-style: none; /* Hide scrollbar IE/Edge */
}

/* Hide scrollbar Webkit */
.sidebar::-webkit-scrollbar {
  display: none;
}

[data-theme="dark"] .sidebar {
  background: rgba(10, 10, 10, 0.95);
  border-right: var(--glass-border);
  backdrop-filter: var(--glass-blur);
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
}

.brand {
  font-size: 1.2rem;
  color: var(--c-accent-primary);
  margin-bottom: var(--sp-xl);
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--border-color);
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  /* Espacio entre items para mejor separaciÃ³n visual */
}

/* Sidebar User Profile */
.sidebar-user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--rad-sm);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
  cursor: pointer;
}

.sidebar-user-profile:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--c-accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sidebar-user-profile:active {
  transform: translateY(0);
}

.sidebar-user-profile .user-avatar {
  width: 40px;
  height: 40px;
  background: #333;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--c-accent-primary);
  color: #fff;
  font-size: 1.2rem;
}

.sidebar-user-profile .user-info {
  display: flex;
  flex-direction: column;
}

.sidebar-user-profile .user-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  font-family: "Michroma", sans-serif;
  /* Adding the tech font */
  letter-spacing: 0.5px;
}

.sidebar-user-profile .user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
}

.nav-item {
  position: relative;
}

/* Separador sutil entre items */
.nav-item:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 27%;
  right: 10%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1) 20%,
    rgba(255, 255, 255, 0.1) 80%,
    transparent
  );
  opacity: 0.5;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 6px;
  padding-left: 27%;
  /* Text starts at 27% from the left */
  border-radius: var(--rad-sm);
  color: #ffffff;
  /* Texto blanco */
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 700;
  font-family: "Manajada", "Manjari", "Montserrat", sans-serif;
  /* Fuente Manjari */
  text-transform: uppercase;
  /* Todo en mayÃºsculas */
  font-size: 0.85rem;
  /* â† TAMAÃ‘O DE LETRA REDUCIDO (antes era el tamaÃ±o por defecto ~1rem) */
  letter-spacing: 0.5px;
  /* Espaciado de letras para mejor legibilidad */
  background-image: url("../Assets/barrafondo.svg");
  background-size: 100% auto;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 50px;
  /* Ensure enough height for the SVG */
  position: relative;
  overflow: hidden;
  /* Sombra eliminada en estado normal para diseÃ±o mÃ¡s limpio */
}

/* Efecto de brillo sutil en hover */
.nav-item a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transition: left 0.6s ease;
}

.nav-item a:hover::before {
  left: 100%;
}

/* Indicador activo mejorado */
.nav-item a.active::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 70%;
  background: linear-gradient(
    180deg,
    transparent,
    #ffffff 20%,
    #ffffff 80%,
    transparent
  );
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  }

  50% {
    opacity: 0.7;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
  }
}

/* Ocultar iconos en modo PC (escritorio) */
@media (min-width: 768px) {
  .nav-item a i {
    display: none;
  }
}

.nav-item a:hover,
.nav-item a.active {
  background-image: url("../Assets/barrafondo.svg");
  background-size: 100% auto;
  background-position: center;
  background-repeat: no-repeat;
  color: #ffffff;
  /* Texto blanco en hover y active */
  transform: translateX(3px);
  /* Efecto de desplazamiento sutil al hover */
  box-shadow: 0 4px 15px rgba(234, 0, 43, 0.3);
}

.nav-item a:active {
  transform: translateX(1px) scale(0.98);
}

[data-theme="dark"] .nav-item a:hover,
[data-theme="dark"] .nav-item a.active {
  box-shadow: 0 4px 20px rgba(255, 59, 48, 0.25);
}

.nav-icon {
  width: 20px;
  text-align: center;
  transition: transform 0.3s ease;
}

.nav-item a:hover .nav-icon {
  transform: scale(1.1) rotate(5deg);
}

/* Theme Toggle Button */
.theme-toggle-btn {
  margin-top: auto;
  /* Push to bottom */
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: var(--rad-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.theme-toggle-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.theme-toggle-btn:hover {
  border-color: var(--c-accent-primary);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-toggle-btn:hover::before {
  opacity: 0.2;
}

.theme-toggle-btn i {
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-toggle-btn:hover i {
  transform: rotate(20deg) scale(1.1);
}

.theme-toggle-btn:active {
  transform: scale(0.95);
}

/* Sidebar Collapsed State - DESKTOP ONLY */
@media (min-width: 769px) {
  .sidebar.collapsed {
    width: 80px;
  }

  .sidebar.collapsed .brand-font,
  .sidebar.collapsed .sidebar-user-profile .user-info,
  .sidebar.collapsed .nav-item a span,
  .sidebar.collapsed .theme-toggle-btn span,
  .sidebar.collapsed .sidebar-collapse-btn span {
    display: none;
  }

  .sidebar.collapsed .brand-icon {
    display: block !important;
    color: var(--c-accent-primary);
  }

  .sidebar.collapsed .brand {
    justify-content: center;
    padding-left: 0;
  }

  .sidebar.collapsed .brand .brand-logo {
    max-width: 45px;
    height: auto;
  }

  .sidebar.collapsed .sidebar-user-profile {
    justify-content: center;
    padding: 8px;
  }

  .sidebar.collapsed .nav-item a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  /* Ensure icons are visible and centered in collapsed mode */
  .sidebar.collapsed .nav-item a i {
    display: block;
    margin: 0;
    font-size: 1.4rem;
    /* Larger icons */
  }

  /* Remove background and fix padding for collapsed items */
  .sidebar.collapsed .nav-item a {
    background-image: none !important;
    padding: 12px 0;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--c-accent-primary);
    /* Red icons in light mode */
  }

  /* Icons are white in dark mode collapsed sidebar */
  [data-theme="dark"] .sidebar.collapsed .nav-item a {
    color: #ffffff;
  }

  /* Hover effect for collapsed items */
  .sidebar.collapsed .nav-item a:hover,
  .sidebar.collapsed .nav-item a.active {
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: none;
    /* Remove red shadow */
    color: var(--c-accent-primary);
    transform: none;
    /* Remove shift */
  }

  /* Fix User Profile in Collapsed Mode */
  .sidebar.collapsed .sidebar-user-profile {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: var(--sp-xl);
  }

  .sidebar.collapsed .user-avatar {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    /* Prevent squishing */
    margin: 0 auto;
  }

  .sidebar.collapsed .theme-toggle-btn,
  .sidebar.collapsed .sidebar-collapse-btn {
    justify-content: center;
    padding: 12px;
  }
}

/* Sidebar Collapse Button */
.sidebar-collapse-btn {
  margin-top: 10px;
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 12px 16px;
  border-radius: var(--rad-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sidebar-collapse-btn:hover {
  border-color: var(--c-accent-primary);
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sidebar-collapse-btn:hover i {
  transform: scale(1.1);
  transition: transform 0.3s ease;
}

.sidebar-collapse-btn:active {
  transform: translateY(0) scale(0.98);
}

/* --- Main Content --- */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: var(--sp-lg);
  overflow-y: auto;
  overscroll-behavior: contain; /* Prevent scrolling parent when hitting edge */
  -webkit-overflow-scrolling: touch;
  position: relative;
}

/* Ensure all direct children of main-content don't shrink and take full width */
.main-content > * {
  flex-shrink: 0;
  width: 100%;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-xl);
}

/* --- Components --- */
.card {
  background: var(--bg-card);
  border: var(--glass-border);
  border-radius: var(--rad-md);
  padding: var(--sp-lg);
  box-shadow: var(--shadow-card);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

/* Efecto shine en cards */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(0, 0, 0, 0.05),
    /* Softer dark shine for light mode */ transparent
  );
  transition: left 0.7s ease;
  pointer-events: none;
  z-index: 1;
}

[data-theme="dark"] .card::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    /* Light shine for dark mode */ transparent
  );
}

.card:hover::before {
  left: 100%;
}

/* Borde con gradiente redondeado para hover */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--rad-md);
  padding: 2px;
  background: linear-gradient(
    115deg,
    var(--c-accent-primary),
    var(--c-accent-secondary),
    var(--c-accent-primary)
  );
  background-size: 200% 200%;
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  transition:
    opacity 0.4s ease,
    padding 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

@keyframes borderRotate {
  0% {
    background-position: 0% 50%;
  }

  100% {
    background-position: 100% 50%;
  }
}

.card:hover::after {
  opacity: 1;
  padding: 4px;
  /* Agrandar un poco el borde */
  animation: borderRotate 2s linear infinite;
  /* Girar colores */
}

/* Metric cards and Recent Sales always show the gradient border */
.recent-sales-card::after {
  opacity: 1;
}

/* Metric cards get continuous animation */
.metric-card::after,
.card-glow::after {
  opacity: 1;
  padding: 4px;
  animation: borderRotate 2s linear infinite;
}

/* Force gradient border on mobile and tablet for all cards */
@media (max-width: 1024px) {
  .card::after {
    opacity: 1 !important;
    padding: 4px !important;
    animation: borderRotate 2s linear infinite;
  }
}

[data-theme="dark"] .card {
  backdrop-filter: var(--glass-blur);
}

.card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow:
    0 15px 50px 0 rgba(0, 0, 0, 0.3),
    0 5px 15px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .card:hover {
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
}

.btn {
  padding: 10px 20px;
  border-radius: var(--rad-sm);
  border: none;
  cursor: pointer;
  font-family: "Michroma", sans-serif;
  font-size: 0.8rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Ripple effect en botones */
.btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition:
    width 0.6s,
    height 0.6s;
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

/* AnimaciÃ³n de iconos dentro de botones */
.btn i {
  transition: transform 0.3s ease;
  display: inline-block;
}

.btn:hover i {
  transform: scale(1.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--c-accent-primary), #d93025);
  color: white;
  box-shadow: 0 4px 15px rgba(255, 59, 48, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.15);
  box-shadow: 0 6px 25px rgba(255, 59, 48, 0.6);
  transform: translateY(-2px) scale(1.02);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 10px rgba(255, 59, 48, 0.4);
}

.btn-outline {
  background: transparent;
  border: 1px solid #c0c0c0;
  /* Stronger border for light mode */
  color: #333;
  /* Darker text for light mode */
  position: relative;
}

.btn-outline::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--rad-sm);
  background: linear-gradient(
    135deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.btn-outline:hover {
  border-color: var(--c-accent-primary);
  color: #fff;
  /* White text on hover */
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .btn-outline {
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

/* Notification Button Special Style */
.top-bar .btn-outline {
  background: #ea002b !important;
  /* Fondo rojo solido */
  border-color: #ea002b !important;
  color: white !important;
  /* Texto blanco para contraste */
  box-shadow: 0 0 10px rgba(234, 0, 43, 0.4);
}

.top-bar .btn-outline:hover {
  background: #ea002b !important;
  color: white !important;
  box-shadow: 0 0 20px rgba(234, 0, 43, 0.6);
}

.btn-outline:hover::after {
  opacity: 0.15;
}

.btn-outline:active {
  transform: scale(0.98);
}

/* --- Dashboard Specifics --- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  /* 5 columns for metrics: Income, Expense, Profit, Financing, Pending */
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.metrics-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  /* 3 columns for charts */
  gap: var(--sp-lg);
  margin-top: 40px;
}

@media (max-width: 1200px) {
  .charts-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .metrics-grid,
  .metrics-grid-3,
  .charts-grid {
    grid-template-columns: 1fr;
  }
}

.metric-card h3 {
  font-family: "Inter", sans-serif;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--sp-sm);
  text-transform: uppercase;
}

.metric-value {
  font-size: 2.5rem;
  font-weight: 700;
  font-family: "Michroma", sans-serif;
  color: var(--text-main);
  /* Fallback */
}

[data-theme="dark"] .metric-value {
  background: linear-gradient(to right, #fff, #aaa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.metric-trend {
  font-size: 0.85rem;
  margin-top: 8px;
}

.metric-value-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 10px;
}

.premium-card {
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding: 15px;
}

.premium-card h3 {
  font-size: 1rem !important;
  letter-spacing: 2px !important;
}

.card-footer-tip {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: auto;
  padding-top: 15px;
  opacity: 0.6;
  text-transform: uppercase;
  font-weight: 600;
  transition: opacity 0.3s ease;
}

.premium-card:hover .card-footer-tip {
  opacity: 1;
  color: var(--c-accent-primary);
}

.trend-up {
  color: #4cd964;
}

.trend-down {
  color: #ff3b30;
}

/* Table Styles */
.table-container {
  overflow-x: auto;
  border-radius: var(--rad-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--sp-md);
}

th {
  text-align: left;
  padding: var(--sp-md);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, rgba(255, 59, 48, 0.03), transparent);
  position: relative;
}

th::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--c-accent-primary), transparent);
  opacity: 0.3;
}

td {
  padding: var(--sp-md);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  transition: all 0.3s ease;
}

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

/* Borde lateral de acento en hover */
tr::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(
    180deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

tr:hover::before {
  opacity: 1;
}

tr:hover td {
  background: rgba(255, 59, 48, 0.03);
  transform: scale(1.001);
}

[data-theme="dark"] tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

/* Status Badges */
.badge {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.7rem;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-block;
  position: relative;
  border: 1px solid transparent;
}

.badge:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.badge-available {
  background: linear-gradient(
    135deg,
    rgba(76, 217, 100, 0.25),
    rgba(76, 217, 100, 0.15)
  );
  color: #2e8b3e;
  border-color: rgba(76, 217, 100, 0.3);
}

.badge-available:hover {
  background: linear-gradient(
    135deg,
    rgba(76, 217, 100, 0.35),
    rgba(76, 217, 100, 0.25)
  );
}

.badge-sold {
  background: linear-gradient(
    135deg,
    rgba(255, 59, 48, 0.25),
    rgba(255, 59, 48, 0.15)
  );
  color: #d63025;
  border-color: rgba(255, 59, 48, 0.3);
}

.badge-sold:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 59, 48, 0.35),
    rgba(255, 59, 48, 0.25)
  );
}

.badge-reserved {
  background: linear-gradient(
    135deg,
    rgba(255, 204, 0, 0.25),
    rgba(255, 204, 0, 0.15)
  );
  color: #b38f00;
  border-color: rgba(255, 204, 0, 0.3);
}

.badge-reserved:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 204, 0, 0.35),
    rgba(255, 204, 0, 0.25)
  );
}

[data-theme="dark"] .badge-available {
  color: #4cd964;
  box-shadow: 0 0 10px rgba(76, 217, 100, 0.2);
}

[data-theme="dark"] .badge-sold {
  color: #ff3b30;
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.2);
}

[data-theme="dark"] .badge-reserved {
  color: #ffcc00;
  box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

/* --- Vehicle Blueprint Feature --- */
.blueprint-wrap {
  position: relative;
  width: 100%;
  /* 50% smaller as requested. Original was ~800px or full width. 
       Let's stick to a constrained pixel width to ensure it's "small" but usable. */
  max-width: 450px;
  margin: 24px auto;
  border: 1px dashed var(--border-color);
  padding: 20px;
  border-radius: var(--rad-md);
  background: rgba(128, 128, 128, 0.05);
  user-select: none;
  /* Prevent selection when clicking to add pins */
}

.blueprint-wrap.editing {
  cursor: crosshair;
  /* Indicate "Add Pin" mode */
  border-color: var(--c-accent-secondary);
  background: rgba(0, 122, 255, 0.05);
  /* Blue tint in edit mode */
}

.blueprint {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.2));
}

[data-theme="dark"] .blueprint {
  filter: invert(1) drop-shadow(0 0 5px rgba(255, 255, 255, 0.2));
}

.pin {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--c-accent-primary);
  background: var(--bg-surface);
  cursor: pointer;
  transform: translate(-50%, -50%);
  /* Center pin on coord */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  transition:
    transform 0.2s,
    background 0.2s;
  z-index: 10;
}

.pin:hover {
  transform: translate(-50%, -50%) scale(1.2);
  background: var(--c-accent-primary);
}

.pin::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid var(--c-accent-primary);
  opacity: 0.5;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

/* --- Edit Mode Styles --- */
.hidden {
  display: none !important;
}

.editable-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--rad-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.9rem;
  margin-top: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Inter", sans-serif;
}

.editable-input:hover {
  border-color: rgba(255, 59, 48, 0.3);
}

.editable-input:focus {
  outline: none;
  border-color: var(--c-accent-primary);
  box-shadow:
    0 0 0 3px rgba(255, 59, 48, 0.1),
    0 4px 12px rgba(255, 59, 48, 0.15);
  transform: translateY(-1px);
}

.editable-input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.editable-input:focus::placeholder {
  opacity: 0.4;
}

.editable-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: rgba(128, 128, 128, 0.1);
}

.edit-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 20px;
}

/* --- Blueprint Pin Modal (Nested) --- */
.pin-modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, 0.6);
  padding: 16px;
  z-index: 9999;
}

.pin-modal.open {
  display: grid;
}

.pin-modal-card {
  width: min(500px, 95vw);
  background: var(--bg-surface);
  border-radius: 16px;
  padding: 16px;
  position: relative;
  color: var(--text-main);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  overflow-x: hidden;
  box-sizing: border-box;
}

.pin-modal-card img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  margin-top: 10px;
  border: 1px solid var(--border-color);
}

.pin-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: var(--bg-base);
  color: var(--text-main);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.pin-close:hover {
  background: var(--c-accent-primary);
  color: white;
}

/* Pin Edit Form inside the modal */
.pin-edit-form {
  margin-top: 15px;
  border-top: 1px solid var(--border-color);
  padding-top: 15px;
}

/* --- Generic Modal System --- */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: none;
  /* Hidden by default */
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: modalBackdropFadeIn 0.3s ease;
}

.modal.active {
  display: flex;
  /* Show when active */
}

@keyframes modalBackdropFadeIn {
  from {
    opacity: 0;
    backdrop-filter: blur(0);
  }

  to {
    opacity: 1;
    backdrop-filter: blur(8px);
  }
}

.modal-content {
  background: var(--bg-surface);
  padding: var(--sp-xl);
  border-radius: var(--rad-lg);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative;
  color: var(--text-main);
  animation: modalContentEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

@keyframes modalContentEnter {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }

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

[data-theme="dark"] .modal-content {
  backdrop-filter: blur(20px);
  background: rgba(30, 30, 30, 0.95);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-lg);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: var(--sp-md);
  position: relative;
}

.modal-header::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 30%;
  height: 2px;
  background: linear-gradient(90deg, var(--c-accent-primary), transparent);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.btn-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.btn-close::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent-primary), #d93025);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}

.btn-close:hover {
  color: white;
  transform: rotate(90deg) scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 59, 48, 0.3);
}

.btn-close:hover::before {
  opacity: 1;
}

.btn-close:active {
  transform: rotate(90deg) scale(0.95);
}

/* Form Styles inside Modal */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-md);
}

/* Make form-grid single column on smaller screens by default */
@media (max-width: 600px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-field {
  padding: 12px 14px;
  border-radius: var(--rad-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-base);
  color: var(--text-main);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Inter", sans-serif;
  font-size: 0.95rem;
}

.input-field:hover {
  border-color: rgba(255, 59, 48, 0.3);
}

.input-field:focus {
  outline: none;
  border-color: var(--c-accent-primary);
  box-shadow:
    0 0 0 3px rgba(255, 59, 48, 0.1),
    0 4px 12px rgba(255, 59, 48, 0.15);
  transform: translateY(-1px);
}

.input-field::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.input-field:focus::placeholder {
  opacity: 0.3;
}

select.input-field {
  cursor: pointer;
  background-color: var(--bg-surface) !important;
  color: var(--text-main) !important;
}

/* Chrome/Windows specific fix for select options */
select.input-field option {
  background-color: #ffffff !important;
  color: #1a1a1a !important;
}

[data-theme="dark"] select.input-field option {
  background-color: #1e1e1e !important;
  color: #ffffff !important;
}

textarea.input-field {
  resize: vertical;
  min-height: 100px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: var(--sp-lg);
  border-top: 1px solid var(--border-color);
  padding-top: var(--sp-md);
}

/* --- Specific Modal Input Styling (Dark Inputs) --- */
#newTransactionModal input,
#newTransactionModal select,
#newTransactionModal .input-field,
#newConsignmentModal input,
#newConsignmentModal select,
#newConsignmentModal .input-field,
#newTransactionModal textarea,
#newConsignmentModal textarea {
  background: #111;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

#newTransactionModal input::placeholder,
#newConsignmentModal input::placeholder {
  color: #777;
}

/* --- Dashboard Charts Grid --- */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: var(--sp-lg);
  margin-bottom: var(--sp-xl);
}

.chart-container {
  min-height: 280px;
  position: relative;
  display: flex;
  flex-direction: column;
}

.chart-container canvas {
  flex: 1;
  max-height: 300px;
}

.chart-container h3 {
  font-family: "Inter", sans-serif;
  text-transform: none;
  letter-spacing: normal;
}

/* ===================================
   ANIMACIONES GLOBALES PROFESIONALES
   =================================== */

/* AnimaciÃ³n FadeIn Mejorada */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

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

.fade-in {
  animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* AnimaciÃ³n Slide desde la izquierda */
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }

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

.slide-in-left {
  animation: slideInLeft 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* AnimaciÃ³n Slide desde la derecha */
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }

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

.slide-in-right {
  animation: slideInRight 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* AnimaciÃ³n Scale In */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in {
  animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Stagger Effect - delays progresivos para listas */
.fade-in:nth-child(1) {
  animation-delay: 0.05s;
}

.fade-in:nth-child(2) {
  animation-delay: 0.1s;
}

.fade-in:nth-child(3) {
  animation-delay: 0.15s;
}

.fade-in:nth-child(4) {
  animation-delay: 0.2s;
}

.fade-in:nth-child(5) {
  animation-delay: 0.25s;
}

.fade-in:nth-child(6) {
  animation-delay: 0.3s;
}

.fade-in:nth-child(7) {
  animation-delay: 0.35s;
}

.fade-in:nth-child(8) {
  animation-delay: 0.4s;
}

.fade-in:nth-child(9) {
  animation-delay: 0.45s;
}

.fade-in:nth-child(10) {
  animation-delay: 0.5s;
}

/* Inicializar todos los elementos animados como invisibles */
.fade-in,
.slide-in-left,
.slide-in-right,
.scale-in {
  opacity: 0;
}

/* AnimaciÃ³n de entrada para elementos del grid. */
.metrics-grid > *,
.charts-grid > * {
  animation: scaleIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  opacity: 0;
}

.metrics-grid > *:nth-child(1) {
  animation-delay: 0.1s;
}

.metrics-grid > *:nth-child(2) {
  animation-delay: 0.2s;
}

.metrics-grid > *:nth-child(3) {
  animation-delay: 0.3s;
}

.metrics-grid > *:nth-child(4) {
  animation-delay: 0.4s;
}

.charts-grid > *:nth-child(1) {
  animation-delay: 0.15s;
}

.charts-grid > *:nth-child(2) {
  animation-delay: 0.25s;
}

.charts-grid > *:nth-child(3) {
  animation-delay: 0.35s;
}

.charts-grid > *:nth-child(4) {
  animation-delay: 0.45s;
}

.charts-grid > *:nth-child(5) {
  animation-delay: 0.55s;
}

.charts-grid > *:nth-child(6) {
  animation-delay: 0.65s;
}

/* AnimaciÃ³n de hover para imÃ¡genes */
img {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

img:hover {
  transform: scale(1.02);
}

/* Loading state sutil */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }

  100% {
    background-position: 1000px 0;
  }
}

.loading {
  background: linear-gradient(
    90deg,
    var(--bg-surface) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    var(--bg-surface) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 2s infinite linear;
}

/* ===================================
   MOBILE MODAL VISUALIZATION FIX (80HV)
   =================================== */
@media (max-width: 768px) {
  /* Target specific modals requested by user */
  #analysisModal .modal-content,
  #addVehicleModal .modal-content,
  #vehicleDetailModal .modal-content,
  #addCustomerModal .modal-content,
  #customerDetailModal .modal-content,
  #nfcCardModal .modal-content,
  #addCardModal .modal-content,
  #newTransactionModal .modal-content,
  #confirmTransactionDeleteModal .modal-content,
  #newConsignmentModal .modal-content,
  #auditLogsModal .modal-content,
  #salespersonModal .modal-content,
  #userProfileModal .modal-content {
    max-height: 90vh !important;
    overflow-y: auto !important;
    min-height: auto !important; /* Override any full-screen enforcements */
    width: 95% !important;
    margin: auto !important;
    border-radius: 12px !important;
    position: relative;
  }

  /* Ensure modals are flex centered on mobile to allow the margin auto to work */
  .modal.active {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }

  /* Extra safeguard for small screens */
  .modal-content {
    scrollbar-width: thin;
  }
}

/* ===================================
   MOBILE LAYOUT FIXES (User Request)
   =================================== */
@media (max-width: 768px) {
  /* Consignaciones: Stack Owner Header */
  .owner-section-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px;
  }
  .owner-section-header button {
    width: 100%;
    justify-content: center;
  }

  /* Configuración: Salesperson List Stack */
  #salespeopleList > div {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 15px !important;
  }

  #salespeopleList > div > div:first-child {
    width: 100%;
  }

  #salespeopleList > div > div:last-child {
    width: 100%;
    justify-content: space-between;
    margin-top: 5px;
  }

  #salespeopleList > div > div:last-child button {
    flex: 1;
    justify-content: center;
  }

  /* Profile Modal: Fix button overflow on mobile */
  #userProfileModal .modal-content {
    width: 95% !important;
    max-width: 95% !important;
  }

  #userProfileModal form > div:last-child {
    flex-direction: column !important;
    gap: 8px !important;
  }

  #userProfileModal form > div:last-child button {
    width: 100% !important;
  }
}

/* ===================================
   MEJORAS DASHBOARD, INVENTARIO Y CRM
   =================================== */

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   1. DASHBOARD - GRÃFICAS MEJORADAS
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.chart-container {
  position: relative;
  overflow: hidden !important;
}

/* Borde superior con gradiente */
.chart-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--c-accent-primary),
    var(--c-accent-secondary),
    transparent
  );
  border-radius: var(--rad-md) var(--rad-md) 0 0;
}

.chart-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .chart-container:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-md);
  border-bottom: 2px solid var(--border-color);
  position: relative;
}

.chart-header::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--c-accent-primary), transparent);
}

.chart-title-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(
    135deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
}

.chart-title-text h3 {
  margin: 0;
  font-size: 0.95rem !important;
  color: var(--text-main);
}

.chart-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.chart-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chart-period-selector {
  background: var(--glass-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.chart-period-selector:hover {
  border-color: var(--c-accent-primary);
  background: rgba(255, 59, 48, 0.05);
}

.chart-trend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.chart-trend.up {
  color: #4cd964;
  background: rgba(76, 217, 100, 0.1);
}

.chart-trend.down {
  color: #ff3b30;
  background: rgba(255, 59, 48, 0.1);
}

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   2. INVENTARIO - PANEL DE FILTROS
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.filter-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--rad-md);
  padding: var(--sp-md);
  border: 1px solid var(--border-color);
  margin-bottom: var(--sp-md);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-card);
}

.filter-panel:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .filter-panel {
  background: rgba(30, 30, 30, 0.8);
}

.filter-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-sm);
  cursor: pointer;
  user-select: none;
}

.filter-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.filter-toggle-icon {
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.filter-panel.collapsed .filter-toggle-icon {
  transform: rotate(-90deg);
}

.filter-badge {
  background: linear-gradient(
    135deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 700;
}

.filter-content {
  max-height: 1000px;
  overflow: hidden;
  transition:
    max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
  opacity: 1;
}

.filter-panel.collapsed .filter-content {
  max-height: 0;
  opacity: 0;
}

.filter-section {
  margin-bottom: var(--sp-sm);
  padding-bottom: var(--sp-sm);
  border-bottom: 1px solid var(--border-color);
}

.filter-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.filter-section-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-main);
  margin-bottom: var(--sp-sm);
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-section-icon {
  color: var(--c-accent-primary);
  font-size: 0.9rem;
}

/* Custom Checkbox */
.custom-checkbox {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
  user-select: none;
}

.custom-checkbox:hover {
  background: rgba(255, 59, 48, 0.05);
}

.custom-checkbox input {
  display: none;
}

.custom-checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-radius: 5px;
  margin-right: 10px;
  position: relative;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.custom-checkbox input:checked + .custom-checkbox-box {
  background: linear-gradient(
    135deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  border-color: var(--c-accent-primary);
}

.custom-checkbox input:checked + .custom-checkbox-box::after {
  content: "\2713";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.custom-checkbox-label {
  font-size: 0.9rem;
  color: var(--text-main);
}

.filter-checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 4px;
}

/* Range Slider */
.range-slider-container {
  padding: 10px 0;
}

.range-slider-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.range-slider {
  width: 100%;
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  position: relative;
  cursor: pointer;
}

.range-slider-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  border-radius: 3px;
  position: absolute;
  left: 0;
  transition: width 0.2s ease;
}

.range-slider-thumb {
  width: 18px;
  height: 18px;
  background: white;
  border: 3px solid var(--c-accent-primary);
  border-radius: 50%;
  position: absolute;
  top: -6px;
  cursor: grab;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.range-slider-thumb:hover {
  transform: scale(1.2);
}

.range-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.1);
}

/* Filter Chips (Active Filters) */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--sp-md);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(
    135deg,
    rgba(255, 59, 48, 0.1),
    rgba(0, 122, 255, 0.1)
  );
  border: 1px solid var(--c-accent-primary);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.filter-chip:hover {
  background: linear-gradient(
    135deg,
    rgba(255, 59, 48, 0.2),
    rgba(0, 122, 255, 0.2)
  );
  transform: scale(1.05);
}

.filter-chip-remove {
  cursor: pointer;
  width: 16px;
  height: 16px;
  background: var(--c-accent-primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: transform 0.2s ease;
}

.filter-chip-remove:hover {
  transform: rotate(90deg);
}

.filter-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: var(--sp-md);
  border-top: 1px solid var(--border-color);
}

/* â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€
   3. CRM - BARRA DE BÃšSQUEDA PREMIUM
   â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */

.search-bar-premium {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.search-bar-premium input {
  width: 100%;
  padding: 14px 50px 14px 50px;
  border-radius: 12px;
  border: 2px solid var(--border-color);
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  font-size: 0.95rem;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-bar-premium input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.search-bar-premium input:focus {
  outline: none;
  border-color: var(--c-accent-primary);
  box-shadow:
    0 0 0 4px rgba(255, 59, 48, 0.1),
    0 8px 24px rgba(0, 0, 0, 0.15);
  background: var(--bg-surface);
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: all 0.3s ease;
  pointer-events: none;
}

.search-bar-premium input:focus ~ .search-icon {
  color: var(--c-accent-primary);
  transform: translateY(-50%) scale(1.1);
}

.search-clear {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background: var(--text-muted);
  color: white;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s ease;
}

.search-bar-premium input:not(:placeholder-shown) ~ .search-clear {
  display: flex;
}

.search-clear:hover {
  background: var(--c-accent-primary);
  transform: translateY(-50%) rotate(90deg);
}

/* Search Dropdown Results */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  backdrop-filter: blur(20px);
}

[data-theme="dark"] .search-results {
  background: rgba(30, 30, 30, 0.95);
}

.search-results.active {
  display: block;
  animation: searchDropdownIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes searchDropdownIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

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

.search-result-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: rgba(255, 59, 48, 0.05);
  padding-left: 20px;
}

.search-result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(
    135deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

.search-result-info {
  flex: 1;
}

.search-result-name {
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.search-result-details {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.search-result-highlight {
  background: rgba(255, 59, 48, 0.2);
  padding: 0 2px;
  border-radius: 2px;
}

.search-empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
}

.search-empty-icon {
  font-size: 3rem;
  margin-bottom: 10px;
  opacity: 0.3;
}

.search-loading {
  padding: 20px;
  text-align: center;
  color: var(--text-muted);
}

.search-loading-spinner {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid var(--border-color);
  border-top-color: var(--c-accent-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Quick Filters */
.quick-filters {
  display: flex;
  gap: 8px;
  margin-top: var(--sp-sm);
  flex-wrap: wrap;
}

.quick-filter-btn {
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.quick-filter-btn:hover {
  background: rgba(255, 59, 48, 0.05);
  border-color: var(--c-accent-primary);
}

.quick-filter-btn.active {
  background: linear-gradient(
    135deg,
    var(--c-accent-primary),
    var(--c-accent-secondary)
  );
  color: white;
  border-color: transparent;
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE & TABLET
   ============================================ */

/* --- Mobile Menu Toggle Button --- */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 200;
  width: 50px;
  height: 50px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--rad-sm);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.mobile-menu-toggle span {
  display: block;
  width: 24px;
  height: 3px;
  background: var(--c-accent-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.mobile-menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* --- Sidebar Overlay for Mobile --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  opacity: 1;
}

/* ============================================
   TABLET BREAKPOINT (768px - 1024px)
   ============================================ */
@media (max-width: 1024px) {
  /* Sidebar collapses automatically on tablet */
  .sidebar {
    width: 80px;
  }

  .sidebar .brand-font,
  .sidebar .sidebar-user-profile .user-info,
  .sidebar .nav-item a span,
  .sidebar .theme-toggle-btn span,
  .sidebar .sidebar-collapse-btn {
    display: none;
  }

  .sidebar .brand-icon {
    display: block !important;
    color: var(--c-accent-primary);
  }

  .sidebar .brand {
    justify-content: center;
    padding-left: 0;
  }

  .sidebar .sidebar-user-profile {
    justify-content: center;
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: var(--sp-xl);
  }

  .sidebar .user-avatar {
    width: 45px;
    height: 45px;
    margin: 0 auto;
  }

  .sidebar .nav-item a {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    background-image: none !important;
    padding: 12px 0;
  }

  .sidebar .nav-item a i {
    display: block;
    font-size: 1.4rem;
  }

  .sidebar .theme-toggle-btn {
    justify-content: center;
    padding: 12px;
  }

  /* Main content adjustments */
  .main-content {
    padding: var(--sp-md);
  }

  /* Metrics grid to 2 columns */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-md);
  }

  /* Vehicle grid adjustments */
  .vehicle-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sp-md);
  }

  /* Header adjustments */
  .header {
    flex-direction: column;
    gap: var(--sp-md);
    align-items: flex-start;
  }

  .header > div:last-child {
    width: 100%;
    display: flex;
    gap: var(--sp-sm);
  }

  .header > div:last-child .btn {
    flex: 1;
  }

  /* Modal adjustments */
  .modal-content {
    width: 95% !important;
    max-width: 700px;
    margin: 20px auto;
  }
}

/* ============================================
   MOBILE BREAKPOINT (< 768px)
   ============================================ */
@media (max-width: 768px) {
  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
  }

  /* Sidebar off-canvas */
  .sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    height: 100%;
    width: 280px;
    z-index: 150;
    transition: left 0.3s ease;
    padding-top: 80px;
    background: var(--bg-surface) !important;
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
  }

  /* Dark theme specific for mobile sidebar */
  [data-theme="dark"] .sidebar {
    background: rgba(10, 10, 10, 0.95) !important;
    backdrop-filter: blur(12px);
  }

  .sidebar.mobile-open {
    left: 0;
  }

  /* Show overlay when sidebar is open */
  .sidebar.mobile-open ~ .sidebar-overlay,
  .sidebar-overlay.active {
    display: block;
  }

  /* Restore sidebar elements for mobile menu */
  .sidebar .brand-font,
  .sidebar .sidebar-user-profile .user-info,
  .sidebar .nav-item a span,
  .sidebar .theme-toggle-btn span {
    display: block;
  }

  .sidebar .brand-icon {
    display: none !important;
  }

  .sidebar .brand {
    padding-left: var(--sp-md);
    justify-content: flex-start;
  }

  .sidebar .sidebar-user-profile {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 12px;
    margin-bottom: 20px;
    justify-content: flex-start;
  }

  .sidebar .user-avatar {
    width: 40px;
    height: 40px;
  }

  /* Sidebar nav links - MOBILE: Same design as PC */
  .sidebar .nav-item a {
    background-image: url("../Assets/barrafondo.svg") !important;
    background-size: 100% auto;
    background-repeat: no-repeat;
    background-position: center;
    padding: 5px 6px;
    padding-left: 27%;
    justify-content: flex-start;
    color: #ffffff !important;
    min-height: 50px;
    display: flex;
    align-items: center;
  }

  .sidebar .nav-item a i {
    display: none !important;
    font-size: 1rem;
    margin-right: 10px;
    color: #ffffff !important;
    /* White icon like PC */
  }

  .sidebar .nav-item a:hover,
  .sidebar .nav-item a.active {
    color: #ffffff !important;
  }

  .sidebar .theme-toggle-btn {
    justify-content: flex-start;
    padding: 12px 16px;
  }

  /* Hide sidebar collapse button on mobile */
  .sidebar-collapse-btn {
    display: none;
  }

  /* Main content full width */
  .main-content {
    margin-left: 0;
    padding: var(--sp-md);
    padding-top: 80px;
  }

  /* Header mobile adjustments */
  .header {
    flex-direction: column;
    gap: var(--sp-md);
    align-items: stretch;
  }

  .header h1 {
    font-size: 1.4rem;
  }

  .header > div:last-child {
    display: flex;
    flex-direction: column;
    gap: var(--sp-sm);
  }

  .header > div:last-child .btn {
    width: 100%;
  }

  /* Metrics grid to 1 column */
  .metrics-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-md);
  }

  .metric-value {
    font-size: 1.8rem;
  }

  /* Charts grid to 1 column */
  .charts-grid {
    grid-template-columns: 1fr;
  }

  /* Vehicle grid to 1 column */
  .vehicle-grid {
    grid-template-columns: 1fr;
    gap: var(--sp-md);
  }

  /* Filter panel improvements */
  .filter-panel {
    margin-bottom: var(--sp-md);
  }

  .filter-content {
    padding: var(--sp-md);
  }

  /* FIXED: Filter checkboxes single column */
  .filter-checkbox-group {
    display: flex !important;
    flex-direction: column !important;
    gap: var(--sp-sm);
  }

  /* Modal full screen on mobile */
  .modal {
    padding: 0;
    overflow-x: hidden;
  }

  .modal-content {
    width: 100% !important;
    max-width: 100vw !important;
    min-height: 100vh;
    border-radius: 0;
    margin: 0;
    max-height: 100vh;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
    padding: var(--sp-lg) !important;
  }

  /* Mobile Fix for Generic Confirmation Modal (Delete/Alerts) */
  #appGenericModal .modal-content {
    height: 70vh !important;
    min-height: 0 !important;
    max-height: 70vh !important;
    margin: auto !important; /* Centers vertically with flex parent */
    border-radius: var(--rad-lg) !important; /* Restore rounded corners */
    width: 90% !important; /* Add some side spacing */
    max-width: 350px !important;
  }

  /* Fix form-grid on mobile to prevent overflow */
  .modal-content .form-grid,
  .modal-content .three-col-grid,
  .modal-content .add-vehicle-grid {
    grid-template-columns: 1fr !important;
    gap: var(--sp-sm);
  }

  /* Ensure form inputs don't overflow - but don't restrict containers */
  .modal-content input[type="text"],
  .modal-content input[type="number"],
  .modal-content input[type="email"],
  .modal-content input[type="tel"],
  .modal-content input[type="date"],
  .modal-content input[type="file"],
  .modal-content select,
  .modal-content textarea,
  .modal-content .input-field {
    width: 100%;
    box-sizing: border-box;
  }

  /* Fix modal header to prevent overflow */
  .modal-header {
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
  }

  .modal-header h2 {
    font-size: 1.2rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Fix modal footer buttons on mobile */
  .modal-footer {
    width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
  }

  /* Fix signature canvas on mobile */
  .modal-content canvas {
    max-width: 100% !important;
    width: 100% !important;
    height: auto !important;
    touch-action: none;
    display: block;
  }

  /* Signature canvas container specific fixes */
  .modal-content canvas[id*="signature"],
  .modal-content canvas[id*="Signature"] {
    max-width: 100% !important;
    width: 100% !important;
    height: 150px !important;
    box-sizing: border-box;
  }

  /* Ensure buttons are visible and properly sized */
  .modal-content .btn {
    min-width: auto;
    white-space: nowrap;
  }

  /* Fix vehicle detail modal specific layout */
  .vehicle-detail-grid {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Fix add vehicle modal specific layout */
  .add-vehicle-grid {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Fix add vehicle modal button layout on mobile */
  #addVehicleModal .modal-body \u003e div:last-child {
    flex-direction: column !important;
    gap: var(--sp-sm) !important;
  }

  #addVehicleModal .modal-body \u003e div:last-child \u003e button:first-child {
    width: 100% !important;
  }

  #addVehicleModal .modal-body \u003e div:last-child \u003e div {
    width: 100% !important;
    justify-content: stretch !important;
  }

  #addVehicleModal .modal-body \u003e div:last-child \u003e div \u003e button {
    flex: 1 !important;
  }

  /* Form adjustments */
  .form-group {
    margin-bottom: var(--sp-md);
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    font-size: 16px;
    /* Prevents zoom on iOS */
    padding: 12px;
  }

  /* Button touch targets */
  .btn {
    padding: 14px 20px;
    font-size: 0.85rem;
  }

  /* FIXED: Tables responsive with container scroll */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    display: table;
    min-width: 600px;
  }

  th,
  td {
    padding: 12px 8px;
    font-size: 0.85rem;
    white-space: nowrap;
  }

  /* Cards touch-friendly */
  .card {
    padding: var(--sp-md);
  }

  /* Vehicle card adjustments */
  .vehicle-card .vehicle-image {
    height: 180px;
  }

  /* Analysis section adjustments */
  .analysis-section {
    padding: var(--sp-md);
  }

  /* Pin modal mobile */
  .pin-modal-card {
    width: 95%;
    max-width: 350px;
  }

  /* Customer/CRM cards */
  .customer-card {
    flex-direction: column;
    text-align: center;
  }

  .customer-avatar {
    margin: 0 auto var(--sp-sm);
  }

  /* Pricing recommendation cards */
  .pricing-recommendation-card {
    padding: var(--sp-md);
  }

  .pricing-card-header {
    flex-direction: column;
    gap: var(--sp-sm);
  }

  .pricing-actions {
    flex-direction: column;
  }

  .pricing-actions .btn {
    width: 100%;
  }

  /* NFC Modal mobile */
  .nfc-assigned-card {
    flex-direction: column;
    text-align: center;
  }

  .qr-link-input {
    flex-direction: column;
  }

  /* Consignaciones table mobile */
  .consignacion-row {
    flex-direction: column;
    gap: var(--sp-sm);
  }

  /* FIXED: CRM layout stack vertically */
  .crm-layout {
    flex-direction: column !important;
  }

  .customer-list-section {
    width: 100% !important;
    max-width: 100% !important;
  }

  .leads-sidebar {
    width: 100% !important;
    max-width: 100% !important;
    margin-top: var(--sp-md);
  }

  /* Finance summary mobile */
  .finance-summary-grid {
    grid-template-columns: 1fr !important;
  }

  /* Top bar mobile */
  .top-bar {
    flex-direction: column;
    width: 100%;
  }

  .top-bar .btn {
    width: 100%;
  }

  /* FIXED: Vehicle detail modal stack vertically */
  #detailModal .modal-content > div:first-of-type {
    flex-direction: column !important;
  }

  #detailModal .modal-content > div:first-of-type > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  .vehicle-detail-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ============================================
   SMALL MOBILE BREAKPOINT (< 480px)
   ============================================ */
@media (max-width: 480px) {
  .header h1 {
    font-size: 1.2rem;
  }

  .metric-value {
    font-size: 1.5rem;
  }

  .brand-font {
    font-size: 1rem;
  }

  /* Smaller padding on very small screens */
  .main-content {
    padding: var(--sp-sm);
    padding-top: 70px;
  }

  .card {
    padding: var(--sp-sm);
  }

  .modal-content {
    padding: var(--sp-md);
  }

  /* Mobile menu button smaller */
  .mobile-menu-toggle {
    width: 45px;
    height: 45px;
    top: 12px;
    left: 12px;
  }

  /* Two column grids on very small */
  .specs-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-sm);
  }

  .spec-item {
    padding: var(--sp-sm);
  }

  .spec-label {
    font-size: 0.7rem;
  }

  .spec-value {
    font-size: 0.9rem;
  }
}

/* ============================================
   TOUCH DEVICE OPTIMIZATIONS
   ============================================ */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .card:hover {
    transform: none;
  }

  .btn:hover {
    transform: none;
  }

  .nav-item a:hover {
    transform: none;
  }

  /* Larger touch targets */
  .nav-item a {
    min-height: 54px;
  }

  .btn {
    min-height: 48px;
  }

  /* Remove hover animations (Mainly the shine effect) */
  .card::before {
    display: none;
  }
}

/* ============================================
   LANDSCAPE MOBILE
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
  }

  .main-content {
    padding-top: 60px;
  }

  .mobile-menu-toggle {
    top: 10px;
    left: 10px;
    width: 40px;
    height: 40px;
  }
}

/* ============================================
   SAFE AREA INSETS (for notched phones)
   ============================================ */
@supports (padding: max(0px)) {
  .main-content {
    padding-left: max(var(--sp-md), env(safe-area-inset-left));
    padding-right: max(var(--sp-md), env(safe-area-inset-right));
    padding-bottom: max(var(--sp-md), env(safe-area-inset-bottom));
  }

  .sidebar {
    padding-left: max(var(--sp-lg), env(safe-area-inset-left));
  }
}

/* ============================================
   PRINT STYLES (bonus)
   ============================================ */
@media print {
  .sidebar,
  .mobile-menu-toggle,
  .sidebar-overlay,
  .btn {
    display: none !important;
  }

  .main-content {
    margin: 0;
    padding: 0;
  }

  .card {
    break-inside: avoid;
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* ============================================
   APP VERSION FOOTER
   ============================================ */
.app-footer {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--rad-md);
  padding: 12px 16px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: auto;
}

.app-footer a {
  color: var(--c-accent-primary);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

.app-footer a:hover {
  color: var(--c-accent-secondary);
  text-decoration: underline;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .app-footer {
    font-size: 0.7rem;
    padding: 10px 12px;
  }
}

/* ============================================
   TOAST NOTIFICATIONS (NEW)
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 10000;
  pointer-events: none;
}

.toast-notification {
  pointer-events: auto;
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--c-accent-primary);
  padding: 15px 20px;
  border-radius: var(--rad-sm);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 15px;
  min-width: 300px;
  max-width: 400px;
  animation: slideInRight 0.3s ease-out forwards;
  backdrop-filter: blur(10px);
}

.toast-notification.success {
  border-left-color: #4cd964;
}

.toast-notification.error {
  border-left-color: #ff3b30;
}

.toast-notification.info {
  border-left-color: var(--c-accent-secondary);
}

.toast-icon {
  font-size: 1.2rem;
}

.toast-notification.success .toast-icon {
  color: #4cd964;
}

.toast-notification.error .toast-icon {
  color: #ff3b30;
}

.toast-notification.info .toast-icon {
  color: var(--c-accent-secondary);
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: bold;
  font-size: 0.95rem;
  margin-bottom: 2px;
  display: block;
}

.toast-message {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 5px;
}

.toast-close:hover {
  color: var(--text-main);
}

.toast-notification.hiding {
  animation: fadeOutRight 0.3s ease-in forwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }

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

@keyframes fadeOutRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* Input Autofill Fix */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #111 inset !important;
  -webkit-text-fill-color: white !important;
  caret-color: white !important;
  transition: background-color 5000s ease-in-out 0s;
}

/* 
   --- Animated Gradient Dots Background --- 
*/
:root {
  --gd-dot-size: 8px;
  --gd-spacing: 10px;
  --gd-hex-spacing: 17.32px;
  /* 10 * 1.732 */
  --gd-blob-1: #ea002b;
  /* Rojo */
  --gd-blob-2: #002a60;
  /* Azul */
  --gd-blob-3: #ea002b;
  /* Rojo */
  --gd-blob-4: #002a60;
  /* Azul */
  --gd-duration: 30s;
  --gd-color-cycle: 6s;
}

.gradient-dots-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  background-color: var(--bg-base);
  background-image:
    radial-gradient(
      circle at 50% 50%,
      transparent 1.5px,
      var(--bg-base) 0 var(--gd-dot-size),
      transparent var(--gd-dot-size)
    ),
    radial-gradient(
      circle at 50% 50%,
      transparent 1.5px,
      var(--bg-base) 0 var(--gd-dot-size),
      transparent var(--gd-dot-size)
    ),
    radial-gradient(circle at 50% 50%, var(--gd-blob-1), transparent 60%),
    radial-gradient(circle at 50% 50%, var(--gd-blob-2), transparent 60%),
    radial-gradient(circle at 50% 50%, var(--gd-blob-3), transparent 60%),
    radial-gradient(ellipse at 50% 50%, var(--gd-blob-4), transparent 60%);

  background-size:
    var(--gd-spacing) var(--gd-hex-spacing),
    var(--gd-spacing) var(--gd-hex-spacing),
    200% 200%,
    200% 200%,
    200% 200%,
    200% var(--gd-hex-spacing);

  background-position:
    0px 0px,
    calc(var(--gd-spacing) / 2) calc(var(--gd-hex-spacing) / 2),
    800% 400%,
    1000% -400%,
    -1200% -600%,
    400% var(--gd-hex-spacing);

  animation:
    gradientDotsMove var(--gd-duration) linear infinite,
    gradientDotsColor var(--gd-color-cycle) linear infinite;
  pointer-events: none;
  transition:
    background-color 0.3s ease,
    opacity 0.3s ease;
  opacity: 0.2;
  /* Faint in light mode for better contrast */
}

/* Restore fuller opacity in dark mode if needed, or keep it consistent */
[data-theme="dark"] .gradient-dots-bg {
  opacity: 0.6;
}

@keyframes gradientDotsMove {
  0% {
    background-position:
      0px 0px,
      calc(var(--gd-spacing) / 2) calc(var(--gd-hex-spacing) / 2),
      800% 400%,
      1000% -400%,
      -1200% -600%,
      400% var(--gd-hex-spacing);
  }

  100% {
    background-position:
      0px 0px,
      calc(var(--gd-spacing) / 2) calc(var(--gd-hex-spacing) / 2),
      0% 0%,
      0% 0%,
      0% 0%,
      0% 0%;
  }
}

@keyframes gradientDotsColor {
  0% {
    filter: hue-rotate(0deg);
  }

  100% {
    filter: hue-rotate(360deg);
  }
}

/* --- Skeleton Loading States --- */
@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.skeleton {
  background: #e0e0e0;
  background-image: linear-gradient(
    90deg,
    #e0e0e0 25%,
    #f0f0f0 50%,
    #e0e0e0 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: var(--rad-sm);
}

[data-theme="dark"] .skeleton {
  background: #2a2a2a;
  background-image: linear-gradient(
    90deg,
    #2a2a2a 25%,
    #333333 50%,
    #2a2a2a 75%
  );
}

.skeleton-card {
  height: 100%;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--rad-md);
  padding: var(--sp-md);
  margin-bottom: var(--sp-md);
}

/* Specific Element Skeletons */
.skeleton-img {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--rad-sm);
  background-color: #ddd;
}

[data-theme="dark"] .skeleton-img {
  background-color: #333;
}

.skeleton-text {
  height: 14px;
  width: 100%;
  margin-bottom: 4px;
}

.skeleton-title {
  height: 24px;
  width: 70%;
  margin-bottom: 10px;
}

.skeleton-btn {
  height: 36px;
  width: 100px;
  border-radius: var(--rad-sm);
}

.skeleton-row {
  height: 50px;
  width: 100%;
  margin-bottom: 10px;
  border-radius: var(--rad-sm);
}
/* Modal Global Styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(5px);
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  padding: var(--sp-lg);
  border-radius: var(--rad-md);
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  position: relative;
  animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.close-modal-btn:hover {
  color: var(--c-accent-primary);
  transform: scale(1.1);
}

/* === RESPONSIVE MODAL GRIDS === */

/* Standard 2-column form grid */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* Vehicle Add Modal Grid */
.add-vehicle-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 30px;
}

/* Vehicle Detail Modal Grid */
.vehicle-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

/* 3-Column Grid for details */
.three-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 15px;
}

/* 2-Column Grid for details */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* MOBILE RESPONSIVENESS (< 768px) */
@media (max-width: 768px) {
  .form-grid,
  .vehicle-detail-grid,
  .add-vehicle-grid {
    grid-template-columns: 1fr !important; /* Stack vertically */
    gap: 15px;
  }

  .three-col-grid,
  .two-col-grid {
    grid-template-columns: 1fr !important;
  }

  /* Adjust image preview height in add modal on mobile */
  .add-vehicle-grid > div:first-child > div:first-child {
    height: 200px !important;
  }

  /* Make modal content full width on mobile */
  .modal-content {
    width: 95% !important;
    max-width: 95% !important;
    padding: var(--sp-md) !important;
    margin: 10px auto;
  }

  /* Adjust specific modal widths if they are set inline */
  #vehicleDetailModal .modal-content,
  #extrasModal .modal-content,
  #newTransactionModal .modal-content,
  #addCustomerModal .modal-content {
    width: 95% !important;
    max-width: 95% !important;
  }

  /* Stack radio groups */
  .add-vehicle-grid .radio-group-container {
    grid-template-columns: 1fr !important;
  }

  /* FIX: Ensure inputs in add vehicle modal don't overflow */
  #addVehicleModal input,
  #addVehicleModal select,
  #addVehicleModal textarea {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}

/* --- Global Loader (Modal Style) --- */
#global-loader {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6); /* Semi-transparent overlay */
  backdrop-filter: blur(5px);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
}

#global-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-content {
  background: var(--bg-surface);
  padding: 30px;
  border-radius: var(--rad-md);
  border: 1px solid var(--border-color);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  max-width: 90%;
  width: 320px;
  text-align: center;
}

.loader-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 5px;
  transition: color 0.3s;
}

.loader-close-btn:hover {
  color: var(--c-accent-primary);
}

.loader-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(128, 128, 128, 0.2);
  border-left-color: var(--c-accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 20px;
}

.loader-text {
  font-family: "Michroma", sans-serif;
  color: var(--text-main);
  font-size: 1rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 5px;
  /* Removed pulse animation for cleaner text */
}

.loader-subtext {
  font-size: 0.8rem;
  color: var(--text-muted);
}

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

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Transaction Progress Modal */
#transactionProgressModal .modal-content {
  background: var(--bg-surface);
  border: 2px solid var(--c-accent-primary);
  box-shadow: 0 0 40px rgba(234, 0, 43, 0.2);
  position: relative;
  overflow: hidden;
}

#transactionProgressModal .modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--c-accent-primary);
}

.progress-bar-container {
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#progressBar {
  position: relative;
}

#progressBar::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background-image: linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.2) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 75%,
    transparent
  );
  z-index: 1;
  background-size: 50px 50px;
  animation: move 2s linear infinite;
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
  border-top-left-radius: 20px;
  border-bottom-left-radius: 20px;
  overflow: hidden;
}

@keyframes move {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 50px 50px;
  }
}

/* --- Performance Mode (Low Resources) --- */
[data-performance="low"] *,
[data-performance="low"] *::before,
[data-performance="low"] *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0s !important;
  scroll-behavior: auto !important;
}

[data-performance="low"] .gradient-dots-bg,
[data-performance="low"] .bg-carbon::after {
  display: none !important;
}

[data-performance="low"] {
  --glass-blur: 0px !important;
}

