/* Estilos Generales */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: white;
    color: #333;
}

header {
    background-color: red;
    color: black;
    text-align: center;
    padding: 0.5rem;
}

/* Rejilla de Coches */
.catalogo {
    display: grid;
    /* min(100%, 300px) evita que la columna sea más ancha que la pantalla en móviles pequeños */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    gap: 20px;
    padding: 40px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Tarjeta de cada Coche */
.tarjeta-coche {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
    background-color: black;
    color: white;
}

.tarjeta-coche img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.info {
    padding: 15px;
}

.precio {
    color: #e44d26;
    font-weight: bold;
    font-size: 1.2rem;
}

/* Ventana Emergente (Landing de detalles) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    justify-content: center;
    align-items: center;
}

.modal-contenido {
    background-color: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;      /* si el contenido no cabe, se hace scroll dentro del modal */
    overflow-y: auto;
    position: relative;
    text-align: center;
}

.modal-contenido img {
    width: 100%;
    max-height: 350px;
    object-fit: cover;
    border-radius: 6px;
    margin: 15px 0;
}

.cerrar {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
}

/* Botones de acción */
.btn-contacto {
    display: inline-block;
    background-color: #25D366;
    color: white;
    padding: 12px 20px;
    text-decoration: none;
    border-radius: 5px;
    font-weight: bold;
    margin-top: 15px;
}

/* Botones flotantes abajo a la derecha */
.contacto-fijo {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

.contacto-fijo a {
    padding: 12px 20px;
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Estilos específicos para cada botón flotante */
.btn-email {
    background-color: #007bb6;
}

.btn-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.btn-tiktok {
    background-color: #010101;
    border-left: 3px solid #00f2ea;
    border-right: 3px solid #ff0050;
}

/* Contenedor del carrusel dentro de la tarjeta */
.contenedor-carrusel {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.tarjeta-coche img.img-carrusel {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Flechas del carrusel */
.flecha-carrusel {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.4);
    color: white;
    border: none;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 16px;
    z-index: 10;
    transition: background-color 0.2s;
    border-radius: 4px;
}

.flecha-carrusel:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.prev { left: 10px; }
.next { right: 10px; }

/* Efectos al pasar el ratón: solo en dispositivos con ratón
   (en pantallas táctiles el hover se queda "pegado" tras tocar) */
@media (hover: hover) {
    .tarjeta-coche:hover {
        transform: translateY(-5px);
    }

    .contacto-fijo a:hover {
        transform: scale(1.08);
        transition: transform 0.2s ease-in-out;
    }
}

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

/* Tablets y móviles (hasta 768px) */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.6rem;
        margin: 0.4rem 0;
    }

    header p {
        margin: 0.3rem 0;
        font-size: 0.95rem;
    }

    .catalogo {
        padding: 20px 15px;
        gap: 15px;
    }

    /* Hueco abajo para que la barra de contacto no tape la última tarjeta */
    body {
        padding-bottom: 75px;
    }

    /* Botones de contacto: de columna flotante a barra inferior */
    .contacto-fijo {
        left: 0;
        right: 0;
        bottom: 0;
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 10px;
        background-color: rgba(255, 255, 255, 0.95);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.15);
    }

    .contacto-fijo a {
        flex: 1;
        text-align: center;
        padding: 12px 6px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    /* Flechas del carrusel más grandes para tocar con el dedo */
    .flecha-carrusel {
        padding: 12px 14px;
        font-size: 18px;
    }

    /* Modal */
    .modal-contenido {
        width: 94%;
        padding: 20px 15px;
    }

    .modal-contenido h2 {
        font-size: 1.3rem;
        margin-top: 25px;   /* deja sitio a la X de cerrar */
    }

    .modal-contenido img {
        max-height: 240px;
    }

    .cerrar {
        top: 6px;
        right: 14px;
        font-size: 34px;
        line-height: 1;
    }

    .btn-contacto {
        display: block;     /* botón a todo el ancho, más fácil de pulsar */
        padding: 14px 20px;
    }
}

/* Móviles pequeños (hasta 400px) */
@media (max-width: 400px) {
    header h1 {
        font-size: 1.4rem;
    }

    .catalogo {
        padding: 15px 10px;
    }

    .contacto-fijo a {
        font-size: 0.78rem;
        padding: 11px 4px;
    }

    .precio {
        font-size: 1.1rem;
    }
}

/* Móvil en horizontal / pantallas muy bajas */
@media (max-height: 500px) {
    .modal-contenido {
        max-height: 95vh;
    }

    .modal-contenido img {
        max-height: 160px;
    }
}
