/* ═══════════════════════════════════════════════════════════════════════════════
   ESTILOS CUSTOM - AUTOMOTOR
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────────
   GALERÍA DE VEHÍCULOS - Dropzone customizado
   ───────────────────────────────────────────────────────────────────────────────── */
#dropzoneVehiculo {
    min-height: 150px;
    border: 2px dashed #adb5bd;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
    cursor: pointer;
}

#dropzoneVehiculo:hover,
#dropzoneVehiculo.dz-drag-hover {
    border-color: #556ee6;
    background: #f0f3ff;
}

#dropzoneVehiculo .dz-message {
    text-align: center;
    padding: 30px 20px;
    margin: 0;
}

#dropzoneVehiculo .dz-message i {
    color: #adb5bd;
    transition: color 0.3s ease;
}

#dropzoneVehiculo:hover .dz-message i {
    color: #556ee6;
}

/* Preview de imágenes en Dropzone */
#dropzoneVehiculo .dz-preview {
    margin: 10px;
}

#dropzoneVehiculo .dz-preview .dz-image {
    border-radius: 8px;
    overflow: hidden;
}

/* ─────────────────────────────────────────────────────────────────────────────────
   GALERÍA - Grid de imágenes (5 por fila)
   ───────────────────────────────────────────────────────────────────────────────── */
#galeriaVehiculo {
    min-height: 100px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.galeria-item {
    position: relative;
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex: 0 0 calc(20% - 10px);
    max-width: calc(20% - 10px);
}

.galeria-item:active {
    cursor: grabbing;
}

.galeria-item.sortable-ghost {
    opacity: 0.4;
}

