/**
 * Paddle Checkout Frontend Styles
 * @since 2.5.0
 */

/* ── Inline checkout container on checkout page ─────────────────────────── */
#paddle-checkout-container {
    max-width: 100%;
    margin: 16px 0 0;
    min-height: 450px;
    overflow: hidden;
    position: relative;
}

.paddle-receipt-page #paddle-checkout-container {
    margin: 0 auto;
}

/* ── Inline mode loading spinner (sits inside the container) ────────────── */
#plv-inline-loader {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 8px;
}

.plv-inline-card {
    padding: 32px 36px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    border-radius: 14px !important;
}

.plv-inline-card .plv-spinner-ring {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
}

.plv-inline-card .plv-title {
    font-size: 16px;
}

.plv-inline-card .plv-subtitle {
    font-size: 13px;
}

/* ── Status message area (legacy, kept for fallback errors) ─────────────── */
.paddle-status-message {
    margin-top: 30px;
    text-align: center;
    min-height: 60px;
}

.paddle-inline-status p {
    margin: 8px 0 0;
    font-size: 14px;
    color: #555;
    text-align: center;
}

/* ══════════════════════════════════════════════════════════════════════════
   Full-viewport Loading Overlay
   ══════════════════════════════════════════════════════════════════════════ */
#paddle-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

#paddle-loading-overlay.plv-visible {
    opacity: 1;
    pointer-events: all;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.plv-card {
    background: #ffffff;
    border-radius: 20px;
    padding: 48px 52px;
    text-align: center;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.35);
    max-width: 340px;
    width: 90vw;
    transform: translateY(16px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#paddle-loading-overlay.plv-visible .plv-card {
    transform: translateY(0) scale(1);
}

/* ── Phase 1 – Spinner ──────────────────────────────────────────────────── */
.plv-spinner-ring {
    display: inline-block;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 5px solid rgba(0, 115, 170, 0.15);
    border-top-color: #0073aa;
    animation: plv-spin 0.85s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
    margin-bottom: 22px;
}

@keyframes plv-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ── Phase 2 – Success icon ─────────────────────────────────────────────── */
.plv-success-ring {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745, #20c040);
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.40);
    margin-bottom: 20px;
    animation: plv-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.plv-success-ring svg {
    width: 36px;
    height: 36px;
    stroke: #fff;
    stroke-width: 3;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 60;
    stroke-dashoffset: 60;
    animation: plv-check 0.4s 0.35s ease forwards;
}

@keyframes plv-pop {
    from {
        transform: scale(0.4);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes plv-check {
    to {
        stroke-dashoffset: 0;
    }
}

/* ── Text typography ────────────────────────────────────────────────────── */
.plv-title {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
    line-height: 1.3;
}

.plv-subtitle {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* ── Countdown badge ────────────────────────────────────────────────────── */
.plv-countdown-wrap {
    margin-top: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.plv-countdown-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0073aa, #005f8d);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.35);
    transition: transform 0.2s ease;
}

.plv-countdown-label {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 13px;
    color: #9ca3af;
}

/* ── Progress bar ───────────────────────────────────────────────────────── */
.plv-progress-track {
    margin-top: 20px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 99px;
    overflow: hidden;
}

.plv-progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #0073aa, #28a745);
    border-radius: 99px;
    transform-origin: left;
    animation: plv-progress var(--plv-duration, 3s) linear forwards;
}

@keyframes plv-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}

/* ── Legacy spinner (kept for compatibility) ────────────────────────────── */
.paddle-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 3px solid rgba(0, 78, 255, 0.1);
    border-radius: 50%;
    border-top-color: #0073aa;
    animation: paddle-spin 0.8s ease-in-out infinite;
    margin-bottom: 15px;
}

@keyframes paddle-spin {
    to {
        transform: rotate(360deg);
    }
}

.paddle-loading-container {
    padding: 40px;
    text-align: center;
}

.paddle-loading-text {
    font-size: 16px;
    color: #444;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.paddle-checkout-active .paddle-spinner,
.paddle-checkout-active .paddle-loading-text {
    display: none !important;
}