/* HujjatPro.uz — in-page messages (toasts) and confirmation dialogs: static/js/ui-dialogs.js */

.hp-toast-region {
    position: fixed;
    left: 1rem;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    z-index: 2147483000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
}

@media (min-width: 640px) {
    .hp-toast-region {
        left: auto;
        right: 1.5rem;
        bottom: 1.5rem;
        width: 24rem;
        align-items: stretch;
    }
}

.hp-toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    max-width: 28rem;
    box-sizing: border-box;
    padding: 0.875rem 0.75rem 0.875rem 1rem;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-left: 4px solid #2563eb;
    border-radius: 1rem;
    box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.15), 0 4px 10px -6px rgba(15, 23, 42, 0.1);
    font-size: 0.875rem;
    line-height: 1.45;
    font-weight: 500;
    animation: hp-toast-in 0.2s ease-out;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.hp-toast--success { border-left-color: #059669; }
.hp-toast--error { border-left-color: #e11d48; background: #fff1f2; border-color: #fecdd3; color: #881337; }

.hp-toast--leaving { opacity: 0; transform: translateY(0.5rem); }

.hp-toast__text {
    flex: 1 1 auto;
    min-width: 0;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.hp-toast__close {
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    margin: -0.375rem 0 -0.375rem 0;
    border: 0;
    border-radius: 0.5rem;
    background: transparent;
    color: #475569;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
}

.hp-toast__close:hover { background: rgba(15, 23, 42, 0.06); color: #0f172a; }
.hp-toast__close:focus-visible,
.hp-dialog__btn:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

@keyframes hp-toast-in {
    from { opacity: 0; transform: translateY(0.5rem); }
    to { opacity: 1; transform: none; }
}

.hp-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 2147483001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.5);
    animation: hp-fade-in 0.15s ease-out;
}

.hp-dialog {
    width: 100%;
    max-width: 28rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
    box-sizing: border-box;
    padding: 1.5rem;
    background: #ffffff;
    color: #0f172a;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.35);
}

.hp-dialog__title {
    margin: 0 0 0.5rem;
    font-size: 1.0625rem;
    font-weight: 800;
    line-height: 1.35;
    color: #0f172a;
}

.hp-dialog--danger .hp-dialog__title { color: #be123c; }

.hp-dialog__text {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    line-height: 1.55;
    color: #475569;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.hp-dialog__actions {
    display: flex;
    flex-wrap: wrap-reverse;
    justify-content: flex-end;
    gap: 0.5rem;
}

.hp-dialog__btn {
    min-height: 2.75rem;
    padding: 0.625rem 1.125rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 420px) {
    .hp-dialog__btn { flex: 1 1 100%; }
}

.hp-dialog__btn--cancel { background: #ffffff; border-color: #cbd5e1; color: #334155; }
.hp-dialog__btn--cancel:hover { background: #f1f5f9; }
.hp-dialog__btn--ok { background: #2563eb; color: #ffffff; }
.hp-dialog__btn--ok:hover { background: #1d4ed8; }
.hp-dialog__btn--danger { background: #e11d48; color: #ffffff; }
.hp-dialog__btn--danger:hover { background: #be123c; }

@keyframes hp-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .hp-toast,
    .hp-dialog-backdrop { animation: none; }
    .hp-toast { transition: none; }
    .hp-toast--leaving { transform: none; }
}
