/* TDI Popup Leads — v1.1.0 */

/* ─── OVERLAY ─────────────────────────────── */
#tdi-popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}
#tdi-popup-overlay.tdi-visible {
    opacity: 1;
}
#tdi-popup-overlay[hidden] {
    display: none !important;
}

/* ─── MODAL ────────────────────────────────── */
#tdi-popup-modal {
    position: relative;
    display: flex;
    flex-direction: row;
    width: 100%;
    max-width: 820px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#tdi-popup-overlay.tdi-visible #tdi-popup-modal {
    transform: translateY(0) scale(1);
}

/* ─── IMAGE PANEL ──────────────────────────── */
/* Single image (Complementos-comp.jpg) for all viewports, object-fit: contain */
#tdi-popup-image-wrap {
    flex: 0 0 40%;
    background-color: #0d1f2d; /* dark navy matches TDI brand — fills contain letterbox */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-height: 440px;
}
#tdi-popup-image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    display: block;
    max-height: 90vh;
}

/* ─── CONTENT PANEL ─────────────────────────── */
#tdi-popup-content {
    flex: 1 1 60%;
    display: flex;
    flex-direction: column;
    padding: 36px 32px 28px;
    overflow-y: auto;
    max-height: 90vh;
    box-sizing: border-box;
}

/* ─── HEADER ────────────────────────────────── */
#tdi-popup-header {
    margin-bottom: 22px;
}
#tdi-popup-title {
    font-size: clamp(1.05rem, 2vw, 1.35rem);
    font-weight: 700;
    line-height: 1.3;
    color: #0d1f2d;
    margin: 0 0 8px;
    font-family: inherit;
}
#tdi-popup-desc {
    font-size: 0.84rem;
    color: #5a6270;
    line-height: 1.55;
    margin: 0;
}

/* ─── FORM FIELDS ───────────────────────────── */
.tdilp-field {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px; /* intentionally small — error span provides the spacing */
}
.tdilp-field label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #2c3340;
    margin-bottom: 5px;
    letter-spacing: 0.015em;
    text-transform: uppercase;
}
.tdilp-req {
    color: #c0392b;
    margin-left: 2px;
}
.tdilp-opt {
    color: #9ba3ae;
    font-weight: 400;
    font-size: 0.72rem;
    margin-left: 3px;
    text-transform: none;
}
.tdilp-field input[type="text"],
.tdilp-field input[type="email"],
.tdilp-field input[type="tel"] {
    padding: 10px 14px;
    border: 1.5px solid #dce0e8;
    border-radius: 9px;
    font-size: 0.88rem;
    color: #0d1f2d;
    background: #f8f9fb;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    box-sizing: border-box;
}
.tdilp-field input[type="text"]:focus,
.tdilp-field input[type="email"]:focus,
.tdilp-field input[type="tel"]:focus {
    border-color: #00998f;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0, 153, 143, 0.13);
}
.tdilp-field input.tdilp-invalid {
    border-color: #d93025;
    box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.1);
    background: #fff;
}
.tdilp-field input.tdilp-invalid:focus {
    border-color: #d93025;
    box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.14);
}

/* ─── ERROR TEXT — hidden when empty, animates in with content ─ */
.tdilp-err {
    font-size: 0.72rem;
    color: #d93025;
    line-height: 1.4;
    display: block;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    margin-bottom: 0;
    transition: max-height 0.18s ease, opacity 0.18s ease, margin 0.18s ease;
}
.tdilp-err:not(:empty) {
    max-height: 3em;
    opacity: 1;
    margin-top: 4px;
    margin-bottom: 6px;
}

/* ─── CONSENT ───────────────────────────────── */
.tdilp-consent-field {
    margin-top: 4px;
}
.tdilp-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    border: 1.5px solid #dce0e8;
    border-radius: 9px;
    background: #f8f9fb;
    transition: border-color 0.18s, background 0.18s;
}
.tdilp-consent-label:hover {
    border-color: #00998f;
    background: #f0faf9;
}
.tdilp-consent-label input[type="checkbox"] {
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    margin-top: 1px;
    cursor: pointer;
    accent-color: #00998f;
}
.tdilp-consent-label span {
    font-size: 0.77rem;
    color: #4a5568;
    line-height: 1.5;
}

