:root {
  --color-principal: #1f2225;
  --color-secundario: #127F96;
  --color-resaltado: #55d3f7;
  --color-fondo: #f7f7f7;
  --color-boton-hover: #0056b3;

  --z-modal: 10000;
  --z-header: 1000;
  --z-search: 900;

  --transicion: 0.3s ease;
}

body, html {
  max-width: 100%;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--color-fondo);
  color: #333;
}

/* =========================================================
   HEADER
   ========================================================= */
header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem clamp(1rem, 4vw, 1.5rem);
  min-height: 80px;
  background: var(--color-principal);
  color: white;
  z-index: var(--z-header);
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Logo */
.logo img {
  height: 50px;
  max-width: 100%;
  max-height: 60px;
  transition: transform var(--transicion);
}
.logo img:hover {
  transform: scale(1.05);
}

/* Slogan */
.slogan {
  text-align: center;
  color: var(--color-resaltado);
  flex: 1 1 100%;
  order: 2;
}
.slogan h1 {
  font-size: 1.1rem;
  font-family: 'Orbitron', sans-serif;
  font-weight: bold;
  color: var(--color-resaltado);
  margin: 0;
}
.slogan p {
  font-size: 0.9rem;
  font-family: 'Orbitron', sans-serif;
  color: white;
  margin: 5px 0 0 0;
}

/* Botón de contacto */
#contactBtn {
  background-color: var(--color-secundario); 
  border: none; 
  padding: 10px 15px; 
  color: white; 
  font-weight: bold; 
  border-radius: 5px; 
  cursor: pointer;
  transition: background-color var(--transicion), transform var(--transicion);
  order: 3;
}
#contactBtn:hover {
  background-color: var(--color-boton-hover);
  transform: scale(1.05);
}

/* =========================================================
   MODAL DE CONTACTO
   ========================================================= */
.modal {
  display: none;
  position: fixed;
  z-index: var(--z-modal);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
}
.modal-content {
  background-color: white;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  position: relative;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
  animation: aparecer 0.4s ease forwards;
}
@keyframes aparecer {
  from { opacity: 0; transform: scale(0.9);}
  to { opacity: 1; transform: scale(1);}
}
.close {
  color: #aaa;
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color var(--transicion);
}
.close:hover {
  color: black;
}

/* Links de contacto */
.social-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.social-links li {
  margin-bottom: 10px;
}
.social-links a {
  text-decoration: none;
  color: #000;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: color var(--transicion);
}
.social-links a:hover {
  color: var(--color-secundario);
}
.social-links i {
  font-size: 14px;
}

/* =========================================================
   BARRA DE BÚSQUEDA
   ========================================================= */
.search-bar {
  position: fixed;
  top: 70px;
  width: 100%;
  background: var(--color-fondo);
  padding: 1rem;
  text-align: center;
  z-index: var(--z-search);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.search-bar input {
  padding: 0.5rem;
  margin-top: 10px;
  width: 50%;
  max-width: 400px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.search-bar button {
  padding: 0.5rem 1rem;
  margin-left: 0.5rem;
  border: none;
  background: #2979ff;
  color: white;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color var(--transicion), transform var(--transicion);
}
.search-bar button:hover {
  background-color: #1c54b2;
  transform: scale(1.05);
}

/* =========================================================
   BANNER
   ========================================================= */
.full-width-link {
  text-decoration: none;
  display: block;
}
.full-width-banner {
  width: 100%;
  background-image: url("Imagenes/bannerformulario.jpeg"); 
  background-size: cover;
  background-position: center;
  color: white;
  padding: 40px 20px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color var(--transicion);
  margin-top: 145px;
  border-radius: 12px;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.8);
}
.full-width-banner:hover {
  background-color: rgba(0, 0, 0, 0.2);
}
.banner-text {
  max-width: 600px;
}
.banner-text h2 {
  margin: 0 0 10px;
}
.banner-text p {
  margin: 0 0 10px;
}
.banner-text span {
  text-decoration: underline;
}

/* =========================================================
   FILTROS Y LISTADO
   ========================================================= */
.main {
  display: flex;
  padding: 0.5rem;
  gap: 2rem;
  margin-top: 20px;
  flex-wrap: wrap;
}
.filters {
  position: sticky;
  top: 140px;
  flex: 1;
  max-width: 250px;
  background: white;
  padding: 1rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  height: fit-content;
  align-self: start;
}
.filter-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}
.filter-group label {
  margin-bottom: 0.1rem;
  font-weight: bold;
}
.filter-group input,
.filter-group select {
  padding: 0.4rem;
  border: 1px solid #ccc;
  border-radius: 4px;
}
.filter-button,
.reset-button {
  width: 100%;
  color: white;
  border: none;
  padding: 0.7rem;
  border-radius: 4px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color var(--transicion);
}
.filter-button {
  background: #2979ff;
}
.filter-button:hover {
  background-color: #1c54b2;
}
.reset-button {
  background: grey;
}
.reset-button:hover {
  background-color: #5a6268;
}