.galeria-item.sortable-chosen {
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.galeria-item-inner {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.galeria-item-inner:hover {
    border-color: #556ee6;
}

.galeria-item-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.galeria-item-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.galeria-item-inner:hover .galeria-item-overlay {
    opacity: 1;
}

.galeria-item-overlay .btn {
    padding: 6px 10px;
    font-size: 14px;
}

/* Badge de imagen principal */
.galeria-item-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
}

.galeria-item-badge .badge {
    font-size: 11px;
    padding: 4px 8px;
}

/* Indicador de orden */
.galeria-item-orden {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 10;
}

/* Nombre de archivo */
.galeria-item-nombre {
    padding: 8px;
    font-size: 12px;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    background: #fff;
}

/* Estado vacío */
.galeria-vacia {
    padding: 40px 20px;
    width: 100%;
    flex: 0 0 100%;
}

.galeria-vacia i {
    color: #dee2e6;
}

/* ─────────────────────────────────────────────────────────────────────────────────
   GALERÍA - Modal ver detalle (solo lectura)
   ───────────────────────────────────────────────────────────────────────────────── */
.galeria-ver-item {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
}

.galeria-ver-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.galeria-ver-item img:hover {
    transform: scale(1.03);
}

/* ─────────────────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 992px) {
    .galeria-item {
        flex: 0 0 calc(25% - 9px);
        max-width: calc(25% - 9px);
    }
}

@media (max-width: 768px) {
    .galeria-item {
        flex: 0 0 calc(33.333% - 8px);
        max-width: calc(33.333% - 8px);
    }
}

@media (max-width: 576px) {
    .galeria-item {
        flex: 0 0 calc(50% - 6px);
        max-width: calc(50% - 6px);
    }
    
    .galeria-item-img {
        height: 120px;
    }
    
    #dropzoneVehiculo .dz-message {
        padding: 20px 15px;
    }
    
    #dropzoneVehiculo .dz-message h5 {
        font-size: 14px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────────
   LIGHTBOX - SweetAlert2 para ver imágenes
   ───────────────────────────────────────────────────────────────────────────────── */
.swal-imagen-galeria {
    max-width: 90vw !important;
    max-height: 80vh !important;
    object-fit: contain;
    border-radius: 8px;
}

.swal2-popup.swal2-modal {
    max-width: 95vw;
}

.swal2-image {
    margin: 1rem auto !important;
}

/* Asegurar que SweetAlert2 aparezca sobre modales de Bootstrap */
.swal2-container {
    z-index: 99999 !important;
}

.swal2-popup {
    z-index: 100000 !important;
}

/* Backdrop de SweetAlert2 sobre Bootstrap modal */
.swal2-container.swal2-backdrop-show {
    background: rgba(0,0,0,0.4) !important;
}

/* Input de SweetAlert2 editable - forzar interactividad */
.swal2-input,
.swal2-textarea,
.swal2-select {
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
}

/* Asegurar que el popup capture los eventos */
.swal2-popup * {
    pointer-events: auto;
}

/* ─────────────────────────────────────────────────────────────────────────────────
   CATÁLOGO DE VEHÍCULOS
   ───────────────────────────────────────────────────────────────────────────────── */

/* Card principal */
.catalogo-card {
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.catalogo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* Imagen de la card */
.catalogo-card-img-wrapper {
    position: relative;
    overflow: hidden;
    background: #f0f2f5;
}

.catalogo-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.catalogo-card:hover .catalogo-card-img {
    transform: scale(1.05);
}

/* Placeholder cuando no hay imagen */
.catalogo-card-placeholder {
    width: 100%;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e9ecef;
    color: #adb5bd;
    font-size: 48px;
}

/* Badges sobre la imagen */
.catalogo-card-badges {
    position: absolute;
    top: 8px;
    left: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    z-index: 2;
}

.catalogo-card-badges .badge {
    font-size: 10px;
    padding: 4px 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Body de la card */
.catalogo-card-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.catalogo-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 6px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.catalogo-card-specs {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 10px;
}

/* Precios en la card */
.catalogo-card-precios {
    margin-top: auto;
    border-top: 1px solid #f0f2f5;
    padding-top: 10px;
}

.catalogo-card-precio {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.catalogo-card-precio-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
}

.catalogo-card-precio-valor {
    font-size: 15px;
    font-weight: 700;
    color: #d10000;
}

.catalogo-card-btn {
    margin-top: 10px;
}

.catalogo-precio-conv {
    font-size: 13px;
    font-style: italic;
    font-weight: 600;
    color: #6c757d !important;
    white-space: nowrap;
}

/* Estado vacío */
.catalogo-vacio {
    padding: 60px 20px;
    text-align: center;
}

.catalogo-vacio i {
    font-size: 64px;
    color: #dee2e6;
    margin-bottom: 16px;
}

/* Loading skeleton */
.catalogo-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* Tabla cotización en header */
.catalogo-cotizacion-tabla {
    font-size: 13px;
    max-width: 380px;
    margin-left: auto;
}

.catalogo-cotizacion-tabla th {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    padding: 4px 8px !important;
    background: #f8f9fa;
}

.catalogo-cotizacion-tabla td {
    padding: 5px 8px !important;
    vertical-align: middle;
}

/* ─── Modal Detalle Catálogo ─── */

#badgesDetalle .badge,
#entregaMinimaDetalle .badge {
    font-size: 14px;
    padding: 6px 12px;
    font-weight: 600;
}

.catalogo-detalle-precio-card {
    background: #d10000;
    color: #fff;
    border-radius: 8px;
    padding: 12px 14px;
    text-align: center;
}

.catalogo-detalle-conv {
    display: block;
    font-size: inherit;
    font-weight: 600;
    font-style: italic;
    opacity: 0.8;
    margin-top: 2px;
}

.catalogo-detalle-specs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.catalogo-spec-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f2f5;
}

.catalogo-spec-item:nth-child(odd) {
    background: #f8f9fa;
}

.catalogo-spec-label {
    font-size: 13px;
    color: #6c757d;
    font-weight: 500;
}

.catalogo-spec-value {
    font-size: 13px;
    color: #343a40;
    font-weight: 600;
    text-align: right;
}

/* Galería detalle */
.catalogo-detalle-galeria .catalogo-thumb {
    width: 70px;
    height: 52px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s ease, opacity 0.2s ease;
    opacity: 0.7;
}

.catalogo-detalle-galeria .catalogo-thumb:hover,
.catalogo-detalle-galeria .catalogo-thumb.active {
    border-color: #d10000;
    opacity: 1;
}

/* Documentación checklist */
.catalogo-doc-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: 13px;
}

.catalogo-doc-item .doc-icon-si {
    color: #198754;
}

.catalogo-doc-item .doc-icon-no {
    color: #dc3545;
}

/* ─── Responsive catálogo ─── */
@media (max-width: 768px) {
    /* Reducir padding lateral solo en catálogo */
    #paginaCatalogo .page-content {
        padding-left: 0;
        padding-right: 0;
    }

    #paginaCatalogo .container-fluid {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Grid de cards sin gap excesivo */
    #paginaCatalogo #catalogoGrid {
        --bs-gutter-x: 0.5rem;
    }

    /* Selects full width */
    #paginaCatalogo .sel-filtro-catalogo,
    #paginaCatalogo .select2-container {
        width: 100% !important;
    }

    .catalogo-card-img,
    .catalogo-card-placeholder {
        height: 160px;
    }

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

    .catalogo-detalle-galeria .catalogo-thumb {
        width: 55px;
        height: 42px;
    }

    .catalogo-cotizacion-tabla {
        max-width: 100%;
    }
}

@media (max-width: 576px) {
    #paginaCatalogo .container-fluid {
        padding-left: 6px;
        padding-right: 6px;
    }

    .catalogo-card-img,
    .catalogo-card-placeholder {
        height: 180px;
    }

    .catalogo-card-precio-valor {
        font-size: 13px;
    }
}
