/* ================================================
   LEAD CAPTURE MODAL - Zen Design System
   ================================================ */

/* ---------- Modal Base ---------- */
.lead-modal {
    position: fixed;
    inset: 0;
    z-index: 10002;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s var(--ease-out-expo), visibility 0.5s;
}

.lead-modal.active {
    opacity: 1;
    visibility: visible;
}

.lead-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 8, 12, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.lead-modal-container {
    position: relative;
    width: 100%;
    max-width: 680px;
    max-height: 90vh;
    margin: 20px;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9ff 100%);
    border-radius: var(--radius-xl);
    box-shadow:
        0 50px 100px -20px rgba(0, 0, 0, 0.5),
        0 30px 60px -30px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    overflow: hidden;
    transform: scale(0.9) translateY(40px);
    transition: transform 0.6s var(--ease-out-expo);
}

.lead-modal.active .lead-modal-container {
    transform: scale(1) translateY(0);
}

/* ---------- Close Button ---------- */
.lead-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.08);
    border: none;
    border-radius: 50%;
    color: var(--color-primary);
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    z-index: 10;
}

.lead-modal-close:hover {
    background: var(--color-primary);
    color: white;
    transform: rotate(90deg);
}

/* ---------- Progress Bar ---------- */
.lead-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(99, 102, 241, 0.1);
    overflow: hidden;
}

.lead-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary-light) 50%, #a855f7 100%);
    background-size: 200% 100%;
    animation: progressGlow 2s linear infinite;
    transition: width 0.6s var(--ease-out-expo);
}

@keyframes progressGlow {
    0% { background-position: 0% 0%; }
    100% { background-position: 200% 0%; }
}

/* ---------- Step Indicators ---------- */
.lead-steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px 0 0;
}

.lead-step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.2);
    transition: all 0.4s var(--ease-out-expo);
    cursor: pointer;
}

.lead-step-dot.active {
    width: 32px;
    border-radius: 10px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
}

.lead-step-dot.completed {
    background: var(--color-primary);
}

/* ---------- Steps Container ---------- */
.lead-steps {
    position: relative;
    padding: 40px 48px 48px;
    overflow-y: auto;
    max-height: calc(90vh - 60px);
}

.lead-step {
    display: none;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}

.lead-step.active {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.lead-step.exit {
    display: block;
    opacity: 0;
    transform: translateX(-30px);
}

/* ---------- Welcome Step ---------- */
.lead-welcome {
    text-align: center;
    padding: 40px 20px;
}

.lead-welcome-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
    border-radius: 50%;
    animation: welcomePulse 3s ease-in-out infinite;
}

.lead-welcome-icon svg {
    color: var(--color-primary);
}

@keyframes welcomePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3); }
    50% { transform: scale(1.05); box-shadow: 0 0 40px 20px rgba(99, 102, 241, 0); }
}

.lead-welcome-title {
    font-family: var(--font-display);
    font-size: clamp(28px, 5vw, 42px);
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lead-text-gradient {
    background: linear-gradient(135deg, var(--color-primary) 0%, #a855f7 50%, var(--color-primary-light) 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.lead-text-animate {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.8s var(--ease-out-expo) forwards;
}

.lead-text-animate:nth-child(1) { animation-delay: 0.2s; }
.lead-text-animate:nth-child(2) { animation-delay: 0.4s; }
.lead-text-animate:nth-child(3) { animation-delay: 0.6s; }
.lead-text-animate:nth-child(4) { animation-delay: 0.8s; }

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.lead-welcome-text {
    font-size: clamp(16px, 2.5vw, 20px);
    color: #4a4a5a;
    line-height: 1.6;
    margin-bottom: 12px;
}

.lead-welcome-subtext {
    font-size: 15px;
    color: #7a7a8a;
}

/* ---------- Step Header ---------- */
.lead-step-header {
    margin-bottom: 32px;
    text-align: center;
}

.lead-step-number {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 16px;
}

.lead-step-title {
    font-family: var(--font-display);
    font-size: clamp(22px, 4vw, 28px);
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 10px;
}

.lead-step-subtitle {
    font-size: 15px;
    color: #6a6a7a;
}

/* ---------- Multiselect Hint ---------- */
.lead-multiselect-hint {
    text-align: center;
    font-size: 13px;
    color: var(--color-primary);
    background: rgba(99, 102, 241, 0.08);
    padding: 8px 16px;
    border-radius: 20px;
    margin-bottom: 20px;
    display: inline-block;
    width: auto;
    margin-left: auto;
    margin-right: auto;
}

.lead-step-header + .lead-multiselect-hint {
    display: block;
    width: fit-content;
    margin: 0 auto 20px;
}

/* ---------- Services Grid ---------- */
.lead-services-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.lead-service-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lead-service-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: #ffffff;
    border: 2px solid rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    position: relative;
}

.lead-service-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.02);
    transform: translateX(4px);
}

