/**
 * D2 Inquiry Modal — Styles
 * Reusable popup with multi-step funnel form
 * Include alongside d2-system.css
 */

/* ===== Overlay ===== */
.d2-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(7, 19, 31, .65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.d2-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Modal Container ===== */
.d2-modal {
    position: relative;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .3);
    transform: translateY(20px) scale(.97);
    transition: transform .3s ease;
}
.d2-modal-overlay.active .d2-modal {
    transform: translateY(0) scale(1);
}

/* ===== Close Button ===== */
.d2-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .1);
    color: rgba(255, 255, 255, .7);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
}
.d2-modal-close:hover {
    background: rgba(255, 255, 255, .2);
    color: #fff;
}

/* ===== Funnel inside modal — override max-width ===== */
.d2-modal .funnel {
    max-width: 100%;
    border-radius: 16px;
}

/* ===== Funnel Core Styles (duplicated for standalone use) ===== */
.d2-modal .funnel-header {
    background: var(--ink, #07131f);
    padding: 24px 28px 18px;
    color: #fff;
}
.d2-modal .funnel-header h3 {
    font-family: var(--ff-display, 'Space Grotesk', sans-serif);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: #fff;
}
.d2-modal .funnel-header p {
    font-size: .84rem;
    color: rgba(255, 255, 255, .6);
    margin-bottom: 14px;
}
.d2-modal .funnel-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.d2-modal .funnel-step-label,
.d2-modal .funnel-pct {
    font-family: var(--ff-mono, 'IBM Plex Mono', monospace);
    font-size: .72rem;
    color: rgba(255, 255, 255, .5);
}
.d2-modal .funnel-bar {
    height: 5px;
    background: rgba(255, 255, 255, .15);
    border-radius: 4px;
    overflow: hidden;
}
.d2-modal .funnel-bar-fill {
    height: 100%;
    background: #e67e22;
    border-radius: 4px;
    transition: width .4s ease;
}
.d2-modal .funnel-body {
    padding: 28px;
    background: #fff;
}
.d2-modal .funnel-body h4 {
    font-family: var(--ff-display, 'Space Grotesk', sans-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink, #07131f);
    margin-bottom: 6px;
}
.d2-modal .funnel-hint {
    font-size: .85rem;
    color: var(--slate, #64748b);
    margin-bottom: 20px;
}
.d2-modal .funnel-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}
.d2-modal .funnel-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    border: 2px solid var(--line-l, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s, background .2s, transform .15s;
    font-family: var(--ff-body, 'Inter', sans-serif);
    font-size: .82rem;
    font-weight: 500;
    color: var(--ink, #07131f);
    text-align: center;
}
.d2-modal .funnel-card svg {
    width: 28px;
    height: 28px;
    stroke: var(--slate, #64748b);
    fill: none;
    stroke-width: 1.5;
    transition: stroke .2s;
}
.d2-modal .funnel-card:hover {
    border-color: var(--teal, #2ebfa5);
    background: rgba(46, 191, 165, .03);
}
.d2-modal .funnel-card.selected {
    border-color: var(--teal, #2ebfa5);
    background: rgba(46, 191, 165, .06);
}
.d2-modal .funnel-card.selected svg {
    stroke: var(--teal, #2ebfa5);
}

.d2-modal .funnel-field {
    margin-bottom: 16px;
}
.d2-modal .funnel-field label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--ink, #07131f);
    margin-bottom: 6px;
}
.d2-modal .funnel-field input,
.d2-modal .funnel-field select,
.d2-modal .funnel-field textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--line-l, #e5e7eb);
    border-radius: 8px;
    font-size: .9rem;
    font-family: var(--ff-body, 'Inter', sans-serif);
    transition: border-color .2s;
    box-sizing: border-box;
}
.d2-modal .funnel-field input:focus,
.d2-modal .funnel-field select:focus,
.d2-modal .funnel-field textarea:focus {
    outline: none;
    border-color: var(--teal, #2ebfa5);
    box-shadow: 0 0 0 3px rgba(46, 191, 165, .1);
}
.d2-modal .funnel-field textarea {
    resize: vertical;
    min-height: 80px;
}
.d2-modal .funnel-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.d2-modal .funnel-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}
.d2-modal .funnel-back {
    background: none;
    border: none;
    font-size: .88rem;
    color: var(--slate, #64748b);
    cursor: pointer;
    font-family: var(--ff-body, 'Inter', sans-serif);
    padding: 8px 0;
}
.d2-modal .funnel-back:hover {
    color: var(--ink, #07131f);
}
.d2-modal .funnel-next:disabled,
.d2-modal .funnel-submit:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.d2-modal .funnel-success {
    text-align: center;
    padding: 48px 28px;
    background: #fff;
}
.d2-modal .funnel-success-icon {
    margin-bottom: 16px;
}
.d2-modal .funnel-success-icon svg {
    width: 56px;
    height: 56px;
    margin: 0 auto;
    display: block;
}
.d2-modal .funnel-success h4 {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .d2-modal-overlay {
        padding: 12px;
    }
    .d2-modal {
        max-width: 100%;
        max-height: 95vh;
    }
    .d2-modal .funnel-field-row {
        grid-template-columns: 1fr;
    }
    .d2-modal .funnel-cards {
        grid-template-columns: 1fr 1fr;
    }
    .d2-modal .funnel-body {
        padding: 20px;
    }
    .d2-modal .funnel-header {
        padding: 20px 20px 14px;
    }
}
