/**
 * AutoCRM Vehicle Features - CSS
 * Estilos para: Comparador, Favoritos, Compartir, Lightbox, Lista/Grid
 */

/* ============================================================
   COMPARADOR DE VEHÍCULOS
   ============================================================ */

/* Widget flotante */
#compare-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--autocrm-primary, #2563eb);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
    transition: all 0.3s;
    z-index: 999;
    opacity: 0;
    transform: scale(0);
}

#compare-widget.has-items {
    opacity: 1;
    transform: scale(1);
}

#compare-widget:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.6);
}

#compare-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

/* Modal de comparador */
#compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.compare-modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
}

.close-compare-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    transition: color 0.3s;
}

.close-compare-modal:hover {
    color: #1f2937;
}

.compare-modal-content h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    color: #1f2937;
}

#compare-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.compare-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s;
}

.compare-item:hover {
    border-color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.compare-item img {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 8px;
}

.compare-item-info {
    flex: 1;
}

.compare-item-info h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: #1f2937;
}

.compare-item-price {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #2563eb;
}

.btn-remove-compare {
    background: #ef4444;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s;
}

.btn-remove-compare:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.compare-empty {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.compare-actions {
    display: flex;
    gap: 10px;
}

.compare-actions button {
    flex: 1;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

#go-compare {
    background: #2563eb;
    color: white;
}

#go-compare:hover {
    background: #1d4ed8;
}

#clear-compare {
    background: #f3f4f6;
    color: #6b7280;
}

#clear-compare:hover {
    background: #e5e7eb;
}

/* Botón comparar en tarjetas */
.btn-compare-vehicle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-compare-vehicle:hover {
    border-color: #2563eb;
    color: #2563eb;
}

.btn-compare-vehicle.active {
    background: #2563eb;
    border-color: #2563eb;
    color: white;
}

/* ============================================================
   BOTONES DE FAVORITOS
   ============================================================ */

.btn-favorite {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-favorite:hover {
    background: white;
    transform: scale(1.1);
}

.btn-favorite.active {
    animation: heartBeat 0.3s;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ============================================================
   BOTÓN COMPARTIR
   ============================================================ */

.btn-share-vehicle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-share-vehicle:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Modal de compartir */
.share-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.share-modal {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 100%;
    position: relative;
}

.close-share-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}

.share-modal h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    color: #1f2937;
}

.share-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.share-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    color: white;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
}

.share-btn.whatsapp {
    background: #25d366;
}

.share-btn.facebook {
    background: #1877f2;
}

.share-btn.twitter {
    background: #1da1f2;
}

.share-btn.copy-link {
    background: #6b7280;
    grid-column: span 2;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* ============================================================
   LIGHTBOX
   ============================================================ */

.vehicle-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    color: #1f2937;
}

.lightbox-close {
    top: 20px;
    right: 20px;
}

.lightbox-prev {
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: white;
    transform: scale(1.1);
}

.lightbox-prev:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-next:hover {
    transform: translateY(-50%) scale(1.1);
}

.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    color: #1f2937;
}

/* ============================================================
   TOGGLE VISTA LISTA / GRID
   ============================================================ */

#toggle-view {
    padding: 10px 20px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.3s;
}

#toggle-view:hover {
    border-color: #2563eb;
    color: #2563eb;
}

/* Vista Grid (default) */
.vehicles-grid.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
}

/* Vista Lista */
.vehicles-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.vehicles-grid.view-list .vehicle-card {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
}

.vehicles-grid.view-list .vehicle-card-image {
    height: 200px;
}

.vehicles-grid.view-list .vehicle-card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

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

@media (max-width: 768px) {
    #compare-widget {
        bottom: 20px;
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }

    .compare-item {
        flex-direction: column;
        text-align: center;
    }

    .compare-item img {
        width: 100%;
        height: 150px;
    }

    .compare-actions {
        flex-direction: column;
    }

    .lightbox-prev,
    .lightbox-next {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .lightbox-prev {
        left: 10px;
    }

    .lightbox-next {
        right: 10px;
    }

    .vehicles-grid.view-list .vehicle-card {
        grid-template-columns: 1fr;
    }
}