.lead-service-option input:checked + .lead-service-card {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.05) 100%);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.15);
}

/* Service Checkbox Indicator */
.lead-service-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    background: rgba(99, 102, 241, 0.1);
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s var(--ease-out-expo);
}

.lead-service-checkbox svg {
    opacity: 0;
    transform: scale(0);
    color: white;
    transition: all 0.2s var(--ease-out-expo);
}

.lead-service-option input:checked + .lead-service-card .lead-service-checkbox {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.lead-service-option input:checked + .lead-service-card .lead-service-checkbox svg {
    opacity: 1;
    transform: scale(1);
}

.lead-service-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    flex-shrink: 0;
    transition: all 0.3s var(--ease-out-expo);
}

.lead-service-option input:checked + .lead-service-card .lead-service-icon {
    background: var(--color-primary);
    color: white;
}

.lead-service-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    padding-right: 30px;
}

.lead-service-text {
    font-size: 14px;
    font-weight: 600;
    color: #2a2a3a;
    line-height: 1.3;
}

.lead-service-desc {
    font-size: 12px;
    font-weight: 400;
    color: #6b7280;
    line-height: 1.4;
}

.lead-service-option input:checked + .lead-service-card .lead-service-desc {
    color: rgba(99, 102, 241, 0.8);
}

/* ---------- Form Styles ---------- */
.lead-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.lead-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.lead-form-group {
    position: relative;
}

.lead-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #3a3a4a;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lead-input,
.lead-select,
.lead-textarea {
    width: 100%;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 15px;
    color: #1a1a2e;
    background: #ffffff;
    border: 2px solid rgba(99, 102, 241, 0.12);
    border-radius: var(--radius-sm);
    outline: none;
    transition: all 0.3s var(--ease-out-expo);
}

.lead-input:focus,
.lead-select:focus,
.lead-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.lead-input::placeholder,
.lead-textarea::placeholder {
    color: #a0a0b0;
}

.lead-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 44px;
}

.lead-textarea {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

.lead-char-count {
    position: absolute;
    bottom: 12px;
    right: 14px;
    font-size: 12px;
    color: #a0a0b0;
}

/* ---------- Phone Input ---------- */
.lead-phone-wrapper {
    display: flex;
    position: relative;
}

.lead-phone-prefix {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 16px;
    background: rgba(99, 102, 241, 0.05);
    border: 2px solid rgba(99, 102, 241, 0.12);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
    user-select: none;
}

.lead-phone-prefix:hover {
    background: rgba(99, 102, 241, 0.1);
}

.lead-phone-flag {
    font-size: 20px;
    line-height: 1;
}

.lead-phone-code {
    font-size: 14px;
    font-weight: 600;
    color: #3a3a4a;
}

.lead-phone-prefix svg {
    color: #7a7a8a;
    transition: transform 0.3s;
}

.lead-phone-prefix.open svg {
    transform: rotate(180deg);
}

.lead-phone-input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    flex: 1;
}

/* ---------- Country Dropdown ---------- */
.lead-country-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: 280px;
    background: #ffffff;
    border: 2px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s var(--ease-out-expo);
    overflow: hidden;
}

.lead-country-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lead-country-search {
    padding: 12px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.lead-country-search input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: var(--radius-sm);
    outline: none;
}

.lead-country-search input:focus {
    border-color: var(--color-primary);
}

.lead-country-list {
    max-height: 200px;
    overflow-y: auto;
}

.lead-country-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.lead-country-item:hover {
    background: rgba(99, 102, 241, 0.05);
}

.lead-country-item.selected {
    background: rgba(99, 102, 241, 0.1);
}

.lead-country-item-flag {
    font-size: 20px;
}

.lead-country-item-name {
    flex: 1;
    font-size: 14px;
    color: #3a3a4a;
}

.lead-country-item-code {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary);
}

/* ---------- Checkbox ---------- */
.lead-checkbox-group {
    margin-top: 8px;
}

.lead-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
}

.lead-checkbox-label input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.lead-checkbox-custom {
    width: 22px;
    height: 22px;
    background: #ffffff;
    border: 2px solid rgba(99, 102, 241, 0.2);
    border-radius: 6px;
    flex-shrink: 0;
    position: relative;
    transition: all 0.3s var(--ease-out-expo);
}

.lead-checkbox-custom::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 7px;
    width: 5px;
    height: 10px;
    border: 2px solid white;
    border-top: none;
    border-left: none;
    transform: rotate(45deg) scale(0);
    transition: transform 0.2s var(--ease-out-expo);
}

