/**
 * Lead Modal CSS — Modal de cotización 3 pasos (YourBestDev).
 * Debe cargarse SOLO en la plantilla de Servicios junto con lead-modal.js.
 * Coherente con el sistema de diseño del tema (glass, gradientes #5B5BF7/#22d3ee, Sora/Inter).
 */

/* ============ Overlay ============ */
.ybd-qm {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ybd-qm.is-open {
    display: flex;
}

body.ybd-qm-open {
    overflow: hidden;
}

.ybd-qm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 11, 29, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: ybdQmFade 0.25s ease;
}

.ybd-qm-panel {
    position: relative;
    width: min(92vw, 560px);
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(150deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 1.25rem;
    padding: 1.75rem;
    color: #e5e7eb;
    box-shadow: 0 30px 70px -25px rgba(0, 0, 0, 0.7);
    animation: ybdQmIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ybdQmFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes ybdQmIn {
    from { opacity: 0; transform: translateY(24px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.ybd-qm-panel::-webkit-scrollbar {
    width: 8px;
}
.ybd-qm-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.16);
    border-radius: 8px;
}
.ybd-qm-panel::-webkit-scrollbar-track {
    background: transparent;
}

/* ============ Cabecera ============ */
.ybd-qm-head {
    position: relative;
    text-align: center;
    padding: 0.25rem 0 1rem;
}

.ybd-qm-close {
    position: absolute;
    top: 0;
    right: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #cbd5e1;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.ybd-qm-close:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    transform: rotate(90deg);
}

.ybd-qm-icon {
    width: 52px;
    height: 52px;
    margin: 0 auto 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    border-radius: 1rem;
    background: linear-gradient(135deg, rgba(91, 91, 247, 0.3), rgba(34, 211, 238, 0.22));
    border: 1px solid rgba(91, 91, 247, 0.4);
}

.ybd-qm-eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #5B5BF7 0%, #22d3ee 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.ybd-qm-title {
    margin: 0;
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

/* ============ Progreso ============ */
.ybd-qm-progress {
    margin: 0.25rem 0 1.25rem;
}

.ybd-qm-progress-track {
    height: 6px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.ybd-qm-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 9999px;
    background: linear-gradient(90deg, #5B5BF7 0%, #22d3ee 100%);
    transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ybd-qm-steps {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
}

.ybd-qm-step {
    font-size: 0.72rem;
    font-weight: 600;
    color: #7c869c;
    transition: color 0.25s ease;
}

.ybd-qm-step.is-active {
    color: #22d3ee;
}

.ybd-qm-step.is-done {
    color: #5B5BF7;
}

/* ============ Formulario y pasos ============ */
.ybd-qm-page {
    display: none;
}

.ybd-qm-page.is-active {
    display: block;
}

.ybd-qm-step-title {
    margin: 0 0 1rem;
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.ybd-qm-grid,
.ybd-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.ybd-field {
    margin-bottom: 0.9rem;
}

.ybd-field > label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
}

.ybd-field input[type="text"],
.ybd-field input[type="email"],
.ybd-field input[type="tel"],
.ybd-field input[type="url"],
.ybd-field textarea,
.ybd-field select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    color: #e5e7eb;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.75rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.ybd-field select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, #22d3ee 50%), linear-gradient(135deg, #22d3ee 50%, transparent 50%);
    background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
    background-size: 5px 5px;
    background-repeat: no-repeat;
}

.ybd-field select option {
    background: #0d1330;
    color: #e5e7eb;
}

.ybd-field textarea {
    resize: vertical;
    min-height: 74px;
}

.ybd-field input:focus,
.ybd-field select:focus,
.ybd-field textarea:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.7);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

/* ============ Pills (radio) y chips (checkbox) ============ */
.ybd-radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ybd-pill {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.ybd-pill input,
.ybd-chip input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ybd-pill span {
    display: inline-block;
    padding: 0.5rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.ybd-pill:hover span {
    border-color: rgba(34, 211, 238, 0.5);
    color: #fff;
}

.ybd-pill input:focus-visible + span {
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.25);
}

.ybd-pill input:checked + span {
    background: linear-gradient(135deg, rgba(91, 91, 247, 0.45), rgba(34, 211, 238, 0.35));
    border-color: #22d3ee;
    color: #fff;
}

.ybd-chip span {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.6rem;
    transition: all 0.2s ease;
}

.ybd-chip:hover span {
    border-color: rgba(91, 91, 247, 0.6);
    color: #fff;
}

.ybd-chip input:checked + span {
    background: rgba(91, 91, 247, 0.4);
    border-color: #5B5BF7;
    color: #fff;
}

.ybd-conditional {
    transition: opacity 0.2s ease;
}

/* ============ Pager (paso 2) ============ */
.ybd-qm-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 0.75rem;
}

.ybd-qm-sub {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ybd-qm-sub:hover {
    color: #fff;
    border-color: rgba(34, 211, 238, 0.5);
}

.ybd-qm-page-ind {
    font-size: 0.8rem;
    font-weight: 600;
    color: #9aa3c2;
}

/* ============ Nota / Error / Éxito ============ */
.ybd-qm-note {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.78rem;
    line-height: 1.5;
    color: #9aa3c2;
    background: rgba(91, 91, 247, 0.1);
    border: 1px solid rgba(91, 91, 247, 0.25);
    border-radius: 0.75rem;
}

.ybd-qm-note p {
    margin: 0;
}

.ybd-qm-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: #fecaca;
    background: rgba(248, 113, 113, 0.12);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: 0.75rem;
}

.ybd-qm-success {
    display: none;
    text-align: center;
    padding: 2rem 0.5rem;
}

.ybd-qm-success-icon {
    width: 76px;
    height: 76px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    background: radial-gradient(circle at 30% 30%, #34d399, #10b981 70%);
    border-radius: 9999px;
    box-shadow: 0 0 40px rgba(52, 211, 153, 0.35);
}

.ybd-qm-success h3 {
    margin: 0 0 0.5rem;
    font-family: 'Sora', 'Inter', sans-serif;
    font-size: 1.2rem;
    color: #fff;
}

.ybd-qm-success p {
    margin: 0 0 1.5rem;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #9aa3c2;
}

/* ============ Navegación ============ */
.ybd-qm-nav {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.ybd-qm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.72rem 1.25rem;
    font-size: 0.88rem;
    font-weight: 600;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease, background 0.2s ease;
}

.ybd-qm-btn i {
    font-size: 0.8rem;
}

.ybd-qm-btn-primary {
    margin-left: auto;
    color: #fff;
    background: linear-gradient(135deg, #5B5BF7 0%, #7c7cf9 50%, #22d3ee 120%);
    border: none;
}

.ybd-qm-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px -12px rgba(91, 91, 247, 0.7);
    filter: brightness(1.05);
}

.ybd-qm-btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ybd-qm-btn-ghost {
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.ybd-qm-btn-ghost:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(34, 211, 238, 0.5);
}

/* ============ Responsive ============ */
@media (max-width: 480px) {
    .ybd-qm-panel {
        width: 100vw;
        max-height: 96vh;
        border-radius: 1rem 1rem 0 0;
        padding: 1.25rem;
    }

    .ybd-qm-grid,
    .ybd-grid {
        grid-template-columns: 1fr;
    }

    .ybd-qm-btn {
        flex: 1;
    }
}

/* ============ intl-tel-input (teléfono, paso 3) ============ */
.ybd-qm .iti {
    width: 100%;
    --iti-hover-color: rgba(91, 91, 247, 0.35);
    --iti-border-color: rgba(255, 255, 255, 0.14);
    --iti-country-selector-bg: #0d1330;
    --iti-icon-color: #9aa3c2;
}

.ybd-qm .iti .iti__tel-input {
    padding-left: 6rem;
}

.ybd-qm .iti__selected-country {
    color: #e5e7eb;
}

.ybd-qm .iti__selected-dial-code {
    font-size: 0.88rem;
    font-weight: 600;
    color: #cbd5e1;
}

.ybd-qm .iti__country-selector {
    color: #e5e7eb;
    box-shadow: 0 24px 48px -16px rgba(0, 0, 0, 0.7);
}

.ybd-qm .iti__country-list {
    color: #e5e7eb;
}

.ybd-qm .iti__country:hover,
.ybd-qm .iti__country.iti__highlight {
    background: rgba(91, 91, 247, 0.3);
}

.ybd-qm .iti__search-input-wrapper {
    border-bottom-color: rgba(255, 255, 255, 0.14);
}