/* ============================================================
   DIALOG + TOAST
   ============================================================ */

.dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 9000;
}

.dialog-backdrop.open {
    opacity: 1;
    visibility: visible;
}

/* ---------- Base dialog ---------- */
.app-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.94);
    margin: 0;
    padding: 28px 26px 22px;
    border: 1px solid #2a2a2a;
    border-radius: 16px;
    background: #161616;
    color: #eaeaea;
    width: min(420px, calc(100vw - 32px));
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
    font-family: inherit;
    opacity: 0;
    transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
    z-index: 9100;
}

.app-dialog[open] {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.app-dialog::backdrop {
    background: transparent;
    /* we use our own backdrop */
}

/* ---------- Icon ---------- */
.app-dialog__icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 14px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    background: #2a2a2a;
    color: #fff;
    transition: background 0.2s ease;
}

.app-dialog__icon--error {
    background: linear-gradient(135deg, #ff4d4d, #d63636);
}

.app-dialog__icon--success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.app-dialog__icon--warn {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.app-dialog__icon--info {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

/* ---------- Text ---------- */
.app-dialog__title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
    text-align: center;
}

.app-dialog__message {
    font-size: 0.92rem;
    color: #aaa;
    line-height: 1.7;
    margin: 0 0 22px;
    text-align: center;
    word-break: break-word;
}

/* ---------- Actions ---------- */
.app-dialog__actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.app-dialog__btn {
    padding: 10px 22px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.app-dialog__btn:active {
    transform: scale(0.97);
}

.app-dialog__btn--primary {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.app-dialog__btn--primary:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.app-dialog__btn--danger {
    background: #ff4d4d;
    color: #fff;
    border-color: #ff4d4d;
}

.app-dialog__btn--danger:hover {
    background: #e63939;
    border-color: #e63939;
}

.app-dialog__btn--ghost {
    background: transparent;
    color: #bbb;
    border-color: #3a3a3a;
}

.app-dialog__btn--ghost:hover {
    background: #1f1f1f;
    color: #fff;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    top: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 9500;
    pointer-events: none;
}

.app-toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 260px;
    max-width: 380px;
    padding: 12px 14px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-left: 4px solid #007bff;
    border-radius: 10px;
    color: #eaeaea;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    font-size: 0.88rem;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.1),
        opacity 0.25s ease;
    direction: rtl;
}

.app-toast--visible {
    transform: translateX(0);
    opacity: 1;
}

.app-toast--success {
    border-left-color: #22c55e;
}

.app-toast--error {
    border-left-color: #ff4d4d;
}

.app-toast--info {
    border-left-color: #007bff;
}

.app-toast--warn {
    border-left-color: #f59e0b;
}

.app-toast__icon {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    background: #2a2a2a;
    color: #fff;
}

.app-toast--success .app-toast__icon {
    background: #22c55e;
}

.app-toast--error .app-toast__icon {
    background: #ff4d4d;
}

.app-toast--info .app-toast__icon {
    background: #007bff;
}

.app-toast--warn .app-toast__icon {
    background: #f59e0b;
}

.app-toast__message {
    flex: 1;
    line-height: 1.5;
}

.app-toast__close {
    background: transparent;
    border: none;
    color: #777;
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 2px;
    transition: color 0.2s ease;
}

.app-toast__close:hover {
    color: #fff;
}

@media (max-width: 480px) {
    .toast-container {
        top: auto;
        bottom: 16px;
        left: 16px;
        right: 16px;
    }

    .app-toast {
        min-width: 0;
        width: 100%;
    }
}

/**
 * Copyright (c) 2026 Sobhan Rasoulzadeh Asl (Sobhan-SRZA / Mr. Sinre)
 *
 * Licensed under the BSD 3-Clause License.
 * See the LICENSE file in the project root for license information.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */