/**
 * App Custom Modals & Toast Notifications
 * Sleek modern dark aesthetic matching custom UI designs
 */

/* Modal Backdrop */
.app-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 14, 23, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s ease;
    padding: 20px;
    box-sizing: border-box;
}

.app-modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Card */
.app-modal-card {
    background: #1c2128;
    color: #ffffff;
    width: 100%;
    max-width: 440px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 28px 24px 22px 24px;
    text-align: center;
    transform: scale(0.93) translateY(8px);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

.app-modal-backdrop.active .app-modal-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

/* Modal Icon */
.app-modal-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin: 0 auto 16px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.app-modal-icon.danger {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.app-modal-icon.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.25);
}

.app-modal-icon.success {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.app-modal-icon.primary {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Modal Title */
.app-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 8px 0;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

/* Modal Message / Subtitle */
.app-modal-body {
    font-size: 0.92rem;
    color: #94a3b8;
    line-height: 1.5;
    margin: 0 0 24px 0;
    word-break: break-word;
}

/* Modal Actions */
.app-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 18px;
}

.app-modal-btn {
    flex: 1;
    padding: 11px 20px;
    border-radius: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.18s ease;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.app-modal-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5);
}

/* Cancel / Secondary Button */
.app-modal-btn-cancel {
    background: rgba(255, 255, 255, 0.07);
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.app-modal-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

/* Primary / Confirm Button */
.app-modal-btn-primary {
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #3b82f6;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.app-modal-btn-primary:hover {
    background: #1d4ed8;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}

/* Danger Button */
.app-modal-btn-danger {
    background: #dc2626;
    color: #ffffff;
    border: 1px solid #ef4444;
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.35);
}

.app-modal-btn-danger:hover {
    background: #b91c1c;
    box-shadow: 0 6px 18px rgba(220, 38, 38, 0.45);
}

/* Success Button */
.app-modal-btn-success {
    background: #0d6e3f;
    color: #ffffff;
    border: 1px solid #10b981;
    box-shadow: 0 4px 14px rgba(13, 110, 63, 0.35);
}

.app-modal-btn-success:hover {
    background: #09502d;
    box-shadow: 0 6px 18px rgba(13, 110, 63, 0.45);
}

/* ----------------------------------------------------
   Toast Notification System
---------------------------------------------------- */
.app-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 380px;
    width: calc(100% - 48px);
}

.app-toast {
    pointer-events: auto;
    background: #1c2128;
    color: #ffffff;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.05);
    padding: 14px 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transform: translateX(120%);
    opacity: 0;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

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

.app-toast.hide {
    transform: translateX(120%);
    opacity: 0;
}

.app-toast-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
}

.app-toast.success .app-toast-icon {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.app-toast.error .app-toast-icon,
.app-toast.danger .app-toast-icon {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.app-toast.warning .app-toast-icon {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.app-toast.info .app-toast-icon {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.app-toast-content {
    flex: 1;
    min-width: 0;
}

.app-toast-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 2px 0;
    line-height: 1.3;
}

.app-toast-message {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.4;
    margin: 0;
    word-break: break-word;
}

.app-toast-close {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 0;
    margin-left: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: color 0.15s ease;
}

.app-toast-close:hover {
    color: #ffffff;
}

.app-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(255, 255, 255, 0.15);
    transform-origin: left;
}

.app-toast.success .app-toast-progress { background: #10b981; }
.app-toast.error .app-toast-progress,
.app-toast.danger .app-toast-progress { background: #ef4444; }
.app-toast.warning .app-toast-progress { background: #f59e0b; }
.app-toast.info .app-toast-progress { background: #3b82f6; }

@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

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