/**
 * SMS Popup Discount — frontend + admin styles.
 * All animations are CSS-only (no JS-driven style changes beyond class toggles).
 */

:root {
    --spd-color-primary: #1a1a2e;
    --spd-color-accent: #e94560;
    --spd-color-bg: #ffffff;
    --spd-color-text: #222222;
    --spd-color-muted: #6b7280;
    --spd-radius: 12px;
    --spd-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.spd-visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Honeypot: visually hidden but present in the DOM/tab order for bots to fill. */
.spd-honeypot {
    position: absolute;
    left: -9999px;
    top: -9999px;
    height: 0;
    width: 0;
    overflow: hidden;
}

.spd-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(10, 10, 20, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    animation: spd-fade-in 0.25s ease forwards;
}

.spd-overlay[hidden] {
    display: none;
}

.spd-overlay.spd-closing {
    animation: spd-fade-out 0.2s ease forwards;
}

@keyframes spd-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes spd-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

.spd-popup {
    position: relative;
    background: var(--spd-color-bg);
    color: var(--spd-color-text);
    border-radius: var(--spd-radius);
    box-shadow: var(--spd-shadow);
    max-width: min(100%, var(--spd-popup-width, 460px));
    width: 100%;
    padding: 32px 28px 28px;
    text-align: var(--spd-popup-align, center);
    transform: translateY(16px) scale(0.98);
    opacity: 0;
    animation: spd-pop-in 0.3s 0.05s ease forwards;
}

@keyframes spd-pop-in {
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.spd-popup__close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    color: var(--spd-color-muted);
    padding: 4px 8px;
    border-radius: 6px;
}

.spd-popup__close:hover,
.spd-popup__close:focus-visible {
    color: var(--spd-color-text);
    background: rgba(0, 0, 0, 0.06);
}

.spd-popup__image-wrap {
    margin-bottom: 16px;
}

.spd-popup__image {
    display: block;
    width: 100%;
    max-height: 180px;
    object-fit: cover;
    border-radius: 10px;
}

.spd-popup__title {
    margin: 0 0 8px;
    font-size: var(--spd-title-font-size, 26px);
    font-weight: 700;
    color: var(--spd-color-primary);
}

.spd-popup__description {
    margin: 0 0 20px;
    font-size: var(--spd-description-font-size, 15px);
    color: var(--spd-color-muted);
    line-height: 1.5;
}

.spd-popup__form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.spd-popup__form--inline {
    gap: 10px;
}

.spd-popup__field-row {
    display: flex;
    gap: 8px;
}

.spd-popup__field-row--name {
    width: 100%;
}

.spd-popup__country,
.spd-popup__phone,
.spd-popup__name {
    font-size: var(--spd-input-font-size, 15px);
}

.spd-popup__country {
    flex: 0 0 40%;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.spd-popup__phone,
.spd-popup__name {
    flex: 1 1 auto;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
}

.spd-popup__phone:focus,
.spd-popup__country:focus,
.spd-popup__name:focus {
    outline: 2px solid var(--spd-color-accent);
    outline-offset: 1px;
}

.spd-popup__submit {
    background: var(--spd-color-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: var(--spd-button-font-size, 15px);
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.05s ease;
}

.spd-popup__submit:hover {
    filter: brightness(1.08);
}

.spd-popup__submit:active {
    transform: scale(0.99);
}

.spd-popup__submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.spd-popup__disclaimer {
    margin: 0;
    font-size: var(--spd-disclaimer-font-size, 12px);
    color: var(--spd-color-muted);
    line-height: 1.4;
}

.spd-popup__error,
.spd-popup__success {
    margin: 0;
    font-size: 13px;
    border-radius: 6px;
    padding: 8px 10px;
}

.spd-popup__error {
    background: #fee2e2;
    color: #991b1b;
}

.spd-popup__success {
    background: #dcfce7;
    color: #166534;
}

@media (max-width: 480px) {
    .spd-popup {
        padding: 24px 18px 20px;
    }

    .spd-popup__field-row {
        flex-direction: column;
    }

    .spd-popup__country {
        flex: 1 1 auto;
    }
}

/* ------------------------------------------------------------------ */
/* Admin screens                                                       */
/* ------------------------------------------------------------------ */

.spd-admin-wrap .title {
    margin-top: 28px;
}

.spd-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin: 16px 0;
}

.spd-status {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.spd-status--pending {
    background: #fef3c7;
    color: #92400e;
}

.spd-status--sent {
    background: #dcfce7;
    color: #166534;
}

.spd-status--sms_failed {
    background: #fee2e2;
    color: #991b1b;
}

.spd-status--test_mode {
    background: #e0e7ff;
    color: #3730a3;
}
