/* ================================================================
   PM Autos - hoja de estilos
   Paleta de color verificada para cumplir el contraste mínimo de
   accesibilidad (WCAG AA, 4.5:1 en texto normal).
   ================================================================ */

:root {
    --color-fondo: #f8f9fa;
    --color-texto: #333333;
    --color-header: #2c3e50;
    --color-precio: #1b5e20;
    --color-km: #374151;
    --color-desc: #555555;
    --color-link: #0056b3;
    --color-whatsapp-bg: #25D366;
    --color-whatsapp-bg-hover: #1ebd5c;
    --color-whatsapp-texto: #073b28;
    --color-vendido: #b91c1c;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-fondo);
    color: var(--color-texto);
    line-height: 1.6;
}

h1, h2, h3 {
    margin-top: 0;
}

a {
    text-decoration: none;
    color: var(--color-link);
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
img:focus-visible {
    outline: 3px solid #3498db;
    outline-offset: 2px;
}

/* --- Header --- */
header {
    background-color: var(--color-header);
    color: #ffffff;
    padding: 1.5rem 1rem;
    text-align: center;
}

.site-logo {
    width: 450px;
    max-width: 100%;
    height: auto;
    margin-bottom: 10px;
}

header h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 500;
    color: #e6ecf1;
    max-width: 700px;
    margin: 0 auto;
}

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.section-title {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2rem;
    color: var(--color-header);
}

.inventario-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.orden-control {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.orden-control select {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background-color: #ffffff;
    font-size: 0.95rem;
}

.inventario-vacio {
    text-align: center;
    background: #ffffff;
    border-radius: 8px;
    padding: 30px;
    color: var(--color-desc);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

/* --- Grilla de inventario --- */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 60px;
}

/* --- Tarjeta de auto --- */
.card {
    position: relative;
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    padding: 20px;
    transition: transform 0.2s;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
}

.card-vendido {
    opacity: 0.8;
}

.ribbon-vendido {
    position: absolute;
    top: 16px;
    right: -34px;
    transform: rotate(45deg);
    background-color: var(--color-vendido);
    color: #ffffff;
    font-weight: bold;
    font-size: 0.8rem;
    letter-spacing: 1px;
    padding: 5px 40px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    z-index: 2;
}

.card-title {
    font-size: 1.4rem;
    margin-bottom: 5px;
}

.card-mileage {
    font-size: 1.05rem;
    color: var(--color-km);
    margin-bottom: 5px;
    font-weight: 600;
}

.card-price {
    font-size: 1.3rem;
    font-weight: bold;
    color: var(--color-precio);
    margin-bottom: 15px;
}

.card-desc {
    font-size: 0.95rem;
    color: var(--color-desc);
    margin-bottom: 20px;
}

.card-whatsapp-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px 15px;
    font-size: 1rem;
    margin: 0;
}

/* --- Galería de imágenes (hasta 5 fotos) --- */
.gallery {
    margin-bottom: 15px;
}

.gallery img {
    cursor: pointer;
}

.gallery-main img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: opacity 0.2s;
    background-color: #eaeaea;
}

.gallery-main img:hover {
    opacity: 0.9;
}

.gallery-thumbs {
    display: flex;
    gap: 8px;
}

.gallery-thumbs img {
    width: calc(25% - 6px);
    height: 60px;
    object-fit: cover;
    border-radius: 4px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
    background-color: #eaeaea;
}

.gallery-thumbs img:hover {
    border-color: #3498db;
}

/* --- Lightbox / carrusel a pantalla completa --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
}

.modal-content {
    max-width: 90%;
    max-height: 85vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    object-fit: contain;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: #e74c3c;
}

.modal-nav {
    cursor: pointer;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 30px;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 4px;
    user-select: none;
    transition: background-color 0.3s;
}

.modal-nav:hover {
    background-color: rgba(0, 0, 0, 0.9);
}

.modal-nav.prev {
    left: 20px;
}

.modal-nav.next {
    right: 20px;
}

/* --- Contacto y mapa --- */
.contact-info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 40px;
}

.contact-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.whatsapp-btn {
    display: inline-block;
    background-color: var(--color-whatsapp-bg);
    color: var(--color-whatsapp-texto);
    padding: 15px 25px;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    margin: 20px 0;
    box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
    transition: all 0.2s;
}

.whatsapp-btn:hover {
    background-color: var(--color-whatsapp-bg-hover);
    color: var(--color-whatsapp-texto);
    transform: translateY(-2px);
}

.instagram-btn {
    display: inline-block;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    margin: 0 0 20px 0;
    box-shadow: 0 4px 10px rgba(225, 48, 108, 0.3);
    transition: all 0.2s;
    text-decoration: none;
}

.instagram-btn:hover {
    transform: translateY(-2px);
    color: white;
    box-shadow: 0 6px 15px rgba(225, 48, 108, 0.5);
}

.map-container {
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    min-height: 300px;
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 20px;
    background-color: var(--color-header);
    color: #cbd5e1;
    margin-top: 40px;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .contact-info-section {
        grid-template-columns: 1fr;
        padding: 20px;
    }

    .inventario-header {
        align-items: stretch;
    }

    header h1 {
        font-size: 1.1rem;
    }
}