/* ─── GLOBAL MESSAGE BOX ─────────────────────── */
#tdilp-form-messages {
    border-radius: 9px;
    padding: 10px 14px;
    font-size: 0.82rem;
    margin-bottom: 12px;
    line-height: 1.45;
    display: none; /* JS toggles this */
}
#tdilp-form-messages.tdi-msg-active {
    display: block;
}
#tdilp-form-messages.tdi-msg-success {
    background: #e6f7f6;
    color: #00665f;
    border: 1px solid #99d4d0;
}
#tdilp-form-messages.tdi-msg-error {
    background: #fdf1f0;
    color: #a42a1e;
    border: 1px solid #f4b0aa;
}

/* ─── SUBMIT BUTTON ─────────────────────────── */
#tdilp-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 8px;
    padding: 13px 24px;
    background: #00998f;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    letter-spacing: 0.025em;
    transition: background 0.2s, opacity 0.2s, transform 0.15s, box-shadow 0.2s;
    box-shadow: 0 4px 16px rgba(0, 153, 143, 0.32);
}
#tdilp-submit-btn:hover:not(:disabled) {
    background: #007a71;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(0, 153, 143, 0.42);
}
#tdilp-submit-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 3px 10px rgba(0, 153, 143, 0.3);
}
#tdilp-submit-btn:focus-visible {
    outline: 3px solid #66ccc7;
    outline-offset: 3px;
}
#tdilp-submit-btn:disabled {
    background: #9db5b4;
    box-shadow: none;
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ─── SPINNER ───────────────────────────────── */
.tdilp-btn-spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tdi-spin 0.7s linear infinite;
    flex-shrink: 0;
}
@keyframes tdi-spin {
    to { transform: rotate(360deg); }
}

/* ─── CLOSE BUTTON ──────────────────────────── */
#tdi-popup-close {
    position: absolute;
    top: 12px;
    right: 14px;
    z-index: 10;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #2c3340;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: background 0.18s, transform 0.15s, box-shadow 0.18s;
    padding: 0;
    line-height: 0;
}
#tdi-popup-close:hover {
    background: #fff;
    transform: scale(1.1);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.25);
}
#tdi-popup-close:focus-visible {
    outline: 3px solid #00998f;
    outline-offset: 2px;
}

/* ─── HONEYPOT ───────────────────────────────── */
.tdilp-hp {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    tabindex: -1;
}

/* ─── MOBILE (≤ 640px) ───────────────────────── */
@media (max-width: 640px) {
    #tdi-popup-overlay {
        padding: 0;
        align-items: flex-end;
    }
    #tdi-popup-modal {
        flex-direction: column;
        max-width: 100%;
        width: 100%;
        max-height: 94vh;
        border-radius: 20px 20px 0 0;
        transform: translateY(100%);
    }
    #tdi-popup-overlay.tdi-visible #tdi-popup-modal {
        transform: translateY(0);
    }
    #tdi-popup-image-wrap {
        flex: 0 0 auto;
        height: 200px;
        min-height: 0;
        width: 100%;
    }
    #tdi-popup-image-wrap img {
        height: 200px;
        max-height: 200px;
    }
    #tdi-popup-content {
        padding: 22px 18px 24px;
        flex: 1;
        overflow-y: auto;
    }
    #tdi-popup-title {
        font-size: 1rem;
    }
    #tdi-popup-desc {
        font-size: 0.8rem;
    }
    #tdi-popup-header {
        margin-bottom: 16px;
    }
    #tdi-popup-close {
        top: 10px;
        right: 10px;
    }
    #tdilp-submit-btn {
        padding: 12px 20px;
    }
}

/* ─── TABLET (641–900px) ─────────────────────── */
@media (min-width: 641px) and (max-width: 900px) {
    #tdi-popup-modal {
        max-width: 680px;
    }
    #tdi-popup-image-wrap {
        flex: 0 0 38%;
        min-height: 380px;
    }
    #tdi-popup-content {
        padding: 28px 24px;
    }
}
