/* =========================================
   1. CONTENEDOR PRINCIPAL
   ========================================= */
.tbs-booking-container {
    max-width: var(--tbs-width, 500px);
    margin: 0 auto;
    background: var(--tbs-bg);
    border-radius: var(--tbs-radius, 16px);
    padding: 25px;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--tbs-text);
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    border: 1px solid var(--tbs-border);
    box-sizing: border-box;
}

.tbs-title-center {
    text-align: center;
    margin-bottom: 25px;
}
.tbs-title-center h3 {
    font-size: 1.6rem;
    color: var(--tbs-text);
    margin: 0;
    font-weight: 700;
}
.tbs-title-center p {
    opacity: 0.7;
    font-size: 0.9rem;
    margin-top: 5px;
    color: var(--tbs-text);
}

/* =========================================
   2. WIZARD Y PASOS
   ========================================= */
.tbs-wizard-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--tbs-border);
    padding-bottom: 15px;
}

.tbs-step {
    font-size: 0.85rem;
    color: var(--tbs-text);
    opacity: 0.5;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    transition: all 0.3s;
}

.tbs-step span {
    background: var(--tbs-card);
    border: 1px solid var(--tbs-border);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
}

.tbs-step.active { opacity: 1; color: var(--tbs-primary); }
.tbs-step.active span {
    background: var(--tbs-primary);
    color: #fff;
    border-color: var(--tbs-primary);
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}

.tbs-header-nav {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--tbs-border);
    padding-bottom: 10px;
}
.tbs-back-btn {
    background: transparent;
    border: none;
    color: var(--tbs-text);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 5px 10px 5px 0;
    margin-right: 10px;
    opacity: 0.7;
    font-weight: 600;
}
.tbs-back-btn:hover { opacity: 1; color: var(--tbs-primary); }

/* =========================================
   3. ELEMENTOS DEL FORMULARIO
   ========================================= */
.tbs-trip-tabs {
    display: flex;
    background: var(--tbs-card);
    border-radius: var(--tbs-radius, 8px);
    padding: 5px;
    margin-bottom: 20px;
    border: 1px solid var(--tbs-border);
}
.tbs-tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: var(--tbs-text);
    opacity: 0.7;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--tbs-radius, 6px);
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.85rem;
}
.tbs-tab-btn.active {
    background: var(--tbs-primary);
    color: #fff;
    opacity: 1;
    box-shadow: 0 4px 10px rgba(0,0,0, 0.15);
}

.tbs-label {
    font-size: 0.75rem;
    color: var(--tbs-primary);
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 6px;
    display: block;
    letter-spacing: 0.5px;
}

.tbs-input-group { margin-bottom: 18px; }

.tbs-form input[type="date"],
.tbs-form input[type="time"],
.tbs-form input[type="text"],
.tbs-form input[type="email"],
.tbs-form input[type="tel"],
.tbs-form input[type="number"],
.tbs-form textarea,
.tbs-form select {
    width: 100%;
    background: var(--tbs-card);
    border: 1px solid var(--tbs-border);
    color: var(--tbs-text);
    padding: 12px 15px;
    border-radius: var(--tbs-radius, 8px);
    font-size: 1rem;
    outline: none;
    transition: border 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.tbs-form input:focus, 
.tbs-form textarea:focus, 
.tbs-form select:focus {
    border-color: var(--tbs-primary);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.05);
}

.tbs-flex-row { display: flex; gap: 15px; }
.tbs-col-half { flex: 1; }

/* --- SELECT2 PERSONALIZACIÓN (MODIFICADO PARA MAS ALTURA) --- */
.select2-container--default .select2-selection--single {
    background-color: var(--tbs-card) !important;
    border: 1px solid var(--tbs-border) !important;
    border-radius: var(--tbs-radius, 8px) !important;
    height: 54px !important; /* Altura del botón aumentada */
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--tbs-text) !important;
    line-height: 52px !important; /* Centrado vertical */
    padding-left: 15px !important;
    font-size: 1.05rem; /* Letra un poco más grande */
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 52px !important;
}
.select2-dropdown {
    background-color: var(--tbs-card) !important;
    border: 1px solid var(--tbs-border) !important;
    color: var(--tbs-text) !important;
    z-index: 99999;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* LISTA DE OPCIONES MÁS ALTA */
.select2-container--default .select2-results > .select2-results__options {
    max-height: 600px !important; /* Muestra muchas más opciones sin scroll */
    overflow-y: auto;
    padding: 5px 0;
}

/* OPCIONES INDIVIDUALES CON MAS ESPACIO */
.select2-container--default .select2-results__option {
    padding: 12px 15px;
    font-size: 1rem;
}

.select2-search__field {
    background-color: var(--tbs-bg) !important;
    color: var(--tbs-text) !important;
    border: 1px solid var(--tbs-border) !important;
    border-radius: var(--tbs-radius, 4px) !important;
    padding: 8px !important;
}
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--tbs-primary) !important;
    color: #fff !important;
}
.select2-container--default .select2-results__option[aria-selected=true] {
    background-color: var(--tbs-border) !important;
}

