/* ==================== COCHE.CSS – Mi Coche (GPS & Aparcamiento) ==================== */

:root {
  --color-principal: #3b82f6;

  --coche-bg: #f5f5f7;
  --coche-card: #ffffff;
  --coche-text: #1c1c1e;
  --coche-text-secondary: #8e8e93;

  /* DINÁMICOS */
  --coche-accent: var(--color-principal);

  --coche-accent-dark:
    color-mix(in srgb, var(--color-principal) 80%, black);

  --coche-accent-light:
    color-mix(in srgb, var(--color-principal) 15%, white);

  --coche-danger: #ef4444;

  --coche-danger-light:
    color-mix(in srgb, #ef4444 15%, white);

  --coche-success:
    color-mix(in srgb, var(--color-principal) 60%, limegreen);

  --coche-border:
    color-mix(in srgb, var(--color-principal) 12%, #dcdcdc);

  --coche-shadow:
    0 4px 24px color-mix(in srgb, var(--color-principal) 12%, transparent);

  --coche-shadow-sm:
    0 2px 12px color-mix(in srgb, var(--color-principal) 8%, transparent);

  --coche-radius: 28px;
  --coche-radius-sm: 20px;
  --coche-radius-xs: 16px;
}

/* ==================== OVERLAY ==================== */
.coche-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--coche-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: cocheFadeIn 0.35s ease;
}

@keyframes cocheFadeIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

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

/* ==================== HEADER ==================== */
.coche-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--coche-card);
  border-bottom: 1px solid var(--coche-border);
  flex-shrink: 0;
}

.coche-btn-volver,
.coche-btn-config {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--coche-text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.coche-btn-volver:hover,
.coche-btn-config:hover {
  background: var(--coche-bg);
}

.coche-header-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.coche-header-titulo i {
  font-size: 1.3rem;
  color: var(--coche-accent);
}

.coche-header-titulo h1 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--coche-text);
  margin: 0;
  letter-spacing: -0.3px;
}

/* ==================== CONTENIDO ==================== */
.coche-contenido {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ==================== MAPA ==================== */
.coche-mapa-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
}

.coche-mapa {
  width: 100%;
  height: 100%;
  background: #e8e8e8;
}

.coche-mapa-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--coche-text-secondary);
  font-size: 1rem;
}

/* ==================== INDICADOR DE POSICIÓN ==================== */
.coche-pos-indicator {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  padding: 10px 16px;
  border-radius: 50px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--coche-text);
  box-shadow: var(--coche-shadow-sm);
  z-index: 500;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.coche-pos-dot {
  width: 10px;
  height: 10px;
  background: var(--coche-success);
  border-radius: 50%;
  position: relative;
}

.coche-pos-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--coche-success);
  opacity: 0.3;
  animation: cochePulse 2s infinite;
}

@keyframes cochePulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 0.3;
  }

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

/* ==================== BOTÓN CENTRAR ==================== */
.coche-centrar-btn {
  position: absolute;
  bottom: 20px;
  right: 16px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: var(--coche-card);
  color: var(--coche-text);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--coche-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  transition: all 0.2s;
}

.coche-centrar-btn:hover {
  background: var(--coche-accent);
  color: white;
  transform: scale(1.08);
}

/* ==================== INSTRUCCIÓN ==================== */
.coche-instruccion {
  padding: 20px 24px 8px;
  text-align: center;
  flex-shrink: 0;
}

.coche-instruccion p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--coche-text-secondary);
  line-height: 1.5;
}

/* ==================== ACCIÓN PRINCIPAL ==================== */
.coche-accion-principal {
  padding: 12px 24px 28px;
  flex-shrink: 0;
}

.coche-btn-aparcar {
  width: 100%;
  padding: 18px 24px;
  border: none;
  border-radius: var(--coche-radius-sm);
  background: var(--coche-accent);
  color: white;
  font-size: 1.05rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.3px;
}

