.container-consultar {
    position: relative;
    min-height: 80vh;
}

/* Desktop: el hero (absolute inset:0) llena el contenedor, así que su alto lo
   fija el min-height del contenedor. Que cubra toda la pantalla menos el navbar. */
@media (min-width: 901px) {
    .container-consultar {
        min-height: calc(100vh - var(--navbar-height));
    }
}

.container-consultar .liquid-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    --hero-a: #8eb2fa;
    --hero-b: #d68ffc;
}

.frente {
    position: absolute;
    inset: 0;
    z-index: 10;
    width: 80%;
    margin: 0 auto;
    padding: 32px 36px 48px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#status {
    align-self: center;
    min-height: 20px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

#view-results {
    padding-top: 4px;
}

/* A results view can be taller than the hero. The lookup form is vertically
   centered inside the fixed-height hero (.frente is absolute + centered), but
   for results we let .frente flow so the section grows to fit every card and
   the "Volver" button at the top stays visible instead of overflowing upward. */
.container-consultar.results-active {
    min-height: calc(100vh - var(--navbar-height));
    height: auto;
}

.container-consultar.results-active .frente {
    position: relative;
    inset: auto;
    justify-content: flex-start;
}

#status-results:not(:empty) {
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .9);
    color: #1f2937;
    font-size: 15px;
    font-weight: 600;
}

#btn-volver {
    margin-bottom: 20px;
}

.glass-btn:hover {
    color: #8d5aed;
}

#btn-aceptar:hover {
    background: rgb(104, 209, 153);
}
#btn-rechazar:hover {
    background: rgb(226, 117, 117);
}

.hero-text h1 {
    color: white;
    font-size: clamp(36px, 4vw, 54px);
    margin-bottom: 16px;
}

h1 {
    margin: 0 0 10px;
    font-size: 28px;
}

.lead {
    margin: 0 0 20px;
    color: rgb(55, 61, 79);
    text-shadow: none;
}

label {
    display: block;
    font-size: 13px;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
    margin-bottom: 6px;
}

#disclaimer p {
    margin-top: 20px;
    font-size: 13px;
    opacity: 0.9;
    text-align: center;
    max-width: 80%;
    text-shadow: none;
}

#disclaimer {
    display: flex;
    justify-content: center;
    grid-area: 2 / span 2;
}

/* Formulario */

.field {
    flex: 1;
    min-width: 160px;
}

.form-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.container-consultar input[type=text] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.5);
    color: rgb(33, 34, 50);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25);
}

.container-consultar input[type=text]::placeholder {
    color: rgba(87, 107, 162, 0.9);
}

.container-consultar input[type=text]:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.25),
        0 10px 25px rgba(47, 111, 237, 0.4);
}

.actions {
    margin-top: 18px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Loading spinner shown in place of the Consultar button label. */
#btn-consultar.is-loading {
    cursor: default;
}

.btn-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn-spinner {
        animation-duration: 1.5s;
    }
}

.secondary-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.secondary-actions .btn {
    padding: 10px 12px;
    border-radius: 12px;
}

/* Results */

#results-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.result-card {
    backdrop-filter: blur(20px);
    background: hsla(0, 0%, 100%, 0.8);
    border-radius: 12px;
    padding: 14px;
    color: var(--text);
    box-shadow: 0 8px 20px rgba(2, 6, 23, .06);
    margin-bottom: 12px;
}

.estado-badge {
    display: inline-block;
    padding: 5px 16px;
    border-radius: 9999px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.result-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 6px 0;
}

.result-key {
    min-width: 120px;
    color: var(--muted);
    font-weight: 600;
}

.result-value {
    flex: 1;
    color: var(--text);
}

.items-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.item {
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff, #fbfdff);
}

.estimate {
    display: inline-block;
    padding: 6px 10px;
    border-radius: 15px;
    background: linear-gradient(90deg, var(--primary), #5b8bff);
    color: #fff;
    font-weight: 700;
}

.consult-over-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: center;
}

.consult-over-hero .form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (max-width: 900px) {
    .consult-over-hero {
        display: flex;
        flex-direction: column;
        gap: 20px;
    }

    #btn-consultar, #btn-volver {
        padding: 12px 22px;
        font-size: 22px;
    }

    /* The hero gradient becomes the background of the whole section so it
       stretches to cover however tall the stacked content ends up. */
    .container-consultar .liquid-bg {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
    }

    /* Let .frente flow in the document instead of being pinned to the hero's
       fixed height — the container then grows to fit the form + disclaimer
       instead of clipping/overflowing them. */
    .frente {
        position: relative;
        inset: auto;
        width: 100%;
        padding: 24px 20px 40px;
        justify-content: flex-start;
    }

    #disclaimer p {
        max-width: 100%;
    }

    /* Narrow the input fields to 80% of the viewport and center them. */
    .consult-over-hero .form-row .field {
        width: 80vw;
        margin: 0 auto;
    }

    .actions {
        justify-content: center;
    }

    /* When results are showing, let the hero gradient fill the whole viewport
       (JS toggles .results-active on the container). */
    .container-consultar.results-active {
        min-height: 100vh;
        min-height: 100dvh;
    }
}