/* =========================================
   4. TARJETAS DE VEHÍCULOS
   ========================================= */
.tbs-vehicle-card {
    background: var(--tbs-card);
    border: 1px solid var(--tbs-border);
    border-radius: var(--tbs-radius, 12px);
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.tbs-vehicle-card:hover {
    border-color: var(--tbs-primary);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.tbs-vehicle-card.selected {
    border: 2px solid var(--tbs-secondary);
    background: rgba(255, 255, 255, 0.02);
}

.tbs-vehicle-img {
    width: 90px;
    height: 65px;
    object-fit: cover;
    border-radius: var(--tbs-radius, 6px);
    margin-right: 15px;
    background: #000;
}

.tbs-vehicle-info { flex: 1; }
.tbs-vehicle-info h4 { margin: 0 0 5px 0; color: var(--tbs-text); font-size: 1.1rem; }
.tbs-vehicle-info div { font-size: 0.8rem; opacity: 0.7; color: var(--tbs-text); }

.tbs-vehicle-price { text-align: right; margin-right: 15px; }
.current-price { color: var(--tbs-primary); font-size: 1.3rem; font-weight: 700; display: block; }
.tbs-quote-badge {
    color: var(--tbs-primary);
    font-weight: bold;
    font-size: 0.9rem;
    background: rgba(255,255,255,0.1);
    padding: 3px 8px;
    border-radius: 4px;
}

.tbs-select-btn {
    background: transparent;
    border: 1px solid var(--tbs-secondary);
    color: var(--tbs-secondary);
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: bold;
    transition: all 0.3s;
}
.tbs-vehicle-card:hover .tbs-select-btn,
.tbs-vehicle-card.selected .tbs-select-btn {
    background: var(--tbs-secondary);
    color: #fff;
}

/* =========================================
   5. RESUMEN Y BOTONES DE ACCIÓN
   ========================================= */
#price-summary {
    color: var(--tbs-text);
    text-align: right;
    font-size: 1.2rem;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--tbs-card);
    border-radius: var(--tbs-radius, 8px);
    border: 1px solid var(--tbs-border);
}
#price-summary span { color: var(--tbs-secondary); font-weight: 800; }

.tbs-payment-methods {
    background: var(--tbs-card);
    padding: 20px;
    border-radius: var(--tbs-radius, 8px);
    border: 1px solid var(--tbs-border);
    margin-top: 20px;
}
.tbs-payment-methods label {
    color: var(--tbs-text);
    display: block;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 0.95rem;
}
.tbs-payment-methods input[type="radio"] { width: auto; margin-right: 10px; }

.tbs-btn-action {
    width: 100%;
    background: var(--tbs-secondary);
    color: #fff;
    border: none;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: var(--tbs-radius, 8px);
    cursor: pointer;
    text-transform: uppercase;
    margin-top: 15px;
    transition: filter 0.3s, transform 0.2s;
    letter-spacing: 0.5px;
}
.tbs-btn-action:hover { filter: brightness(1.1); transform: translateY(-1px); }
.tbs-btn-action:disabled { background: #666; cursor: not-allowed; transform: none; filter: grayscale(1); }

/* =========================================
   RESPONSIVE - MOBILE FIX COMPLETO
   ========================================= */

/* === GLOBAL: Prevenir desbordamiento horizontal === */
.tbs-booking-container,
.tbs-booking-container *,
.tbs-form-map-wrapper,
.tbs-form-map-wrapper * {
    box-sizing: border-box;
}

/* === CRÍTICO: Forzar que TODOS los contenedores padre (Divi) permitan expansión === */
/* Divi aplica overflow:hidden y height fija a sus módulos - esto lo anula */
.et_pb_section .tbs-booking-container,
.et_pb_row .tbs-booking-container,
.et_pb_column .tbs-booking-container,
.et_pb_code_inner .tbs-booking-container,
.et_pb_text_inner .tbs-booking-container,
.et_pb_module_inner .tbs-booking-container,
.tbs-booking-container {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible !important;
}

/* Forzar a TODOS los padres de Divi que permitan expansión */
.et_pb_code_inner,
.et_pb_text_inner,
.et_pb_module_inner,
.et_pb_column,
.et_pb_row,
.et_pb_row_inner,
.et_pb_section {
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
}

/* Form y pasos: siempre auto */
.tbs-booking-container form,
.tbs-booking-container .tbs-form,
.tbs-booking-container .tbs-step-content,
#tbs-step-1, #tbs-step-2, #tbs-step-3,
#tbs-step1-hidden-part,
#tbs-shop-container,
#tbs-vehicle-list {
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
}

