/**
 * AutoCRM Vehicle Single - CSS CORREGIDO SIN BUGS
 * Versión 2.1 - Fix para galería y layout
 */

:root {
    --autocrm-primary: #2563eb;
    --autocrm-secondary: #10b981;
    --autocrm-accent: #f59e0b;
    --autocrm-dark: #1f2937;
    --autocrm-gray: #6b7280;
    --autocrm-light-gray: #f3f4f6;
    --autocrm-border: #e5e7eb;
    --autocrm-white: #ffffff;
}

* {
    box-sizing: border-box;
}

/* Container principal */
.autocrm-vehicle-single {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.autocrm-vehicle-single .container {
    width: 100%;
    max-width: 100%;
}

/* Header */
.vehicle-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--autocrm-border);
    flex-wrap: wrap;
    gap: 20px;
}

.vehicle-title-section {
    flex: 1;
    min-width: 300px;
}

.vehicle-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--autocrm-dark);
}

.vehicle-subtitle {
    font-size: 18px;
    color: var(--autocrm-gray);
}

.vehicle-price-section {
    text-align: right;
}

.vehicle-price {
    font-size: 36px;
    font-weight: 800;
    color: var(--autocrm-primary);
    margin: 0;
}

.price-suffix {
    font-size: 14px;
    color: var(--autocrm-gray);
    margin-top: 5px;
}

/* Status Badge */
.vehicle-status-badge {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    margin-bottom: 20px;
}

.status-reservado {
    background: #fef3c7;
    color: #92400e;
}

.status-vendido {
    background: #dbeafe;
    color: #1e40af;
}

/* Grid de contenido - FIX CRÍTICO */
.vehicle-content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: start;
}

/* === GALERÍA - FIX CRÍTICO === */
.vehicle-gallery-section {
    width: 100%;
    position: relative;
}

/* Swiper principal - FIX */
.vehicle-gallery-main {
    width: 100%;
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--autocrm-light-gray);
}

.vehicle-gallery-main .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--autocrm-white);
    height: 420px;
}

/* IMPORTANTE: Sin transform en imagenes dentro de Swiper
   El hover scale activa el ResizeObserver de Swiper causando zoom infinito */
.vehicle-gallery-main .swiper-slide img,
.vehicle-gallery-main .swiper-slide img:hover,
.vehicle-gallery-main .swiper-slide a img,
.vehicle-gallery-main .swiper-slide a:hover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    max-height: 420px;
    transform: none !important;
    transition: none !important;
}

/* Swiper thumbnails */
.vehicle-gallery-thumbs {
    width: 100%;
    height: auto;
    margin-top: 15px;
}

.vehicle-gallery-thumbs .swiper-wrapper {
    display: flex;
}

.vehicle-gallery-thumbs .swiper-slide {
    width: 25%;
    height: 80px;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0.6;
    transition: all 0.3s;
}

.vehicle-gallery-thumbs .swiper-slide:hover {
    opacity: 1;
    border-color: var(--autocrm-primary);
}

.vehicle-gallery-thumbs .swiper-slide-thumb-active {
    opacity: 1;
    border-color: var(--autocrm-primary);
}

.vehicle-gallery-thumbs .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Botones de navegación Swiper */
.swiper-button-next,
.swiper-button-prev {
    color: var(--autocrm-primary) !important;
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 18px;
}

.swiper-pagination-bullet-active {
    background: var(--autocrm-primary) !important;
}

/* No gallery */
.no-gallery {
    text-align: center;
    padding: 80px 20px;
    background: var(--autocrm-light-gray);
    border-radius: 12px;
}

.no-gallery-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

/* === INFORMACIÓN DEL VEHÍCULO === */
.vehicle-info-section {
    width: 100%;
}

/* Highlights */
.vehicle-highlights {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.highlight-item {
    background: var(--autocrm-white);
    border: 1px solid var(--autocrm-border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.highlight-item:hover {
    border-color: var(--autocrm-primary);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.highlight-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.highlight-label {
    font-size: 12px;
    color: var(--autocrm-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.highlight-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--autocrm-dark);
}

/* === TABS === */
.vehicle-tabs {
    background: var(--autocrm-white);
    border: 1px solid var(--autocrm-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 30px;
}

.tabs-nav {
    display: flex;
    border-bottom: 1px solid var(--autocrm-border);
    background: var(--autocrm-light-gray);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    font-size: 15px;
    font-weight: 600;
    color: var(--autocrm-gray);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.tab-btn:hover {
    background: rgba(37, 99, 235, 0.05);
    color: var(--autocrm-primary);
}

.tab-btn.active {
    background: var(--autocrm-white);
    color: var(--autocrm-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--autocrm-primary);
}

/* Contenido de tabs */
.tabs-content {
    padding: 30px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Specs grid */
.specs-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--autocrm-border);
}

.spec-item:last-child {
    border-bottom: none;
}

.spec-item-full {
    grid-column: span 2;
}

.spec-label {
    font-weight: 600;
    color: var(--autocrm-gray);
}

.spec-value {
    font-weight: 600;
    color: var(--autocrm-dark);
}

/* Description */
.vehicle-description {
    line-height: 1.8;
    color: var(--autocrm-dark);
}

.vehicle-description p {
    margin-bottom: 15px;
}

.price-note {
    margin-top: 20px;
    padding: 15px;
    background: #fff7ed;
    border-left: 4px solid var(--autocrm-accent);
    border-radius: 4px;
}

/* Contact form */
.contact-form-wrapper {
    text-align: center;
    padding: 20px;
}

.contact-form-wrapper h3 {
    margin: 0 0 10px 0;
    color: var(--autocrm-dark);
}

/* === RESPONSIVE === */
@media (max-width: 968px) {
    .vehicle-content-grid {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .vehicle-header {
        flex-direction: column;
    }

    .vehicle-price-section {
        text-align: left;
    }

    .vehicle-highlights {
        grid-template-columns: 1fr 1fr;
    }

    .specs-grid {
        grid-template-columns: 1fr;
    }

    .tabs-nav {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1 1 33%;
        min-width: 120px;
    }
}

@media (max-width: 568px) {
    .vehicle-title {
        font-size: 24px;
    }

    .vehicle-price {
        font-size: 28px;
    }

    .vehicle-highlights {
        grid-template-columns: 1fr;
    }

    .vehicle-gallery-main .swiper-slide {
        height: 250px;
    }
}
