/* ============================================================
   JFL Alert — common alert / toast / confirm modal component
   Used site-wide through window.JFLAlert (static/js/jflit-alert.js)
   ============================================================ */

.jfl-toast-wrap {
    position: fixed;
    top: 88px;
    right: 18px;
    z-index: 10900;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.jfl-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: .7rem;
    padding: .85rem .9rem .95rem;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .16), 0 2px 6px rgba(15, 23, 42, .08);
    border: 1px solid #e8edf4;
    border-left: 5px solid #2563eb;
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(24px);
    transition: opacity .28s ease, transform .28s cubic-bezier(.22, 1, .36, 1);
}

.jfl-toast.is-in { opacity: 1; transform: translateX(0); }
.jfl-toast.is-out { opacity: 0; transform: translateX(24px); }

.jfl-toast__icon {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    background: rgba(37, 99, 235, .12);
    color: #2563eb;
}

.jfl-toast__body { flex: 1 1 auto; min-width: 0; }

.jfl-toast__title {
    font-size: .8rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: .1rem;
}

.jfl-toast__msg {
    font-size: .84rem;
    line-height: 1.45;
    color: #475569;
    word-wrap: break-word;
}

.jfl-toast__close {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: #94a3b8;
    font-size: .85rem;
    line-height: 1;
    padding: .2rem;
    border-radius: 6px;
    cursor: pointer;
    transition: color .15s, background .15s;
}

.jfl-toast__close:hover { color: #334155; background: #f1f5f9; }

.jfl-toast__bar {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    transform-origin: left center;
    background: currentColor;
    opacity: .35;
    animation-name: jfl-toast-bar;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

@keyframes jfl-toast-bar {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* type variants */
.jfl-toast--success { border-left-color: #059669; color: #059669; }
.jfl-toast--success .jfl-toast__icon { background: rgba(5, 150, 105, .12); color: #059669; }

.jfl-toast--error { border-left-color: #dc2626; color: #dc2626; }
.jfl-toast--error .jfl-toast__icon { background: rgba(220, 38, 38, .1); color: #dc2626; }

.jfl-toast--warning { border-left-color: #d97706; color: #d97706; }
.jfl-toast--warning .jfl-toast__icon { background: rgba(217, 119, 6, .12); color: #d97706; }

.jfl-toast--info { border-left-color: #2563eb; color: #2563eb; }
.jfl-toast--info .jfl-toast__icon { background: rgba(37, 99, 235, .12); color: #2563eb; }

/* ============================================================
   Alert / Confirm modal
   ============================================================ */
.jfl-alert-modal .modal-content {
    border: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 26px 70px rgba(15, 23, 42, .28);
}

.jfl-alert-modal .modal-body {
    padding: 2rem 1.6rem 1rem;
    text-align: center;
}

.jfl-alert-icon {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: rgba(37, 99, 235, .1);
    color: #2563eb;
    position: relative;
}

.jfl-alert-icon::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid currentColor;
    opacity: .18;
    animation: jfl-alert-ring 1.8s ease-out infinite;
}

@keyframes jfl-alert-ring {
    0% { transform: scale(.92); opacity: .28; }
    70% { transform: scale(1.08); opacity: 0; }
    100% { transform: scale(1.08); opacity: 0; }
}

.jfl-alert-modal.jfl-alert--success .jfl-alert-icon { background: rgba(5, 150, 105, .1); color: #059669; }
.jfl-alert-modal.jfl-alert--error .jfl-alert-icon { background: rgba(220, 38, 38, .1); color: #dc2626; }
.jfl-alert-modal.jfl-alert--warning .jfl-alert-icon { background: rgba(217, 119, 6, .12); color: #d97706; }
.jfl-alert-modal.jfl-alert--info .jfl-alert-icon { background: rgba(37, 99, 235, .1); color: #2563eb; }

.jfl-alert-title {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: .5rem;
}

.jfl-alert-msg {
    color: #52607a;
    font-size: .95rem;
    line-height: 1.6;
    margin-bottom: 0;
    white-space: pre-line;
}

/* rich (dynamic HTML) body */
.jfl-alert-msg--rich { white-space: normal; }

.jfl-alert-stats {
    display: flex;
    gap: .6rem;
    margin: .2rem 0 .9rem;
}

.jfl-alert-stat {
    flex: 1 1 0;
    border-radius: 14px;
    padding: .7rem .5rem;
    text-align: center;
    border: 1px solid #e8edf4;
    background: #f8fafc;
}

.jfl-alert-stat__num {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
}

.jfl-alert-stat__label {
    font-size: .72rem;
    font-weight: 600;
    color: #64748b;
    margin-top: .15rem;
    display: block;
}

.jfl-alert-stat--done { background: rgba(5, 150, 105, .08); border-color: rgba(5, 150, 105, .25); }
.jfl-alert-stat--done .jfl-alert-stat__num { color: #059669; }

.jfl-alert-stat--left { background: rgba(220, 38, 38, .07); border-color: rgba(220, 38, 38, .22); }
.jfl-alert-stat--left .jfl-alert-stat__num { color: #dc2626; }

.jfl-alert-stat--ok .jfl-alert-stat__num { color: #2563eb; }

.jfl-alert-modal .modal-footer {
    border: 0;
    padding: 1.1rem 1.6rem 1.6rem;
    justify-content: center;
    gap: .6rem;
}

.jfl-alert-modal .modal-footer .btn {
    border-radius: 999px;
    padding: .55rem 1.6rem;
    font-weight: 600;
    min-width: 120px;
}

@media (max-width: 575.98px) {
    .jfl-toast-wrap {
        top: auto;
        bottom: 18px;
        left: 12px;
        right: 12px;
        width: auto;
    }
    .jfl-toast { transform: translateY(20px); }
    .jfl-toast.is-in { transform: translateY(0); }
    .jfl-toast.is-out { transform: translateY(20px); }
}