/* Todos los campos: nunca exceder contenedor */
.tbs-booking-container input,
.tbs-booking-container select,
.tbs-booking-container textarea,
.tbs-booking-container .select2-container {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* === TABLET (max 980px) === */
@media (max-width: 980px) {
    .tbs-form-map-wrapper {
        flex-direction: column !important;
    }
    .et_pb_code_inner .tbs-form-map-wrapper,
    .et_pb_text_inner .tbs-form-map-wrapper {
        flex-direction: column !important;
    }
    #tbs-route-map-container {
        position: relative !important;
        top: auto !important;
        width: 100% !important;
        min-width: 100% !important;
    }
    #tbs-route-map {
        height: 350px !important;
        min-height: 350px !important;
    }
}

/* === MOBILE (max 768px) === */
@media (max-width: 768px) {
    /* Contenedor: ancho completo, SIN límite de altura */
    .tbs-booking-container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 15px !important;
        padding-bottom: 100px !important;
        border-radius: 12px !important;
        margin: 0 !important;
        overflow: visible !important;
        height: auto !important;
        max-height: none !important;
        min-height: auto !important;
    }

    /* Wrapper del mapa: columna */
    .tbs-form-map-wrapper {
        flex-direction: column !important;
        gap: 15px !important;
        max-width: 100% !important;
        overflow: visible !important;
        height: auto !important;
    }

    /* Wizard header: compacto */
    .tbs-wizard-header {
        font-size: 0.75rem;
        gap: 5px;
        flex-wrap: nowrap;
        overflow: hidden;
    }
    .tbs-step {
        gap: 4px;
        font-size: 0.7rem;
    }
    .tbs-step span {
        width: 24px;
        height: 24px;
        font-size: 0.7rem;
        flex-shrink: 0;
    }

    /* Tabs: texto más pequeño */
    .tbs-tab-btn {
        padding: 10px 5px;
        font-size: 0.75rem;
    }

    /* Flex rows: stack vertical */
    .tbs-flex-row {
        flex-direction: column;
        gap: 0;
    }
    .tbs-col-half {
        width: 100% !important;
        margin-bottom: 15px;
    }

    /* Vehículos: stack vertical */
    .tbs-vehicle-card {
        flex-direction: column;
        text-align: center;
        padding: 12px;
    }
    .tbs-vehicle-img {
        width: 100%;
        height: 120px;
        margin: 0 0 10px 0;
    }
    .tbs-vehicle-price {
        margin: 8px 0;
        text-align: center;
    }
    .tbs-vehicle-info h4 {
        font-size: 1rem;
    }

    /* Extras grid: 2 columnas */
    .tbs-grid-extras {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
    }
    .tbs-extra-img {
        min-height: 100px;
    }

    /* Select2: reducir height dropdown en móvil */
    .select2-container--default .select2-results > .select2-results__options {
        max-height: 250px !important;
    }
    .select2-container {
        width: 100% !important;
    }

    /* PayPal */
    #paypal-button-container {
        width: 100% !important;
        overflow: visible !important;
    }

    /* Botón touch friendly */
    .tbs-btn-action {
        padding: 18px;
        font-size: 1rem;
        min-height: 54px;
    }

    /* Price summary */
    #price-summary {
        font-size: 1rem;
        padding: 12px;
    }

    /* Payment methods */
    .tbs-payment-methods {
        padding: 15px;
    }
    .tbs-payment-methods label {
        padding: 8px 0;
        font-size: 0.9rem;
    }

    /* Mapa en móvil */
    #tbs-route-map-container {
        min-width: 100% !important;
        width: 100% !important;
        min-height: 300px !important;
        position: relative !important;
        top: auto !important;
    }
    #tbs-route-map {
        height: 300px !important;
        min-height: 300px !important;
    }
}