.lead-checkbox-label input:checked + .lead-checkbox-custom {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.lead-checkbox-label input:checked + .lead-checkbox-custom::after {
    transform: rotate(45deg) scale(1);
}

.lead-checkbox-text {
    font-size: 14px;
    color: #5a5a6a;
    line-height: 1.5;
}

.lead-checkbox-text a {
    color: var(--color-primary);
    text-decoration: underline;
}

/* ---------- Step Actions ---------- */
.lead-step-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(99, 102, 241, 0.1);
}

/* ---------- Buttons ---------- */
.lead-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s var(--ease-out-expo);
}

.lead-btn-next,
.lead-btn-submit {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.lead-btn-next:hover:not(:disabled),
.lead-btn-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.lead-btn-next:disabled,
.lead-btn-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.lead-btn-back {
    background: transparent;
    color: #6a6a7a;
    border: 2px solid rgba(99, 102, 241, 0.15);
}

.lead-btn-back:hover {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--color-primary);
}

.lead-btn-close {
    background: var(--color-primary);
    color: white;
    padding: 16px 40px;
    margin-top: 24px;
}

.lead-btn-close:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}

/* Submit Button States */
.lead-btn-submit {
    position: relative;
    min-width: 180px;
}

.lead-btn-submit .lead-btn-loading,
.lead-btn-submit .lead-btn-success {
    position: absolute;
    display: none;
}

.lead-btn-submit.loading .lead-btn-text,
.lead-btn-submit.loading .lead-btn-arrow {
    opacity: 0;
}

.lead-btn-submit.loading .lead-btn-loading {
    display: block;
    animation: spin 1s linear infinite;
}

.lead-btn-submit.success .lead-btn-text,
.lead-btn-submit.success .lead-btn-arrow {
    opacity: 0;
}

.lead-btn-submit.success .lead-btn-success {
    display: block;
    animation: successPop 0.4s var(--ease-out-expo);
}

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

@keyframes successPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* ---------- Success Step ---------- */
.lead-success {
    text-align: center;
    padding: 40px 20px;
}

.lead-success-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    height: 120px;
    margin-bottom: 32px;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(52, 211, 153, 0.1) 100%);
    border-radius: 50%;
    animation: successPulse 2s ease-in-out infinite;
}

.lead-success-icon svg {
    color: #10b981;
}

@keyframes successPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.3); }
    50% { box-shadow: 0 0 40px 20px rgba(16, 185, 129, 0); }
}

.lead-success-title {
    font-family: var(--font-display);
    font-size: clamp(24px, 4vw, 32px);
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 16px;
}

.lead-success-text {
    font-size: 16px;
    color: #4a4a5a;
    line-height: 1.6;
    margin-bottom: 12px;
}

.lead-success-subtext {
    font-size: 14px;
    color: #8a8a9a;
}

/* ---------- Scrollbar (Invisible but functional) ---------- */
.lead-steps {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.lead-steps::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

.lead-country-dropdown {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.lead-country-dropdown::-webkit-scrollbar {
    display: none;
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 768px) {
    .lead-modal-container {
        margin: 0;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }

    .lead-steps {
        padding: 30px 24px 40px;
        max-height: calc(100vh - 50px);
    }

    .lead-welcome {
        padding: 20px 0;
    }

    .lead-welcome-icon {
        width: 100px;
        height: 100px;
        margin-bottom: 24px;
    }

    .lead-welcome-icon svg {
        width: 60px;
        height: 60px;
    }

    .lead-form-row {
        grid-template-columns: 1fr;
    }

    .lead-step-actions {
        flex-direction: column-reverse;
    }

    .lead-btn {
        width: 100%;
        justify-content: center;
    }

    .lead-phone-prefix {
        padding: 14px 12px;
    }

    .lead-phone-code {
        font-size: 13px;
    }

    .lead-service-card {
        padding: 14px 16px;
    }

    .lead-service-icon {
        width: 42px;
        height: 42px;
    }

    .lead-service-text {
        font-size: 13px;
    }

    .lead-textarea {
        min-height: 120px;
    }
}

@media (max-width: 480px) {
    .lead-steps {
        padding: 24px 20px 36px;
    }

    .lead-step-number {
        font-size: 12px;
        padding: 5px 12px;
    }

    .lead-step-title {
        font-size: 20px;
    }

    .lead-step-subtitle {
        font-size: 14px;
    }

    .lead-input,
    .lead-select,
    .lead-textarea {
        padding: 12px 14px;
        font-size: 14px;
    }

    .lead-checkbox-text {
        font-size: 13px;
    }

    .lead-btn {
        padding: 12px 24px;
        font-size: 14px;
    }
}

/* ---------- Animation Classes ---------- */
.lead-modal.active .lead-step.active .lead-text-animate {
    animation: fadeInUp 0.8s var(--ease-out-expo) forwards;
}

/* Prevent body scroll when modal is open */
body.lead-modal-open {
    overflow: hidden;
}
