/* ===========================================================
   CALCULADORA DE VIAJE - ESTILOS
=========================================================== */

/* CONTENEDOR PRINCIPAL */
.calc-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 69px);
    /* altura viewport - header */
    position: relative;
    overflow: hidden;
}

/* MAPA */
.map-container {
    width: 100%;
    height: 100%;
    background: #e5e5e5;
    position: relative;
}

/* ===========================================================
   BARRA DE BÚSQUEDA FLOTANTE SOBRE EL MAPA
=========================================================== */
.search-bar-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    gap: 10px;
    width: 90%;
    max-width: 500px;
}

.search-bar {
    flex: 1;
    position: relative;
}

#mapa-search-input {
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    background: white;
    box-sizing: border-box;
    font-family: inherit;
}

#mapa-search-input:focus {
    outline: none;
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
    transform: scale(1.02);
}

/* BOTÓN DE GEOLOCALIZACIÓN */
.btn-location {
    min-width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #66BB6A, #43A047);
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-location:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
}

.btn-location:active {
    transform: scale(0.95);
}

/* PANEL DE CONTROL */
.control-panel {
    background: #ffffff;
    padding: 15px 25px 25px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.panel-content {
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 30px;
    /* Espacio al final para scroll */
}

/* TÍTULO */
.calc-title {
    color: #004D40;
    font-size: 28px;
    font-weight: 800;
    margin: 0 0 5px 0;
    text-align: center;
}

.calc-subtitle {
    color: #004D40;
    font-size: 16px;
    text-align: center;
    margin: 0 0 15px 0;
}

/* INSTRUCCIONES */
.instructions {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-left: 4px solid #4CAF50;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.instructions p {
    margin: 0 0 8px 0;
    font-weight: 600;
    color: #004D40;
}

.instructions ol {
    margin: 0;
    padding-left: 20px;
    color: #004D40;
}

.instructions li {
    margin: 5px 0;
    font-size: 15px;
}

/* CAMPOS DE ENTRADA */
.address-inputs {
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 15px;
    position: relative;
}

.input-group label {
    display: block;
    font-weight: 600;
    color: #004D40;
    margin-bottom: 6px;
    font-size: 16px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-group input {
    width: 100%;
    padding: 12px 40px 12px 12px;
    /* Espacio para la X */
    border: 2px solid #ccc;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.input-group input:focus {
    outline: none;
    border-color: #4CAF50;
}

/* Botón X para limpiar */
.btn-clear-input {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    font-size: 20px;
    color: #999;
    cursor: pointer;
    padding: 4px 8px;
    display: none;
    /* Oculto por defecto */
    transition: color 0.2s;
}

.btn-clear-input:hover {
    color: #4CAF50;
}

.input-wrapper:has(input:not(:placeholder-shown)) .btn-clear-input {
    display: block;
    /* Mostrar solo cuando hay texto */
}

/* BOTONES DE ACCIÓN */
.action-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    font-weight: bold;
    border: none;
    cursor: pointer;
    font-size: 18px;
    transition: 0.2s;
    flex: 1;
}

.btn-secondary:hover {
    background: #5a6268;
}

.action-buttons .btn-orange {
    flex: 1;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

/* RESULTADOS */
.resultados {
    background: linear-gradient(135deg, #E8F5E9 0%, #C8E6C9 100%);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
    border: 2px solid #4CAF50;
    animation: slideDown 0.3s ease-out;
}

/* RESULTADOS EN ESTADO DE ERROR (< 50km) */
.resultados.resultados-error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
    border: 2px solid #dc2626 !important;
}

.resultados.resultados-error h3 {
    color: #991b1b !important;
    font-size: 17px !important;
    white-space: nowrap;
}

.resultados.resultados-error .resultado-label,
.resultados.resultados-error .resultado-value {
    color: #7f1d1d !important;
}

.resultados.resultados-error .precio-destacado {
    background: #fecaca !important;
    border-color: #dc2626 !important;
}

.resultados.resultados-error .resultado-precio {
    color: #dc2626 !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.resultados h3 {
    color: #004D40;
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 15px 0;
    text-align: center;
}

.resultado-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 77, 64, 0.1);
}

