/* Smart Popup Tracker - Popup Styles */

/* ─── Overlay ─────────────────────────────────────────────────────────────── */
.spt-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(3px);
}

.spt-popup-overlay.spt-active {
    opacity: 1;
}

/* ─── Modal Container ─────────────────────────────────────────────────────── */
.spt-popup-modal {
    position: relative;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.28);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow: hidden;
    transform: scale(0.92) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-sizing: border-box;
}

.spt-popup-overlay.spt-active .spt-popup-modal {
    transform: scale(1) translateY(0);
}

/* ─── Position Variants ───────────────────────────────────────────────────── */
.spt-popup-modal.spt-position-top {
    align-self: flex-start;
    margin-top: 5vh;
}

.spt-popup-modal.spt-position-bottom {
    align-self: flex-end;
    margin-bottom: 5vh;
}

.spt-popup-modal.spt-position-center {
    align-self: center;
}

/* ─── Close Button ────────────────────────────────────────────────────────── */
.spt-popup-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.spt-popup-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.spt-popup-close:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ─── Content Container ───────────────────────────────────────────────────── */
.spt-popup-content {
    padding: 32px 28px;
    overflow-y: auto;
    max-height: calc(100vh - 80px);
    box-sizing: border-box;
}

/* Custom Scrollbar */
.spt-popup-content::-webkit-scrollbar {
    width: 6px;
}

.spt-popup-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.spt-popup-content::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 10px;
}

.spt-popup-content::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* ─── Typography ──────────────────────────────────────────────────────────── */
.spt-popup-content h1,
.spt-popup-content h2,
.spt-popup-content h3 {
    margin-top: 0;
    margin-bottom: 14px;
    color: #1d2327;
    line-height: 1.3;
}

.spt-popup-content h1 {
    font-size: 26px;
}

.spt-popup-content h2 {
    font-size: 22px;
}

.spt-popup-content h3 {
    font-size: 18px;
}

.spt-popup-content p {
    margin-bottom: 14px;
    line-height: 1.65;
    color: #3c434a;
    font-size: 15px;
}

/* ─── Form Elements ───────────────────────────────────────────────────────── */
.spt-popup-content form {
    margin: 0;
}

.spt-popup-content label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    font-size: 14px;
    color: #1d2327;
}

.spt-popup-content input[type="text"],
.spt-popup-content input[type="email"],
.spt-popup-content input[type="tel"],
.spt-popup-content input[type="url"],
.spt-popup-content input[type="number"],
.spt-popup-content textarea,
.spt-popup-content select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    margin-bottom: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.spt-popup-content input[type="text"]:focus,
.spt-popup-content input[type="email"]:focus,
.spt-popup-content input[type="tel"]:focus,
.spt-popup-content input[type="url"]:focus,
.spt-popup-content input[type="number"]:focus,
.spt-popup-content textarea:focus,
.spt-popup-content select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.15);
}

.spt-popup-content textarea {
    min-height: 100px;
    resize: vertical;
}

.spt-popup-content input[type="checkbox"],
.spt-popup-content input[type="radio"] {
    margin-right: 8px;
    vertical-align: middle;
}

.spt-popup-content button[type="submit"],
.spt-popup-content input[type="submit"] {
    background: #2271b1;
    color: #ffffff;
    border: none;
    padding: 13px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

.spt-popup-content button[type="submit"]:hover,
.spt-popup-content input[type="submit"]:hover {
    background: #135e96;
    transform: translateY(-1px);
}

.spt-popup-content button[type="submit"]:active,
.spt-popup-content input[type="submit"]:active {
    transform: translateY(0);
}

.spt-popup-content button[type="submit"]:disabled,
.spt-popup-content input[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ─── Button Content Type ─────────────────────────────────────────────────── */
.spt-popup-button {
    display: inline-block;
    padding: 14px 32px;
    background: #0073aa;
    color: #fff !important;
    text-decoration: none !important;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    transition: all 0.25s ease;
    cursor: pointer;
    border: none;
    box-shadow: 0 3px 10px rgba(0, 115, 170, 0.3);
    max-width: 100%;
    box-sizing: border-box;
}

.spt-popup-button:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 5px 14px rgba(0, 115, 170, 0.4);
}

.spt-popup-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 115, 170, 0.3);
}

.spt-button-container {
    text-align: center;
    width: 100%;
}

.spt-button-text {
    font-size: 14px;
    color: #444;
    line-height: 1.6;
    margin: 0;
}

.spt-button-text-above {
    margin-bottom: 14px;
}

.spt-button-text-below {
    margin-top: 14px;
}