.coche-btn-aparcar:hover {
  background: var(--coche-accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(59, 130, 246, 0.45);
}

.coche-btn-aparcar:active {
  transform: translateY(0);
}

.coche-btn-aparcar i {
  font-size: 1.3rem;
}

/* ==================== ESTADO APARCADO ==================== */
.coche-info-aparcado {
  padding: 16px 20px 24px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.coche-info-card {
  background: var(--coche-card);
  border-radius: var(--coche-radius-sm);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--coche-shadow-sm);
  border-left: 4px solid var(--coche-accent);
}

.coche-info-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--coche-radius-xs);
  background: var(--coche-accent-light);
  color: var(--coche-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.coche-info-detalles {
  flex: 1;
  min-width: 0;
}

.coche-info-fecha {
  font-size: 0.95rem;
  color: var(--coche-text);
  line-height: 1.4;
  margin-bottom: 4px;
}

.coche-info-fecha strong {
  color: var(--coche-accent-dark);
  font-weight: 700;
}

.coche-info-tiempo {
  font-size: 0.85rem;
  color: var(--coche-text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.coche-info-tiempo i {
  color: var(--coche-accent);
}

/* ==================== BOTÓN RUTA ==================== */
.coche-btn-ruta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 24px;
  border-radius: var(--coche-radius-sm);
  background: var(--coche-accent);
  color: white;
  font-size: 1.05rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
  transition: all 0.25s;
  cursor: pointer;
  border: none;
  letter-spacing: 0.3px;
}

.coche-btn-ruta:hover {
  background: var(--coche-accent-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(59, 130, 246, 0.45);
}

.coche-btn-ruta i {
  font-size: 1.3rem;
}

/* ==================== ACCIONES SECUNDARIAS ==================== */
.coche-acciones-secundarias {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.coche-btn-mover,
.coche-btn-borrar {
  padding: 14px;
  border-radius: var(--coche-radius-xs);
  border: 1.5px solid var(--coche-border);
  background: var(--coche-card);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.coche-btn-mover {
  color: var(--coche-text);
}

.coche-btn-mover:hover {
  border-color: var(--coche-accent);
  color: var(--coche-accent);
  background: var(--coche-accent-light);
}

.coche-btn-borrar {
  color: var(--coche-danger);
  border-color: var(--coche-danger-light);
}

.coche-btn-borrar:hover {
  background: var(--coche-danger);
  color: white;
  border-color: var(--coche-danger);
}

/* ==================== MOVER COCHE ==================== */
.coche-mapa-mover {
  position: relative;
}

.coche-mover-overlay {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
}

.coche-mover-instruccion {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  color: white;
  padding: 12px 20px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  animation: cocheSlideDown 0.4s ease;
}

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

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

.coche-mover-acciones {
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
}

.coche-btn-primario {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: var(--coche-radius-sm);
  background: var(--coche-accent);
  color: white;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.coche-btn-primario:hover {
  background: var(--coche-accent-dark);
  transform: translateY(-1px);
}

.coche-btn-secundario {
  width: 100%;
  padding: 14px;
  border: 1.5px solid var(--coche-border);
  border-radius: var(--coche-radius-sm);
  background: var(--coche-card);
  color: var(--coche-text-secondary);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s;
}

.coche-btn-secundario:hover {
  border-color: var(--coche-danger);
  color: var(--coche-danger);
  background: var(--coche-danger-light);
}

/* ==================== MARCADORES PERSONALIZADOS (Leaflet) ==================== */
.coche-user-marker {
  background: transparent !important;
  border: none !important;
}

.coche-user-pin {
  width: 16px;
  height: 16px;
  background: var(--coche-accent);
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
}

.coche-user-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: var(--coche-accent);
  opacity: 0.2;
  animation: cocheUserPulse 2s infinite;
}

@keyframes cocheUserPulse {
  0% {
    transform: scale(1);
    opacity: 0.3;
  }

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

.coche-marker {
  background: transparent !important;
  border: none !important;
}

.coche-pin {
  width: 44px;
  height: 44px;
  background: var(--coche-accent);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
  border: 3px solid white;
}

.coche-pin i {
  transform: rotate(45deg);
  color: white;
  font-size: 1.1rem;
}

.coche-marker-dragging .coche-pin {
  animation: cocheBounce 1s infinite;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

@keyframes cocheBounce {

  0%,
  100% {
    transform: rotate(-45deg) translateY(0);
  }

  50% {
    transform: rotate(-45deg) translateY(-6px);
  }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 480px) {
  .coche-header-titulo h1 {
    font-size: 1rem;
  }

  .coche-btn-aparcar,
  .coche-btn-ruta {
    font-size: 0.95rem;
    padding: 16px 20px;
  }

  .coche-info-card {
    padding: 16px;
  }

  .coche-info-icon {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .coche-acciones-secundarias {
    gap: 8px;
  }

  .coche-btn-mover,
  .coche-btn-borrar {
    font-size: 0.85rem;
    padding: 12px;
  }
}