/* --- Variables y Estilos Base --- */
:root {
    --marca-red: #df0024;
    --marca-black: #111111;
    --marca-dark-grey: #333333;
    --bg-light: #f4f4f4;
    --white: #ffffff;
    --border-soft: #dddddd;
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-light);
    color: var(--marca-black);
}

h1, h2, h3, h4 {
    font-family: 'Roboto Condensed', sans-serif;
    text-transform: uppercase;
}

.container {
    width: 92%;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- Cabecera --- */
.navbar {
    background-color: var(--white);
    border-bottom: 4px solid var(--marca-red);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -1px;
}

.logo span {
    color: var(--marca-red);
}

.header-tagline {
    display: none;
    font-size: 0.9rem;
    color: var(--marca-dark-grey);
    font-weight: 700;
    border-left: 2px solid var(--border-soft);
    padding-left: 15px;
}

/* --- Hero (Buscador) --- */
.hero {
    background-color: var(--marca-black);
    color: var(--white);
    padding: 1.5rem 0; /* Antes era 3rem, ahora es la mitad */
    border-bottom: 5px solid var(--marca-dark-grey);
}

.text-center { text-align: center; }

.hero h2 {
    font-size: 1.8rem; /* Ligeramente más pequeño */
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.search-bar input {
    width: 100%;
    max-width: 600px;
    padding: 1rem; /* Reducido para que la caja sea más fina */
    border: 2px solid var(--marca-red);
    font-size: 1.1rem;
    outline: none;
    font-family: 'Roboto', sans-serif;
}

.search-bar input:focus {
    box-shadow: 0 0 15px rgba(223, 0, 36, 0.5);
}

/* --- Main y Grid --- */
main { padding: 3rem 0; }

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--marca-black);
    padding-bottom: 0.5rem;
    margin-bottom: 2rem;
}

.section-header h3 {
    font-size: 1.5rem;
}

.badge {
    background: var(--marca-red);
    color: var(--white);
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    font-weight: bold;
}

.car-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* --- Tarjetas --- */
.car-card {
    background: var(--white);
    border: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.car-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}

.car-img-wrapper {
    position: relative;
    overflow: hidden;
}

.car-img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.price-tag {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--marca-red);
    color: var(--white);
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    font-family: 'Roboto Condensed', sans-serif;
}

.car-info {
    padding: 1.2rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.car-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.car-specs {
    display: flex;
    justify-content: space-between;
    color: var(--marca-dark-grey);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.btn-primary {
    background-color: var(--marca-black);
    color: var(--white);
    border: none;
    padding: 0.8rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.3s;
    width: 100%;
    margin-top: auto;
}

.btn-primary:hover {
    background-color: var(--marca-red);
}

.btn-success {
    background-color: #008f39; /* Verde para reserva */
}
.btn-success:hover {
    background-color: #006b2b;
}
.btn-disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* --- Ventana Modal (Pop-up) --- */
.modal-overlay {
    display: none; /* Oculto por defecto */
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    width: 100%;
    max-width: 800px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    background: none;
    border: none;
    color: var(--white);
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
    cursor: pointer;
    z-index: 10;
}

/* --- Detalles dentro del Modal --- */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center; /* Centra la imagen verticalmente con el texto */
}

.modal-img {
    width: 100%;
    height: auto;
    max-height: 350px;
    /* object-fit: contain es la clave. Evita el recorte ajustando la imagen al contenedor */
    object-fit: contain; 
    display: block;
    margin: 0 auto;
    background-color: #f9f9f9; /* Fondo suave por si la imagen tiene otro formato */
}

.modal-details {
    padding: 2rem;
}

.modal-title {
    font-size: 2rem;
    color: var(--marca-black);
    margin-bottom: 0.5rem;
}

.modal-price {
    font-size: 2.5rem;
    color: var(--marca-red);
    font-family: 'Roboto Condensed', sans-serif;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.modal-data {
    list-style: none;
    margin-bottom: 2rem;
    border-top: 1px solid var(--border-soft);
    padding-top: 1rem;
}

.modal-data li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    justify-content: space-between;
}

.modal-data strong {
    color: var(--marca-dark-grey);
}

.footer {
    background-color: var(--marca-black);
    color: var(--white);
    padding: 1.5rem 0; /* Reducido de 3rem a 1.5rem */
    margin-top: 2rem;
    border-top: 5px solid var(--marca-red);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.logo-footer span { color: var(--marca-red); }

.copyright {
    color: #888888;
    font-size: 0.8rem;
    margin-top: 0.3rem;
}

.footer-contact {
    text-align: right;
}

.footer-contact p {
    color: #cccccc;
    font-size: 0.85rem;
    margin-bottom: 0.4rem;
}

/* Responsive para el footer en móviles */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .footer-contact {
        text-align: center;
    }
}

/* --- Detalles dentro del Modal (Corrección de márgenes) --- */
.modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
    padding: 1.5rem; /* Añadimos un margen general para que respire en móvil */
}

.modal-details {
    padding: 1rem 0 0 0; /* En móvil, solo separamos el texto un poco de la foto */
}

.modal-img {
    width: 100%;
    height: auto;
    max-height: 350px;
    object-fit: contain; 
    display: block;
    margin: 0 auto;
    border-radius: 8px; /* Un ligero borde redondeado para darle un toque más premium */
}

@media (min-width: 768px) {
    .modal-grid { 
        grid-template-columns: 1.2fr 1fr; 
        gap: 2.5rem;
        padding: 3rem; /* ¡Aquí está la solución! Un margen simétrico e igual por todos los lados en PC */
    }
    
    .modal-details {
        padding: 0; /* Eliminamos el padding asimétrico que tenía antes la caja de texto */
    }
    
    .modal-img { 
        max-height: 400px; 
    }
}