/* ─── Image Content Type ──────────────────────────────────────────────────── */
.spt-popup-image {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 8px;
}

.spt-image-container {
    text-align: center;
    width: 100%;
}

.spt-image-text {
    color: #444;
    line-height: 1.6;
    margin: 0;
    font-size: 14px;
}

.spt-image-text-above {
    margin-bottom: 14px;
}

.spt-image-text-below {
    margin-top: 14px;
}

.spt-popup-image-link {
    display: block;
    text-decoration: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.spt-popup-image-link:hover {
    opacity: 0.92;
    transform: scale(1.02);
}

.spt-popup-image-link:hover .spt-popup-image {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.spt-popup-image-link:active {
    transform: scale(1);
}

/* Content alignment for button and image types */
.spt-popup-content:has(.spt-popup-button),
.spt-popup-content:has(.spt-popup-image) {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    padding: 36px 24px;
}

/* ─── Success Message ─────────────────────────────────────────────────────── */
.spt-success-message {
    text-align: center;
    padding: 40px 24px;
    opacity: 0;
    transform: scale(0.82);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.spt-success-message.spt-show {
    opacity: 1;
    transform: scale(1);
}

.spt-success-icon {
    margin: 0 auto 20px;
    width: 72px;
    height: 72px;
}

.spt-checkmark {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: block;
    stroke-width: 2;
    stroke: #4BB543;
    stroke-miterlimit: 10;
    box-shadow: inset 0px 0px 0px #4BB543;
}

.spt-checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: #4BB543;
    fill: #f0f9f0;
    animation: spt-stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.spt-checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: spt-stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.6s forwards;
    stroke: #4BB543;
    stroke-width: 3;
}

@keyframes spt-stroke {
    100% {
        stroke-dashoffset: 0;
    }
}

.spt-success-text {
    font-size: 17px;
    font-weight: 500;
    color: #1d2327;
    margin-bottom: 20px;
    line-height: 1.5;
}

.spt-success-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.spt-success-close:hover {
    background: rgba(0, 0, 0, 0.2);
    transform: rotate(90deg);
}

.spt-success-close:focus {
    outline: 2px solid #4BB543;
    outline-offset: 2px;
}

/* ─── Animations ──────────────────────────────────────────────────────────── */
.spt-animate {
    opacity: 0;
    transition: none;
}

.spt-animate-fade-in {
    animation: sptFadeIn 0.7s ease forwards;
}

.spt-animate-slide-in {
    animation: sptSlideIn 0.7s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes sptFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes sptSlideIn {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─── Print ───────────────────────────────────────────────────────────────── */
@media print {
    .spt-popup-overlay {
        display: none !important;
    }
}

/* ─── Accessibility: Reduced Motion ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

    .spt-popup-overlay,
    .spt-popup-modal,
    .spt-popup-close,
    .spt-success-message,
    .spt-animate-fade-in,
    .spt-animate-slide-in {
        transition: none;
        animation: none;
    }

    .spt-checkmark-circle,
    .spt-checkmark-check {
        animation: none;
        stroke-dashoffset: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Large Desktop (1200px+) ─────────────────────────────────────────────── */
@media screen and (min-width: 1200px) {
    .spt-popup-modal {
        max-width: 620px;
    }

    .spt-popup-content {
        padding: 40px 36px;
    }

    .spt-popup-content h1 {
        font-size: 28px;
    }

    .spt-popup-content h2 {
        font-size: 24px;
    }

    .spt-popup-content h3 {
        font-size: 20px;
    }

    .spt-popup-content p {
        font-size: 16px;
    }

    .spt-popup-content input[type="text"],
    .spt-popup-content input[type="email"],
    .spt-popup-content input[type="tel"],
    .spt-popup-content input[type="url"],
    .spt-popup-content input[type="number"],
    .spt-popup-content textarea,
    .spt-popup-content select {
        padding: 13px 16px;
        font-size: 15px;
    }
}

/* ─── Tablet (481px – 768px) ──────────────────────────────────────────────── */
@media screen and (max-width: 768px) {
    .spt-popup-overlay {
        padding: 12px;
    }

    .spt-popup-modal {
        max-width: 480px;
        border-radius: 12px;
    }

    .spt-popup-content {
        padding: 26px 22px;
    }

    .spt-popup-close {
        width: 38px;
        height: 38px;
        font-size: 22px;
        top: 10px;
        right: 10px;
    }

    .spt-popup-content h1 {
        font-size: 22px;
    }

    .spt-popup-content h2 {
        font-size: 19px;
    }

    .spt-popup-content h3 {
        font-size: 17px;
    }

    .spt-popup-content input[type="text"],
    .spt-popup-content input[type="email"],
    .spt-popup-content input[type="tel"],
    .spt-popup-content input[type="url"],
    .spt-popup-content input[type="number"],
    .spt-popup-content textarea,
    .spt-popup-content select {
        padding: 12px 14px;
        font-size: 15px;
    }

    .spt-popup-content button[type="submit"],
    .spt-popup-content input[type="submit"] {
        padding: 14px 24px;
        font-size: 16px;
        min-height: 48px;
    }

    .spt-popup-button {
        padding: 13px 28px;
        font-size: 15px;
    }
}

/* ─── Mobile (max 480px) ──────────────────────────────────────────────────── */
@media screen and (max-width: 480px) {
    .spt-popup-overlay {
        padding: 10px;
        align-items: center;
    }

    /* Card style — NOT full screen */
    .spt-popup-modal {
        width: 100%;
        max-width: 100%;
        max-height: calc(100vh - 20px);
        border-radius: 14px;
        /* Remove full-screen behavior */
        height: auto;
    }

    .spt-popup-content {
        padding: 22px 18px;
        max-height: calc(100vh - 80px);
    }

    /* Larger touch-friendly close button */
    .spt-popup-close {
        width: 40px;
        height: 40px;
        font-size: 22px;
        top: 10px;
        right: 10px;
        background: rgba(0, 0, 0, 0.12);
    }

    /* Remove position margins on mobile */
    .spt-popup-modal.spt-position-top,
    .spt-popup-modal.spt-position-bottom {
        margin: 0;
    }

    /* Mobile typography */
    .spt-popup-content h1 {
        font-size: 20px;
        margin-bottom: 10px;
    }

    .spt-popup-content h2 {
        font-size: 18px;
        margin-bottom: 10px;
    }

    .spt-popup-content h3 {
        font-size: 16px;
        margin-bottom: 10px;
    }

    .spt-popup-content p {
        font-size: 14px;
        line-height: 1.55;
        margin-bottom: 12px;
    }

    .spt-popup-content label {
        font-size: 14px;
        margin-bottom: 5px;
    }

    /* Mobile inputs — font-size 16px prevents iOS zoom */
    .spt-popup-content input[type="text"],
    .spt-popup-content input[type="email"],
    .spt-popup-content input[type="tel"],
    .spt-popup-content input[type="url"],
    .spt-popup-content input[type="number"],
    .spt-popup-content textarea,
    .spt-popup-content select {
        padding: 13px 14px;
        font-size: 16px;
        margin-bottom: 14px;
        border-radius: 8px;
    }

    .spt-popup-content textarea {
        min-height: 110px;
    }

    /* Large touch-friendly submit */
    .spt-popup-content button[type="submit"],
    .spt-popup-content input[type="submit"] {
        padding: 15px 24px;
        font-size: 16px;
        min-height: 50px;
        border-radius: 8px;
        margin-top: 6px;
    }

    /* Button content type */
    .spt-popup-button {
        padding: 13px 24px;
        font-size: 15px;
        min-height: 50px;
        width: 100%;
        max-width: 100%;
        border-radius: 8px;
    }

    .spt-button-text {
        font-size: 13px;
        line-height: 1.5;
    }

    .spt-button-text-above {
        margin-bottom: 12px;
    }

    .spt-button-text-below {
        margin-top: 12px;
    }

    /* Image content type */
    .spt-popup-image {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
    }

    .spt-image-text {
        font-size: 13px;
    }

    .spt-image-text-above {
        margin-bottom: 12px;
    }

    .spt-image-text-below {
        margin-top: 12px;
    }

    /* Button/Image container padding */
    .spt-popup-content:has(.spt-popup-button),
    .spt-popup-content:has(.spt-popup-image) {
        padding: 28px 18px;
        min-height: 140px;
    }

    /* Success message on mobile */
    .spt-success-message {
        padding: 28px 16px;
    }

    .spt-success-icon {
        width: 58px;
        height: 58px;
    }

    .spt-checkmark {
        width: 58px;
        height: 58px;
    }

    .spt-success-text {
        font-size: 15px;
    }
}

/* ─── Very small phones (max 360px) ──────────────────────────────────────── */
@media screen and (max-width: 360px) {
    .spt-popup-content {
        padding: 18px 14px;
    }

    .spt-popup-content h1 {
        font-size: 18px;
    }

    .spt-popup-content h2 {
        font-size: 16px;
    }

    .spt-popup-content h3 {
        font-size: 15px;
    }

    .spt-popup-button {
        padding: 12px 20px;
        font-size: 14px;
    }
}