/**
 * MBOISREK — styles
 * Semua warna dipusatkan di variable berikut, silakan sesuaikan
 * dengan branding blok-a.com yang sebenarnya.
 */
:root {
    --stmt-accent: #7c5cff;      /* ungu portal */
    --stmt-accent-deep: #2a1b5e; /* ungu tua / navy untuk gradasi */
    --stmt-bg-panel: #0e0a1a;    /* latar panel modal */
    --stmt-text: #f2eefc;
    --stmt-text-muted: #b6a9dd;
    --stmt-shadow: rgba(124, 92, 255, 0.45);
    --stmt-z: 999999;
}

/* ============ Floating trigger button ============ */
.stmt-trigger {
    position: fixed;
    bottom: 24px;
    width: 100px;
    height: auto;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    box-shadow: none;
    z-index: var(--stmt-z);
    color: #fff;
    padding: 0;
    transition: transform 0.2s ease;
}

.stmt-trigger:hover {
    transform: translateY(-2px) scale(1.04);
}

.stmt-trigger:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

/* Sembunyikan trigger saat modal sedang terbuka */
.stmt-trigger[aria-expanded="true"] {
    opacity: 0;
    pointer-events: none;
}

/* ============ Modal / Portal ============ */
.stmt-modal {
    position: fixed;
    inset: 0;
    z-index: calc(var(--stmt-z) - 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stmt-modal[hidden] {
    display: none;
}

.stmt-modal__backdrop {
    position: absolute;
    inset: 0;
	 background: rgba(0, 0, 0, 0.5);
}

.stmt-modal__panel {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--stmt-bg-panel);
    overflow: hidden;

    /* Titik asal ekspansi diatur lewat JS via custom property,
       dihitung RELATIF terhadap kotak panel ini sendiri (bukan
       viewport), supaya tetap presisi walau panel tidak fullscreen */
    --ox: 100%;
    --oy: 100%;
    clip-path: circle(0% at var(--ox) var(--oy));
    transition: clip-path 0.62s cubic-bezier(0.22, 1, 0.36, 1);
}

.stmt-modal.is-open .stmt-modal__panel {
    clip-path: circle(150% at var(--ox) var(--oy));
}

.stmt-modal__close {
    position: absolute;
    top: 18px;
    right: 30px;
    padding: 4px 10px;
    border-radius: 5px;
    border: none;
    background: rgb(255, 140, 0);
    color: #fff;
    font-size: 10px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
}

.stmt-modal__close:hover { background: rgb(224, 122, 0); }
.stmt-modal__close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.stmt-modal__frame {
    flex: 1;
    width: 100%;
    height: 100%;
    border: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.stmt-modal__frame.is-visible {
    opacity: 1;
}

/* ============ Loading state ============ */
.stmt-modal__loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--stmt-text-muted);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
}

.stmt-modal__spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2.5px solid rgba(124, 92, 255, 0.25);
    border-top-color: var(--stmt-accent);
    animation: stmt-spin 0.85s linear infinite;
}

@keyframes stmt-spin {
    to { transform: rotate(360deg); }
}

/* ============ Error / fallback state ============ */
.stmt-modal__error {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: var(--stmt-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.stmt-modal__error[hidden] { display: none; }

.stmt-modal__error p { margin: 4px 0; }

.stmt-modal__error-sub {
    color: var(--stmt-text-muted);
    font-size: 13px;
}

/* ============ Aksesibilitas: hormati preferensi reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
    .stmt-modal__panel {
        transition: opacity 0.25s ease;
        clip-path: none !important;
        opacity: 0;
        pointer-events: none;
    }
    .stmt-modal.is-open .stmt-modal__panel {
        opacity: 1;
        pointer-events: auto;
    }
    .stmt-trigger__ring {
        animation: none;
        opacity: 0.35;
    }
}

/* ============ Mobile ============ */
@media (max-width: 480px) {
    .stmt-trigger {
        width: 52px;
        height: 52px;
    }
}
