﻿/* WPG Analytics — Toast, Modal, Loader, Pagination, Help */
@import url("wpg-scrollbars.css");

/* ─── Modals above shell (backdrop below dialog) ─── */
.modal-backdrop {
    z-index: var(--wpg-z-modal-backdrop, 1050) !important;
}

.modal {
    z-index: var(--wpg-z-modal, 1055) !important;
}

#wpgToastContainer {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: var(--wpg-z-toast, 1085);
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: min(380px, calc(100vw - 2rem));
    pointer-events: none;
}

.wpg-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .85rem 1rem;
    border-radius: 14px;
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.5;
    box-shadow: 0 12px 40px rgba(15,23,42,.15);
    border: 1px solid transparent;
    animation: wpgToastIn .28s cubic-bezier(.4,0,.2,1);
    backdrop-filter: blur(12px);
}

.wpg-toast i { font-size: 1.15rem; flex-shrink: 0; margin-top: .1rem; }
.wpg-toast .wpg-toast-msg { flex: 1; min-width: 0; }
.wpg-toast .btn-close { flex-shrink: 0; opacity: .55; padding: .35rem; margin: -.2rem -.2rem -.2rem 0; }

.wpg-toast-success { background: rgba(236,253,245,.95); color: #065f46; border-color: rgba(16,185,129,.25); }
.wpg-toast-success i { color: #10b981; }
.wpg-toast-danger { background: rgba(254,242,242,.95); color: #991b1b; border-color: rgba(239,68,68,.25); }
.wpg-toast-danger i { color: #ef4444; }
.wpg-toast-warning { background: rgba(255,251,235,.95); color: #92400e; border-color: rgba(245,158,11,.3); }
.wpg-toast-warning i { color: #f59e0b; }
.wpg-toast-info { background: rgba(239,246,255,.95); color: #1e40af; border-color: rgba(59,130,246,.25); }
.wpg-toast-info i { color: #3b82f6; }

@keyframes wpgToastIn {
    from { opacity: 0; transform: translateY(-12px) scale(.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.wpg-loader-wrap { position: relative; min-height: 80px; }
.wpg-loader-wrap.wpg-loading { pointer-events: none; }
.wpg-loader-wrap.wpg-loading::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 20;
    background: var(--wpg-loader-overlay, rgba(255,255,255,.72));
    backdrop-filter: blur(3px);
    border-radius: inherit;
}
.wpg-loader-wrap.wpg-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    z-index: 21;
    border: 3px solid rgba(59,130,246,.15);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: wpgSpin .7s linear infinite;
}

#wpgPageOverlay {
    position: fixed;
    inset: 0;
    z-index: var(--wpg-z-page-overlay, 1075);
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15,23,42,.35);
    backdrop-filter: blur(4px);
}
#wpgPageOverlay.show { display: flex; }
#wpgPageOverlay .wpg-page-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,.25);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wpgSpin .7s linear infinite;
}
@keyframes wpgSpin { to { transform: rotate(360deg); } }

.wpg-loader-btn { position: relative; }
.wpg-loader-btn.wpg-loading { color: transparent !important; pointer-events: none; }
.wpg-loader-btn.wpg-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: wpgSpin .6s linear infinite;
}

/* ─── Subscription status banner ─── */
.wpg-subscription-banner {
    margin: 0 0 1.25rem;
    border-radius: var(--wpg-radius, 14px);
    border: 1px solid transparent;
    padding: 1rem 1.15rem;
    animation: wpgBannerIn .35s ease;
}

.wpg-subscription-banner__inner {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
}

.wpg-subscription-banner__icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.25rem;
}

.wpg-subscription-banner__body {
    flex: 1;
    min-width: 0;
}

.wpg-subscription-banner__body strong {
    font-size: .95rem;
}

.wpg-subscription-banner__cta {
    flex-shrink: 0;
    align-self: center;
    font-weight: 700;
    white-space: nowrap;
}

.wpg-subscription-banner--warning {
    background: linear-gradient(135deg, rgba(245,158,11,.12), rgba(251,191,36,.06));
    border-color: rgba(245,158,11,.28);
    color: #92400e;
}

.wpg-subscription-banner--warning .wpg-subscription-banner__icon {
    background: rgba(245,158,11,.18);
    color: #d97706;
}

.wpg-subscription-banner--warning .wpg-subscription-banner__cta {
    background: #fff;
    border: 1px solid rgba(245,158,11,.35);
    color: #b45309;
}

.wpg-subscription-banner--danger {
    background: linear-gradient(135deg, rgba(239,68,68,.1), rgba(248,113,113,.05));
    border-color: rgba(239,68,68,.25);
    color: #991b1b;
}

.wpg-subscription-banner--danger .wpg-subscription-banner__icon {
    background: rgba(239,68,68,.15);
    color: #dc2626;
}

.wpg-subscription-banner--danger .wpg-subscription-banner__cta {
    background: #fff;
    border: 1px solid rgba(239,68,68,.3);
    color: #b91c1c;
}

.wpg-subscription-banner--info {
    background: linear-gradient(135deg, rgba(59,130,246,.1), rgba(6,182,212,.05));
    border-color: rgba(59,130,246,.22);
    color: #1e40af;
}

.wpg-subscription-banner--info .wpg-subscription-banner__icon {
    background: rgba(59,130,246,.14);
    color: #2563eb;
}

@keyframes wpgBannerIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.wpg-subscription-banner--paused {
    border-right: 4px solid currentColor;
}

@media (max-width: 575px) {
    .wpg-subscription-banner__inner {
        flex-wrap: wrap;
    }

    .wpg-subscription-banner__cta {
        width: 100%;
        margin-top: .25rem;
    }
}

.wpg-modal .modal-content {
    border: 1px solid var(--wpg-border, rgba(15,23,42,.08));
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(15,23,42,.18);
    overflow: hidden;
}
.wpg-modal .modal-header {
    border-bottom: 1px solid var(--wpg-border, rgba(15,23,42,.08));
    padding: 1.1rem 1.35rem;
    background: linear-gradient(180deg, rgba(59,130,246,.04), transparent);
}
.wpg-modal .modal-title { font-weight: 800; font-size: 1.05rem; letter-spacing: -.02em; }
.wpg-modal .modal-body { padding: 1.35rem; }
.wpg-modal .modal-footer {
    border-top: 1px solid var(--wpg-border, rgba(15,23,42,.08));
    padding: 1rem 1.35rem;
    gap: .5rem;
}
.wpg-modal .modal-footer .btn { border-radius: 10px; font-weight: 600; font-size: .875rem; }

/* ─── GSC fetch overlay ─── */
.wpg-gsc-fetch-overlay {
    position: fixed;
    inset: 0;
    z-index: 12050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .25s ease, visibility .25s ease;
}

.wpg-gsc-fetch-overlay.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.wpg-gsc-fetch-card {
    width: min(420px, 100%);
    background: var(--wpg-surface, #fff);
    border: 1px solid var(--wpg-border, #e9ecef);
    border-radius: 18px;
    padding: 1.75rem 1.5rem;
    text-align: center;
    box-shadow: 0 24px 64px rgba(15, 23, 42, .2);
    animation: wpgBannerIn .35s ease;
}

.wpg-gsc-fetch-icon-wrap {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59,130,246,.12), rgba(6,182,212,.08));
}

.wpg-gsc-fetch-icon {
    font-size: 1.75rem;
    color: var(--wpg-primary, #3b82f6);
}

.wpg-gsc-fetch-icon.is-success { color: #16a34a; }
.wpg-gsc-fetch-icon.is-error { color: #dc2626; }

.wpg-gsc-fetch-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: .35rem;
}

.wpg-gsc-fetch-message {
    font-size: .9rem;
    color: var(--wpg-text-muted, #64748b);
    margin-bottom: 1rem;
}

.wpg-gsc-fetch-progress {
    height: 6px;
    border-radius: 999px;
    background: var(--wpg-border, #e2e8f0);
    overflow: hidden;
    margin-bottom: .75rem;
}

.wpg-gsc-fetch-progress-bar {
    height: 100%;
    width: 8%;
    border-radius: inherit;
    background: linear-gradient(90deg, #3b82f6, #06b6d4);
    transition: width .45s ease;
}

.wpg-gsc-fetch-progress-bar.is-success { background: linear-gradient(90deg, #22c55e, #16a34a); }
.wpg-gsc-fetch-progress-bar.is-error { background: linear-gradient(90deg, #f87171, #dc2626); }

.wpg-gsc-guide-types {
    display: grid;
    gap: .75rem;
}

.wpg-gsc-guide-type {
    padding: .75rem .85rem;
    border-radius: 12px;
    border: 1px solid var(--wpg-border, #e9ecef);
    background: var(--wpg-surface-2, #f8fafc);
    font-size: .85rem;
}

.wpg-gsc-guide-type code {
    font-size: .8rem;
    background: rgba(59,130,246,.08);
    padding: .2rem .45rem;
    border-radius: 6px;
}

.wpg-gsc-inline-note {
    border-radius: 12px;
    padding: .75rem .9rem;
    background: linear-gradient(135deg, rgba(59,130,246,.06), rgba(6,182,212,.04));
    border: 1px solid rgba(59,130,246,.15);
    font-size: .85rem;
}

.wpg-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid rgba(59,130,246,.25);
    border-radius: 50%;
    background: rgba(59,130,246,.08);
    color: #3b82f6;
    cursor: pointer;
    vertical-align: middle;
    transition: background .2s, transform .2s;
}
.wpg-help-btn:hover { background: rgba(59,130,246,.15); transform: scale(1.05); color: #2563eb; }
.wpg-help-btn i { font-size: .95rem; }

.wpg-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-top: 1.25rem;
}
.wpg-pagination .page-btn {
    min-width: 38px;
    height: 38px;
    padding: 0 .65rem;
    border: 1px solid var(--wpg-border, rgba(15,23,42,.1));
    border-radius: 10px;
    background: var(--wpg-surface, #fff);
    color: var(--wpg-text, #0f172a);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
}
.wpg-pagination .page-btn:hover:not(:disabled):not(.active) {
    border-color: rgba(59,130,246,.35);
    color: #3b82f6;
    background: rgba(59,130,246,.06);
}
.wpg-pagination .page-btn.active {
    background: linear-gradient(135deg, #3b82f6, #06b6d4);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 14px rgba(59,130,246,.3);
}
.wpg-pagination .page-btn:disabled { opacity: .45; cursor: not-allowed; }
.wpg-pagination .page-info {
    font-size: .8rem;
    color: var(--wpg-text-muted, #64748b);
    margin: 0 .5rem;
}

input.wpg-money-input { text-align: left; direction: ltr; font-variant-numeric: tabular-nums; }
.wpg-admin .wpg-pagination .page-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 4px 14px rgba(99,102,241,.3);
}