.resultado-item:last-child {
    border-bottom: none;
}

.resultado-label {
    font-weight: 600;
    color: #004D40;
    font-size: 16px;
}

.resultado-value {
    font-weight: 700;
    color: #004D40;
    font-size: 16px;
    text-align: right;
}

.resultado-divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, #4CAF50, transparent);
    margin: 10px 0;
}

/* PRECIOS DESTACADOS */
.precio-destacado {
    background: rgba(255, 255, 255, 0.5);
    padding: 12px 15px;
    border-radius: 10px;
    margin: 8px 0;
}

.precio-destacado.oferta {
    background: linear-gradient(135deg, #D4EDDA 0%, #C3E6CB 100%);
    border: 2px solid #28a745;
}

.precio-normal {
    color: #004D40;
    font-size: 20px;
}

.precio-oferta {
    color: #155724;
    font-size: 24px;
}

.info-tarifa {
    text-align: center;
    margin-top: 10px;
    opacity: 0.8;
}

.info-tarifa small {
    font-size: 13px;
    color: #004D40;
}

/* BOTÓN RESERVAR */
.btn-reservar {
    width: 100%;
    margin-top: 15px;
    font-size: 20px;
    padding: 18px 30px;
}

/* BOTÓN VOLVER AL INICIO */
.btn-volver-inicio {
    display: block;
    text-align: center;
    margin-top: 20px;
    padding: 12px 20px;
    background: transparent;
    color: #004D40;
    text-decoration: none;
    border: 2px solid #004D40;
    border-radius: 10px;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s;
}

.btn-volver-inicio:hover {
    background: #004D40;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 77, 64, 0.2);
}

/* PANEL DE ERROR DE DISTANCIA MÍNIMA */
.error-distancia-minima {
    background: linear-gradient(135deg, #FFF5F5 0%, #FFE5E5 100%);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 12px;
    border: 2px solid #FF6B6B;
    text-align: center;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.error-distancia-minima .error-icon {
    font-size: 24px;
    margin-bottom: 3px;
}

.error-distancia-minima h3 {
    color: #C92A2A;
    font-size: 15px;
    font-weight: 800;
    margin: 0 0 5px 0;
}

.error-distancia-minima .error-message {
    color: #C92A2A;
    font-size: 12px;
    line-height: 1.4;
    margin: 3px 0;
}

.error-distancia-minima .error-message strong {
    font-weight: 800;
    font-size: 13px;
}

/* MENSAJE DE ERROR DISTANCIA MÍNIMA (Estilos base actualizados) */
.error-distancia-minima {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    text-align: center;
    color: #991b1b;
    animation: fadeIn 0.3s ease;
}

.error-distancia-minima .error-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

.error-distancia-minima h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #7f1d1d;
}

.error-distancia-minima .error-message {
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 10px;
}

.error-distancia-minima .error-info {
    font-size: 10px;
    padding: 6px;
    background: white;
    border-radius: 6px;
    margin-top: 8px;
    color: #004D40;
    line-height: 1.5;
}

.error-distancia-minima .error-phone {
    display: inline-block;
    margin-top: 3px;
    color: #15803d;
    font-weight: 800;
    font-size: 16px;
    text-decoration: none;
    transition: transform 0.2s;
}

.error-distancia-minima .error-phone:hover {
    transform: scale(1.05);
    text-decoration: underline;
}

.error-distancia-minima .error-phone:hover {
    transform: scale(1.05);
    text-decoration: underline;
}

/* DISEÑO RESPONSIVE - MÓVIL */
@media (max-width: 899px) {

    /* Contenedor principal en móvil */
    .calc-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    /* Mapa en móvil - Altura fija para que no ocupe toda la pantalla */
    .map-container {
        height: 50vh;
        /* 50% de la altura de la pantalla */
        min-height: 300px;
        max-height: 400px;
    }

    /* Panel de control en móvil */
    .control-panel {
        padding: 12px 15px 20px;
        height: auto;
        max-height: none;
        overflow-y: visible;
    }

    /* Títulos más pequeños en móvil */
    .calc-title {
        font-size: 22px;
        margin-bottom: 4px;
    }

    .calc-subtitle {
        font-size: 14px;
        margin-bottom: 12px;
    }

    /* Instrucciones más compactas */
    .instructions {
        padding: 12px;
        margin-bottom: 15px;
    }

    .instructions li {
        font-size: 13px;
    }

    /* Campos de entrada en móvil */
    .address-inputs {
        margin-bottom: 15px;
    }

    .input-group {
        margin-bottom: 12px;
    }

    .input-group label {
        font-size: 15px;
        margin-bottom: 5px;
    }

    .input-group input {
        padding: 10px;
        font-size: 15px;
    }

    /* Botones de acción en columna */
    .action-buttons {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 15px;
    }

    .btn-orange,
    .btn-secondary {
        width: 100%;
        padding: 12px 20px;
        font-size: 16px;
    }

    /* Resultados más compactos en móvil */
    .resultados {
        padding: 15px;
        margin-top: 15px;
    }

    .resultados h3 {
        font-size: 19px;
        margin-bottom: 12px;
    }

    .resultado-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
        padding: 8px 0;
    }

    .resultado-label {
        font-size: 14px;
    }

    .resultado-value {
        text-align: left;
        font-size: 15px;
    }

    .precio-destacado {
        padding: 10px 12px;
    }

    .precio-normal {
        font-size: 18px;
    }

    .precio-oferta {
        font-size: 21px;
    }

    .btn-reservar {
        font-size: 18px;
        padding: 14px 25px;
    }

    /* Botón volver más pequeño en móvil */
    .btn-volver-inicio {
        padding: 10px 15px;
        font-size: 14px;
        margin-top: 15px;
    }

    /* Barra de búsqueda responsive */
    .search-bar-container {
        width: 80%;
        top: 10px;
        gap: 8px;
    }

    #mapa-search-input {
        padding: 12px 15px;
        font-size: 14px;
    }

    .btn-location {
        min-width: 45px;
        height: 45px;
        font-size: 20px;
    }

    /* Panel de error más compacto en móvil */
    .error-distancia-minima {
        padding: 8px 10px;
        margin-top: 10px;
    }

    .error-distancia-minima .error-icon {
        font-size: 20px;
    }

    .error-distancia-minima h3 {
        font-size: 14px;
    }

    .error-distancia-minima .error-message {
        font-size: 11px;
        line-height: 1.4;
    }

    .error-distancia-minima .error-info {
        font-size: 10px;
        padding: 6px;
    }

    /* Panel content con padding específico para móvil */
    .panel-content {
        padding-bottom: 20px;
    }
}