/* Contenido de coches */
.car-list {
  flex: 3;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
}
.car-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  padding: 1rem;
  transition: transform var(--transicion), box-shadow var(--transicion);
}
.car-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.car-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
}
.image-carousel {
  position: relative;
}
.carousel-controls {
  position: absolute;
  top: 50%;
  width: 100%;
  display: flex;
  justify-content: space-between;
  transform: translateY(-50%);
}
.carousel-controls button {
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  font-size: 1.2rem;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  transition: background-color var(--transicion);
}
.carousel-controls button:hover {
  background: rgba(0,0,0,0.7);
}
.modal-content.car-detail-modal {
  max-width: 900px;
  width: 90%;
}
.car-card table {
  width: 100%;
  border-collapse: collapse;
  text-align: center;
  margin: 10px 0;
}
.car-card table td {
  border: 1px solid #ddd; 
  padding: 6px 8px;
  font-size: 0.9em;
  vertical-align: middle;
}
.car-card table tr:first-child td {
  border-top: 1px solid #ddd;
}
.btn-ver-detalles {
  display: block;      
  margin: 10px auto 0;     
  padding: 0;              
  background: none;        
  border: none;            
  color: var(--color-secundario);           
  font-size: 0.9em;        
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline; 
  width: fit-content;      
  transition: color 0.3s ease;
}
.btn-ver-detalles:hover {
  color: #0056b3;          
  text-decoration: none;   
}


/* =========================================================
   FOOTER
   ========================================================= */
footer {
  background-color: var(--color-principal);
  color: #fff;
  text-align: center;
  padding: 20px 10px;
}
footer .container {
  display: flex;
  flex-direction: column;
  align-items: center;
}
footer p {
  margin: 5px 0;
  font-size: 14px;
}
footer nav ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  justify-content: center;
}
footer nav a {
  color: #ccc;
  text-decoration: none;
  font-size: 14px;
  transition: color var(--transicion);
}
footer nav a:hover {
  color: #fff;
  text-decoration: underline;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
  .main {
    flex-direction: column; /* apilar verticalmente en móvil */
  }

  .filters {
    max-width: none;  /* quitar max-width para que ocupe todo */
    width: 100%;
  }
}

/* Header pantallas grandes */
@media (min-width: 769px) {
  header {
    flex-wrap: nowrap;
    height: 80px;
  }
  .slogan {
    flex: 1;
    order: 0;
  }
}

/* Header pantallas pequeñas */
@media (max-width: 768px) {
  header {
    justify-content: center;
    text-align: center;
    padding: 10px;
  }
  .logo {
    flex: 1 1 100%;
    text-align: center;
    margin-bottom: 10px;
  }
  .slogan {
    order: 2;
    flex: 1 1 100%;
    margin-bottom: 10px;
  }
  #contactBtn {
    order: 3;
    width: auto;
    margin: 0 auto;
  }
}

/* Modal */
@media (max-width: 600px) {
  .modal-content {
    width: 75%;
    padding: 15px;
    font-size: 14px;
  }
  .modal-close {
    top: 5px;
    right: 10px;
    font-size: 1.2rem;
  }
}

/* Barra de búsqueda */
@media (max-width: 768px) {
  .search-bar {
    top: 160px; 
    padding: 10px;
    background: #f7f7f7;
    display: flex;
    justify-content: center;
    gap: 8px;
  }
  .search-bar input {
    flex: 1;                    
    max-width: none;
    margin-right: 0;
    box-sizing: border-box;
  }
  .search-bar button {
    flex: 0 0 30%;
    max-width: 120px;
    padding: 8px;
    margin-top: 10px;
    margin-right: 20px;
  }
}

@media (max-width: 480px) {
  .search-bar {
    top: 165px; 
  }
}

/* Filtros */
@media (max-width: 480px) {
  input, select, button {
    width: 100%;
    box-sizing: border-box;
  }
}

.toggle-filters-btn {
  display: none;
  width: auto;
  max-width: none;
  margin: 0 auto;
  background: none;            /* sin fondo */
  color: var(--color-secundario);
  border: none;               /* sin borde */
  padding: 0;                 /* sin padding */
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
  box-shadow: none;           /* sin sombra */
  text-decoration: underline; /* subrayado para que parezca enlace */
  transition: color 0.3s ease, transform 0.2s ease;
  position: relative;
}

.toggle-filters-btn::after {
  position: absolute;
  right: -20px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  transition: transform 0.3s ease;
  color: var(--color-secundario);
}

.toggle-filters-btn.active::after {
  transform: translateY(-50%) rotate(180deg); /* flecha arriba */
}

@media (max-width: 768px) {
  .toggle-filters-btn {
  display: block;  /* botón a la izquierda */
  text-align: left;
  cursor: pointer;
  color: var(--color-secundario);
  background: none;
  border: none;
  padding: 0;
  font-weight: 600;
  text-decoration: underline;
  margin-bottom: 8px; /* separa el botón del filtro */
  position: relative;
}

  .filters {
  display: none;
  width: 90%;
  max-width: 400px;
  margin: 10px auto 0 auto;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.95); /* blanco casi sólido */
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(0,0,0,0.1);
  backdrop-filter: blur(8px); /* efecto desenfoque suave */
  transition: all 0.3s ease-in-out;
  transform-origin: top center;
  /* Animación inicial para que crezca */
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}
  .filters.open {
    display: block;
    opacity: 1;
    transform: scale(1);
    pointer-events: auto;
  }
}


/* Banner */
@media (max-width: 768px) {
  .full-width-banner {
    margin-top: 200px; 
  }
}

@media (max-width: 480px) {
  .full-width-banner {
    margin-top: 229px; 
  }
}

/* Modal de coches */
@media (max-width: 600px) {
  .modal-content.car-modal-content {
    width: 90%;
    max-width: 100%;
    margin: 20px;
  }
}

/* Footer */
@media (max-width: 768px) {
  .container {
    width: 100%;
  }
}
