/**
 * SIDEBAR DE COTIZACIÓN - SUZUKI CARRERA MOTOS
 * Sidebar modal que embebe el formulario del ERP
 * Basado en implementación de ktmviamotos.com
 * Versión: 1.0.0
 * Fecha: 17 de marzo de 2026
 */

/* ============================================
   SIDEBAR PANEL
   ============================================ */

.jvm-cotizar-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9999;
    display: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.jvm-cotizar-sidebar--open {
    display: flex;
    visibility: visible;
    opacity: 1;
}

/* ============================================
   OVERLAY (BACKDROP)
   ============================================ */

.jvm-cotizar-sidebar__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
    z-index: 1;
}

/* ============================================
   PANEL LATERAL
   ============================================ */

.jvm-cotizar-sidebar__panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: white;
    box-shadow: -2px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 2;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.jvm-cotizar-sidebar--open .jvm-cotizar-sidebar__panel {
    transform: translateX(0);
}

/* Móvil: panel a pantalla completa */
@media (max-width: 768px) {
    .jvm-cotizar-sidebar__panel {
        max-width: 100%;
    }
}

/* ============================================
   HEADER DEL SIDEBAR
   ============================================ */

.jvm-cotizar-sidebar__header {
    position: relative;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #007aff 0%, #224c9b 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 10;
    flex-shrink: 0;
}

.jvm-cotizar-sidebar__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    padding-right: 3rem;
}

/* ============================================
   BOTÓN CERRAR
   ============================================ */

.jvm-cotizar-sidebar__close {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 50%;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 11;
}

.jvm-cotizar-sidebar__close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.jvm-cotizar-sidebar__close:active {
    transform: translateY(-50%) scale(0.95);
}

.jvm-cotizar-sidebar__close:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* ============================================
   CONTENEDOR DEL IFRAME
   ============================================ */

.jvm-cotizar-sidebar__content {
    flex: 1;
    overflow: hidden;
    padding: 0;
    position: relative;
    background: #f9fafb;
}

/* ============================================
   IFRAME
   ============================================ */

.jvm-cotizar-sidebar__iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* ============================================
   SPINNER DE CARGA
   ============================================ */

.jvm-cotizar-sidebar__content::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 50px;
    height: 50px;
    margin: -25px 0 0 -25px;
    border: 4px solid #e5e7eb;
    border-top-color: #007aff;
    border-radius: 50%;
    animation: jvm-spinner 0.8s linear infinite;
    z-index: 5;
    pointer-events: none;
}

.jvm-cotizar-sidebar__content--loaded::before {
    opacity: 0;
    transition: opacity 0.3s ease;
}

@keyframes jvm-spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Respetar preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    .jvm-cotizar-sidebar__panel {
        transition: none;
    }
    
    .jvm-cotizar-sidebar__content::before {
        animation: none;
        border-top-color: #007aff;
        border-right-color: #007aff;
    }
}

/* ============================================
   ESTADO DE ERROR
   ============================================ */

.jvm-cotizar-sidebar__content--error::before {
    display: none;
}

.jvm-cotizar-sidebar__error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

.jvm-cotizar-sidebar__error p {
    color: #6b7280;
    margin-bottom: 1rem;
    font-size: 1rem;
    line-height: 1.5;
}

.jvm-cotizar-sidebar__error-icon {
    font-size: 3rem;
    color: #ef4444;
    margin-bottom: 1rem;
}

.jvm-cotizar-sidebar__error-button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: #007aff;
    color: white;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.jvm-cotizar-sidebar__error-button:hover {
    background: #0066dd;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

/* ============================================
   ACCESIBILIDAD
   ============================================ */

.jvm-cotizar-sidebar[aria-hidden="true"] {
    pointer-events: none;
}

.jvm-cotizar-sidebar[aria-hidden="false"] {
    pointer-events: auto;
}

/* Focus visible para navegación por teclado */
.jvm-cotizar-sidebar__close:focus-visible {
    outline: 3px solid white;
    outline-offset: 3px;
}

/* ============================================
   OPTIMIZACIONES DE RENDIMIENTO
   ============================================ */

.jvm-cotizar-sidebar__panel {
    will-change: transform;
    contain: layout style paint;
}

.jvm-cotizar-sidebar__iframe {
    will-change: contents;
}

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

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .jvm-cotizar-sidebar__panel {
        max-width: 500px;
    }
}

/* Desktop grande */
@media (min-width: 1440px) {
    .jvm-cotizar-sidebar__panel {
        max-width: 700px;
    }
}

/* ============================================
   DARK MODE (FUTURO)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .jvm-cotizar-sidebar__panel {
        background: #1f2937;
    }
    
    .jvm-cotizar-sidebar__content {
        background: #111827;
    }
}