/* DISEÑO RESPONSIVE - ESCRITORIO */
@media (min-width: 900px) {
    .calc-container {
        flex-direction: row;
        height: calc(100vh - 69px);
        overflow: hidden;
    }

    .map-container {
        flex: 1;
        height: 100%;
    }

    .control-panel {
        width: 450px;
        height: 100%;
        overflow-y: auto;
        box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
    }

    .control-panel::-webkit-scrollbar {
        width: 6px;
    }

    .control-panel::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 10px;
    }
}

/* OCULTAR CLASE */
.oculto {
    display: none !important;
}

/* INDICADOR DE CARGA */
.loading-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    text-align: center;
}

.loading-indicator::after {
    content: "";
    display: block;
    width: 30px;
    height: 30px;
    margin: 10px auto 0;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* AJUSTES PARA AUTOCOMPLETE DE GOOGLE */
.pac-container {
    z-index: 10000 !important;
    font-family: inherit;
    border-radius: 10px;
    margin-top: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: none;
}

.pac-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 15px;
    border-top: 1px solid #f0f0f0;
}

.pac-item:hover {
    background-color: #E8F5E9;
}

.pac-item-query {
    font-size: 15px;
    color: #333;
}

/* CLASE DE UTILIDAD PARA OCULTAR ELEMENTOS */
.oculto {
    display: none !important;
}

/* Inline Error Message */
.inline-error {
    color: #d32f2f;
    font-size: 0.9rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.inline-error::before {
    content: "⚠️";
}