/* ============================================
   SMS Opt-In Popup — popup.css
   ============================================ */

/* --- Overlay --- */
#sop-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
#sop-overlay[hidden] {
    display: flex !important; /* keep flex for transition */
    opacity: 0;
    pointer-events: none;
}
#sop-overlay.sop-visible {
    opacity: 1;
    pointer-events: all;
}

/* Modal stack (centers white card) */
.sop-overlay-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
}
/* Logo inside white modal, below close control */
#sop-modal .sop-logo-wrap {
    flex-shrink: 0;
    line-height: 0;
    text-align: center;
    margin: 0 2.5rem 1rem;
}
.sop-popup-logo {
    display: block;
    margin: 0 auto;
    max-width: min(240px, 70vw);
    width: 100%;
    height: auto;
}

/* --- Modal --- */
#sop-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25), 0 0 0 1px rgba(0,0,0,0.05);
    width: 100%;
    max-width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    max-height: 90vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    transform: translateY(24px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
}
#sop-overlay.sop-visible #sop-modal {
    transform: translateY(0) scale(1);
}

/* --- Close Button --- */
#sop-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #64748b;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
#sop-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* --- Header (popup + embed) --- */
.sop-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.sop-title-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}
.sop-heading-title {
    margin: 0 0 0.25rem;
    font-size: 1.35rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.sop-heading-subtitle {
    margin: 0;
    font-size: 0.9rem;
    color: #64748b;
}

/* --- Form --- */
form.sop-sms-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sop-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.sop-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.sop-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sop-req-star {
    color: #ef4444;
}
.sop-field input[type="text"],
.sop-field input[type="tel"],
.sop-field input[type="email"] {
    width: 100%;
    padding: 0.6rem 0.85rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.sop-field input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
    background: #fff;
}
.sop-field input.sop-error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
}

.sop-field-note {
    margin: 0.3rem 0 0;
    font-size: 0.75rem;
    color: #94a3b8;
    line-height: 1.4;
}

/* --- Consent Boxes --- */
.sop-consent {
    border-radius: 10px;
    padding: 0.9rem;
    border-left: 4px solid transparent;
}
.sop-consent--transactional {
    background: #f0fdf4;
    border-left-color: #22c55e;
}
.sop-consent--transactional.sop-consent-invalid {
    background: #fef2f2;
    border-left-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.35);
}
.sop-consent--marketing {
    background: #fafaf9;
    border-left-color: #f59e0b;
}

.sop-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    cursor: pointer;
}
.sop-checkbox-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    min-width: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    margin-top: 2px;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
}
.sop-checkbox-label input[type="checkbox"]:checked {
    background: #6366f1;
    border-color: #6366f1;
}
.sop-checkbox-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}
.sop-consent-text {
    font-size: 0.8rem;
    color: #475569;
    line-height: 1.5;
}
.sop-consent-text strong {
    color: #1e293b;
}
.sop-optional-note {
    margin: 0.5rem 0 0 1.7rem;
    font-size: 0.75rem;
    color: #92400e;
    background: #fef3c7;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    display: inline-block;
}

/* --- Submit Button --- */
form.sop-sms-form .sop-submit {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    letter-spacing: 0.02em;
    transition: filter 0.2s, transform 0.15s;
    margin-top: 0.25rem;
}
form.sop-sms-form .sop-submit:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}
form.sop-sms-form .sop-submit:active {
    transform: translateY(0);
}
form.sop-sms-form .sop-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* --- Legal text --- */
.sop-legal {
    font-size: 0.72rem;
    color: #94a3b8;
    text-align: center;
    margin: 0;
    line-height: 1.5;
}
.sop-legal a {
    color: #6366f1;
    text-decoration: underline;
}
.sop-legal strong {
    color: #64748b;
}

/* --- Response Message --- */
form.sop-sms-form .sop-form-message {
    font-size: 0.875rem;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    display: none;
}
form.sop-sms-form .sop-form-message.sop-success {
    display: block;
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}
form.sop-sms-form .sop-form-message.sop-error {
    display: block;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

/* --- Full-page embed (/sms-form/ etc.) --- */
.sop-embed {
    max-width: 540px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}
.sop-embed-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.05);
    padding: 2rem;
    position: relative;
    font-family: -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: #1e293b;
}
.sop-embed-card .sop-logo-wrap {
    text-align: center;
    margin: 0 0 1rem;
}

/* --- Manual trigger button --- */
.sop-trigger-btn {
    display: inline-block;
    padding: 0.6rem 1.25rem;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.sop-trigger-btn:hover {
    background: #4f46e5;
}

/* --- Responsive --- */
@media (max-width: 480px) {
    #sop-modal {
        padding: 1.5rem 1.25rem;
    }
    #sop-modal .sop-logo-wrap {
        margin: 0 0.5rem 0.75rem;
    }
    .sop-embed-card {
        padding: 1.5rem 1.25rem;
    }
    .sop-row {
        grid-template-columns: 1fr;
    }
}
