@import url("variables.css");

.lead-popup {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    padding: 0.75rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lead-popup.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.lead-popup__overlay {
    position: absolute;
    inset: 0;
    background: rgba(1, 46, 44, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.lead-popup__dialog {
    position: relative;
    z-index: 1;
    width: min(440px, 100%);
    overflow: hidden;
    border-radius: 1.1rem;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: linear-gradient(155deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 254, 243, 0.94) 100%);
    box-shadow:
        0 16px 40px rgba(2, 65, 63, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.lead-popup.is-open .lead-popup__dialog {
    transform: translateY(0) scale(1);
}

.lead-popup__gloss {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(120deg, rgba(255, 255, 255, 0.55) 0%, transparent 40%);
    z-index: 0;
}

.lead-popup__close {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    z-index: 3;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(2, 65, 63, 0.08);
    color: var(--color-text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
}

.lead-popup__close svg {
    width: 14px;
    height: 14px;
}

.lead-popup__header {
    position: relative;
    z-index: 1;
    padding: 1rem 1rem 0.35rem;
    text-align: center;
}

.lead-popup__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
    color: var(--color-text);
}

.lead-popup__subtitle {
    margin: 0.2rem 0 0;
    font-size: 0.72rem;
    line-height: 1.35;
    color: var(--color-text-muted);
}

.lead-popup__form {
    position: relative;
    z-index: 1;
    padding: 0.5rem 1rem 1rem;
    overflow: hidden;
}

.lead-popup__step {
    display: none;
}

.lead-popup__step.is-active {
    display: block;
}

.lead-popup__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem 0.55rem;
}

.lead-popup__field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.lead-popup__field--full {
    grid-column: 1 / -1;
    border: none;
    padding: 0;
    margin: 0;
}

.lead-popup__field label,
.lead-popup__field legend {
    font-size: 0.68rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    line-height: 1.2;
}

.lead-popup__field legend {
    margin-bottom: 0.25rem;
    padding: 0;
}

.lead-popup__field label span,
.lead-popup__field legend span {
    color: #e07a2f;
}

.lead-popup__field input,
.lead-popup__field select {
    width: 100%;
    min-height: 34px;
    padding: 0.4rem 0.55rem;
    border-radius: 0.55rem;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.9);
    font-family: var(--font-family-base);
    font-size: 0.78rem;
    color: var(--color-text);
}

.lead-popup__field input:focus,
.lead-popup__field select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(2, 65, 63, 0.1);
}

.lead-popup__service-options {
    display: flex;
    gap: 0.4rem;
}

.lead-popup__service-pill {
    flex: 1;
    cursor: pointer;
    min-width: 0;
}

.lead-popup__service-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lead-popup__service-pill span {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-height: 34px;
    padding: 0.35rem 0.5rem;
    border-radius: 0.55rem;
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.85);
    font-size: 0.72rem;
    font-weight: var(--font-weight-semibold);
    color: var(--color-text);
    white-space: nowrap;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.lead-popup__service-pill input:checked + span {
    border-color: var(--color-primary);
    background: rgba(2, 65, 63, 0.08);
    color: var(--color-primary);
}

.lead-popup__conditional {
    margin: 0;
    padding: 0;
    border: none;
}

.lead-popup__message {
    min-height: 0.85rem;
    margin: 0 0 0.35rem;
    font-size: 0.7rem;
    font-weight: var(--font-weight-medium);
    text-align: center;
}

.lead-popup__message:empty {
    display: none;
}

.lead-popup__message.is-error {
    color: #c0392b;
}

.lead-popup__message.is-success {
    color: var(--color-primary);
}

.lead-popup__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.lead-popup__skip,
.lead-popup__back {
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-family: var(--font-family-base);
    font-size: 0.72rem;
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    padding: 0.35rem 0;
}

.lead-popup__skip:hover,
.lead-popup__back:hover,
.lead-popup__skip:focus-visible,
.lead-popup__back:focus-visible {
    color: var(--color-primary);
}

.lead-popup__form .btn--primary {
    min-height: 36px;
    padding: 0.45rem 1rem;
    font-size: 0.78rem;
}

.lead-popup__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

body.lead-popup-open {
    overflow: hidden;
}

@media (max-width: 400px) {
    .lead-popup__grid {
        grid-template-columns: 1fr;
    }

    .lead-popup__service-options {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    .lead-popup,
    .lead-popup__dialog {
        transition: none;
    }
}
