/* ============================================================
   ma-dialog.css v2 — Dialog & notifikasi myAset
   Desain: tata letak rata-kiri ala aplikasi modern (Linear/Stripe),
   ikon kotak tint, pemisah halus sebelum tombol, panel isi lembut.
   Vanilla CSS, tanpa pustaka pihak ketiga.
   ============================================================ */

.ma-dlg-open { overflow: hidden !important; }

.ma-dlg-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(5px) saturate(120%);
    -webkit-backdrop-filter: blur(5px) saturate(120%);
    opacity: 0;
    transition: opacity 0.18s ease;
}
.ma-dlg-backdrop.ma-dlg--show { opacity: 1; }

.ma-dlg-backdrop.ma-dlg--toast-wrap {
    align-items: flex-start;
    justify-content: flex-end;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    pointer-events: none;
    padding: 1.1rem;
}

/* ---------- Kartu dialog ---------- */
.ma-dlg {
    position: relative;
    width: 100%;
    max-width: 428px;
    max-height: calc(100vh - 2.5rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid #edf0f5;
    border-radius: 18px;
    padding: 1.3rem 1.4rem 1.15rem;
    box-shadow: 0 1px 2px rgba(16, 20, 30, 0.04),
                0 12px 28px -12px rgba(16, 20, 30, 0.16),
                0 40px 80px -40px rgba(16, 20, 30, 0.35);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-align: left;
    transform: translateY(10px) scale(0.985);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease;
    pointer-events: auto;
    scrollbar-width: thin;
    scrollbar-color: #d7dde8 transparent;
}
.ma-dlg::-webkit-scrollbar { width: 8px; }
.ma-dlg::-webkit-scrollbar-thumb { background: #dbe1ea; border-radius: 999px; border: 2px solid #fff; }
.ma-dlg-backdrop.ma-dlg--show .ma-dlg { transform: translateY(0) scale(1); opacity: 1; }
.ma-dlg--wide { max-width: 560px; }

.ma-dlg__close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #94a3b8;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.ma-dlg__close:hover { background: #f1f5f9; color: #0f172a; }

/* ---------- Kepala: ikon + judul ---------- */
.ma-dlg__head {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
    padding-right: 1.4rem;
}
.ma-dlg__head--plain { padding-right: 0; }

.ma-dlg__icon {
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    margin-top: 0.05rem;
}
.ma-dlg__icon svg { width: 21px; height: 21px; }
.ma-dlg__icon--success  { background: #eaf9f0; border-color: #cfeedd; color: #15803d; }
.ma-dlg__icon--error    { background: #fdeeee; border-color: #f7d2d2; color: #b91c1c; }
.ma-dlg__icon--warning  { background: #fff7e8; border-color: #f7e0b0; color: #b45309; }
.ma-dlg__icon--info,
.ma-dlg__icon--question { background: #eaf6fb; border-color: #cbe8f2; color: #0e7490; }

.ma-dlg__heading { min-width: 0; padding-top: 0.15rem; }

/* ---------- Judul & teks ---------- */
.ma-dlg__title {
    font-size: 1.02rem;
    font-weight: 700;
    letter-spacing: -0.017em;
    color: #0f172a;
    line-height: 1.4;
}
.ma-dlg__title strong { font-weight: 700; }
.ma-dlg__title + .ma-dlg__subtitle { margin-top: 0.18rem; }
.ma-dlg__subtitle { font-size: 0.79rem; color: #94a3b8; line-height: 1.4; }

.ma-dlg__text {
    font-size: 0.855rem;
    color: #64748b;
    line-height: 1.62;
}
.ma-dlg__text + .ma-dlg__text { margin-top: 0.5rem; }
.ma-dlg__text p { margin-bottom: 0.55rem; }
.ma-dlg__text p:last-child, .ma-dlg__text ul:last-child, .ma-dlg__text ol:last-child { margin-bottom: 0; }
.ma-dlg__text ul, .ma-dlg__text ol { padding-left: 1.1rem; margin-bottom: 0.55rem; }
.ma-dlg__text li + li { margin-top: 0.2rem; }
.ma-dlg__text strong { color: #0f172a; font-weight: 600; }
.ma-dlg__text a { color: #2563eb; text-decoration: none; }
.ma-dlg__text a:hover { text-decoration: underline; }

/* Panel isi panjang (mis. pengumuman) */
.ma-dlg__content {
    margin-top: 0.15rem;
    padding: 0.85rem 0.95rem;
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 12px;
    font-size: 0.845rem;
    color: #475569;
    line-height: 1.65;
    max-height: 46vh;
    overflow-y: auto;
}
.ma-dlg__content p { margin-bottom: 0.6rem; }
.ma-dlg__content p:last-child { margin-bottom: 0; }
.ma-dlg__content ul, .ma-dlg__content ol { padding-left: 1.1rem; margin-bottom: 0.6rem; }
.ma-dlg__content strong { color: #0f172a; font-weight: 600; }
.ma-dlg__content img { max-width: 100%; height: auto; border-radius: 8px; }

.ma-dlg__image {
    display: block;
    margin: 0.15rem 0 0.2rem;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid #eef2f7;
}

/* ---------- Field ---------- */
.ma-dlg__field { margin-top: 0.9rem; }
.ma-dlg__label { display: block; font-size: 0.8rem; font-weight: 600; color: #0f172a; margin-bottom: 0.35rem; }
.ma-dlg__input,
.ma-dlg__select,
.ma-dlg__textarea {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-size: 0.86rem;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.ma-dlg__input::placeholder, .ma-dlg__textarea::placeholder { color: #b0b8c4; }
.ma-dlg__input:hover, .ma-dlg__textarea:hover, .ma-dlg__select:hover { border-color: #cfd8e5; }
.ma-dlg__textarea { min-height: 88px; resize: vertical; line-height: 1.55; }
.ma-dlg__input:focus, .ma-dlg__select:focus, .ma-dlg__textarea:focus {
    border-color: #2563eb;
    background: #fdfefe;
    box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.14);
}
.ma-dlg__error {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: #b91c1c;
    margin-top: 0.4rem;
}
.ma-dlg__error::before { content: '!'; display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; border-radius: 50%; background: #fdeeee; font-weight: 700; font-size: 0.68rem; }

/* ---------- Aksi ---------- */
.ma-dlg__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.15rem;
    padding-top: 1.05rem;
    border-top: 1px solid #f1f4f9;
}
.ma-dlg-valign-start { align-items: flex-start; }
.ma-dlg-btn {
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.845rem;
    line-height: 1;
    padding: 0.62rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    white-space: nowrap;
}
.ma-dlg-btn:active { transform: translateY(0.5px); }
.ma-dlg-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2); }
.ma-dlg-btn--primary { background: #2563eb; color: #fff; box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25), 0 10px 22px -12px rgba(37, 99, 235, 0.75); }
.ma-dlg-btn--primary:hover { background: #1d4ed8; }
.ma-dlg-btn--danger { background: #dc2626; color: #fff; box-shadow: 0 1px 2px rgba(220, 38, 38, 0.25), 0 10px 22px -12px rgba(220, 38, 38, 0.7); }
.ma-dlg-btn--danger:hover { background: #b91c1c; }
.ma-dlg-btn--success { background: #16a34a; color: #fff; box-shadow: 0 1px 2px rgba(22, 163, 74, 0.25), 0 10px 22px -12px rgba(22, 163, 74, 0.7); }
.ma-dlg-btn--success:hover { background: #15803d; }
.ma-dlg-btn--warning { background: #d97706; color: #fff; }
.ma-dlg-btn--warning:hover { background: #b45309; }
.ma-dlg-btn--ghost { background: #fff; color: #475569; border-color: #e2e8f0; }
.ma-dlg-btn--ghost:hover { background: #f8fafc; color: #0f172a; border-color: #cfd8e5; }
.ma-dlg-btn--cancel { background: #fff; color: #475569; border-color: #e2e8f0; }
.ma-dlg-btn--cancel:hover { background: #f8fafc; color: #0f172a; border-color: #cfd8e5; }

/* ---------- Progres ---------- */
.ma-dlg__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    border-radius: 0 0 18px 18px;
    transform-origin: left center;
    animation: ma-dlg-progress linear forwards;
}
@keyframes ma-dlg-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- Toast ---------- */
.ma-dlg-toast {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    min-width: 296px;
    max-width: 380px;
    background: #fff;
    border: 1px solid #edf0f5;
    border-radius: 13px;
    padding: 0.72rem 0.85rem;
    box-shadow: 0 1px 2px rgba(16, 20, 30, 0.04),
                0 14px 32px -18px rgba(16, 20, 30, 0.35);
    pointer-events: auto;
    transform: translateX(14px);
    opacity: 0;
    transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
    margin-bottom: 0.55rem;
    text-align: left;
}
.ma-dlg-backdrop.ma-dlg--show .ma-dlg-toast { transform: translateX(0); opacity: 1; }
.ma-dlg-toast__icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}
.ma-dlg-toast__icon svg { width: 15px; height: 15px; }
.ma-dlg-toast__body { flex: 1 1 auto; min-width: 0; }
.ma-dlg-toast__title { font-size: 0.83rem; font-weight: 650; color: #0f172a; letter-spacing: -0.01em; line-height: 1.35; }
.ma-dlg-toast__text { font-size: 0.775rem; color: #64748b; line-height: 1.45; margin-top: 0.1rem; }
.ma-dlg-toast__bar {
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, #2563eb, #93c5fd);
    margin-top: 0.5rem;
    transform-origin: left center;
    animation: ma-dlg-progress linear forwards;
}

/* ---------- Spinner ---------- */
.ma-dlg__spinner-wrap { display: flex; align-items: center; gap: 0.75rem; padding: 0.15rem 0; }
.ma-dlg__spinner {
    width: 1.65rem;
    height: 1.65rem;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 2.5px solid #e6ebf5;
    border-top-color: #2563eb;
    animation: ma-dlg-spin 0.7s linear infinite;
}
@keyframes ma-dlg-spin { to { transform: rotate(360deg); } }

/* ---------- Varian lebar & mobile ---------- */
@media (max-width: 575.98px) {
    .ma-dlg-backdrop { padding: 0.9rem; align-items: flex-end; }
    .ma-dlg { max-width: none; border-radius: 16px; padding: 1.15rem 1.1rem 1rem; max-height: calc(100vh - 1.6rem); }
    .ma-dlg__actions { flex-direction: column-reverse; align-items: stretch; }
    .ma-dlg-btn { width: 100%; padding: 0.72rem 1rem; }
    .ma-dlg-backdrop.ma-dlg--toast-wrap { justify-content: stretch; padding: 0.7rem; }
    .ma-dlg-toast { max-width: none; width: 100%; min-width: 0; }
}