/* === MOBILE SMALL (max 480px) === */
@media (max-width: 480px) {
    .tbs-booking-container {
        padding: 12px !important;
        padding-bottom: 100px !important;
        border-radius: 8px !important;
        /* Margen derecho para que las banderas de idiomas no tapen contenido */
        margin-right: 5px !important;
    }

    .tbs-title-center h3 {
        font-size: 1.2rem;
    }

    .tbs-form input[type="date"],
    .tbs-form input[type="time"],
    .tbs-form input[type="text"],
    .tbs-form input[type="email"],
    .tbs-form input[type="tel"],
    .tbs-form input[type="number"],
    .tbs-form textarea,
    .tbs-form select {
        padding: 10px 12px;
        font-size: 16px; /* 16px previene zoom automático en iOS */
    }

    .select2-container--default .select2-selection--single {
        height: 48px !important;
    }
    .select2-container--default .select2-selection--single .select2-selection__rendered {
        line-height: 46px !important;
        font-size: 16px;
    }
    .select2-container--default .select2-selection--single .select2-selection__arrow {
        height: 46px !important;
    }

    .tbs-grid-extras {
        grid-template-columns: 1fr 1fr !important;
    }

    .current-price {
        font-size: 1.1rem;
    }

    /* Wizard: solo números, ocultar texto */
    .tbs-step {
        font-size: 0;
    }
    .tbs-step span {
        font-size: 0.7rem;
    }
}

/* === FIX: Widgets flotantes (banderas de idiomas, chat) no tapen el form === */
/* Empujar la barra de banderas del plugin GTranslate detrás del form */
@media (max-width: 768px) {
    /* GTranslate / Weglot / TranslatePress floating flags */
    .gtranslate_wrapper[style*="position: fixed"],
    .gt_float_switcher,
    div[class*="gtranslate"][style*="fixed"],
    div[class*="weglot"][style*="fixed"],
    div[class*="trp-"][style*="fixed"] {
        z-index: 99 !important; /* Debajo del form (form no necesita z-index alto) */
    }

    /* El contenedor del form necesita ser limpio */
    .tbs-booking-container {
        position: relative;
        z-index: 1;
    }
}

/* --- ESTILOS DE LA TIENDA DE EXTRAS --- */
.tbs-grid-extras {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.tbs-extra-item {
    background: var(--tbs-card);
    border: 1px solid var(--tbs-border);
    border-radius: var(--tbs-radius, 12px);
    padding: 15px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.tbs-extra-item:hover {
    border-color: var(--tbs-primary);
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.08);
}

.tbs-extra-img {
    margin-bottom: 12px;
    border-radius: var(--tbs-radius, 8px);
    overflow: hidden;
    background: rgba(0,0,0,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
}

.tbs-extra-img img {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    border-radius: 0;
    display: block;
}

.no-img {
    font-size: 60px;
    line-height: 140px;
    opacity: 0.5;
}

.tbs-extra-details .ex-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--tbs-text);
    margin-bottom: 5px;
    line-height: 1.3;
}
.tbs-extra-details .ex-price {
    font-size: 1.1rem;
    color: var(--tbs-primary);
    font-weight: 700;
    margin-bottom: 12px;
}

.tbs-extra-qty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: auto;
}
.qty-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--tbs-border);
    background: var(--tbs-bg);
    color: var(--tbs-text);
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.qty-btn:hover { background: var(--tbs-primary); color: #fff; border-color: var(--tbs-primary); }
.qty-input {
    width: 40px !important;
    text-align: center;
    padding: 5px !important;
    height: auto !important;
    border: 1px solid var(--tbs-border) !important;
    background: var(--tbs-card) !important;
    font-weight: bold;
    font-size: 1.1rem;
    border-radius: var(--tbs-radius, 6px);
}
/* =========================================
   MAPA DE RUTA - COMPATIBILIDAD DIVI
   ========================================= */

/* Forzar que el mapa tenga dimensiones dentro de Divi Code Module */
.et_pb_code_inner .tbs-form-map-wrapper,
.et_pb_text_inner .tbs-form-map-wrapper {
    display: flex !important;
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* En Divi, asegurar que el contenedor del mapa sea visible */
.et_pb_code_inner #tbs-route-map-container,
.et_pb_text_inner #tbs-route-map-container {
    flex: 1 !important;
    min-width: 350px !important;
    min-height: 500px !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* El div del mapa necesita altura explícita */
#tbs-route-map {
    width: 100% !important;
    height: 500px !important;
    min-height: 500px !important;
}

/* Evitar que Divi rompa el z-index del mapa */
.et_pb_section #tbs-route-map-container {
    position: sticky;
    top: 20px;
    z-index: 1;
}

/* ═══ REQUEST A QUOTE BADGE (v8.2) ═══ */
.tbs-quote-badge{display:inline-block;background:linear-gradient(135deg,#f59e0b,#d97706);color:#fff;font-size:12px;font-weight:700;padding:5px 14px;border-radius:20px;text-transform:uppercase;letter-spacing:.5px;white-space:nowrap;cursor:pointer;transition:all .2s;}
.tbs-quote-badge:hover{transform:scale(1.04);box-shadow:0 4px 12px rgba(245,158,11,.4);}
.tbs-grid-no-price .tbs-quote-badge{font-size:13px;padding:6px 16px;}
