/* Centralized Notification System
 * Premium styling for global application toasts
 */

:root {
    --toast-bg-success: rgba(26, 61, 26, 0.95);
    --toast-border-success: #3fb950;
    --toast-text-success: #e6ffec;

    --toast-bg-error: rgba(61, 26, 26, 0.95);
    --toast-border-error: #f85149;
    --toast-text-error: #ffebe9;

    --toast-bg-warning: rgba(56, 40, 0, 0.95);
    --toast-border-warning: #d29922;
    --toast-text-warning: #fff8c5;

    --toast-bg-info: rgba(13, 17, 23, 0.95);
    --toast-border-info: #58a6ff;
    --toast-text-info: #c9d1d9;

    --toast-title-color: #ffffff;
    --toast-message-color: rgba(255, 255, 255, 0.85);
}

[data-bs-theme="light"] {
    --toast-bg-success: rgba(230, 255, 236, 0.98);
    --toast-border-success: #2ea043;
    --toast-text-success: #1f6f35;

    --toast-bg-error: rgba(255, 235, 233, 0.98);
    --toast-border-error: #d1242f;
    --toast-text-error: #9b1c1c;

    --toast-bg-warning: rgba(255, 248, 197, 0.98);
    --toast-border-warning: #b5841a;
    --toast-text-warning: #7a5b00;

    --toast-bg-info: rgba(240, 247, 255, 0.98);
    --toast-border-info: #2563eb;
    --toast-text-info: #1d4ed8;

    --toast-title-color: #1d1d1f;
    --toast-message-color: rgba(60, 60, 67, 0.8);
}

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    pointer-events: none;
    /* Allow clicks through container */
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.toast-notification {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    width: 320px;
    /* Reduced from 380px */
    max-width: 90vw;
    padding: 12px 14px;
    /* Reduced from 16px */
    border-radius: 10px;
    /* Slightly tighter radius */
    background: var(--bg-tertiary, #21262d);
    border: 1px solid var(--border-color, #30363d);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transform-origin: top right;
    animation: toast-slide-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
    overflow: hidden;
    position: relative;
}

.toast-notification.removing {
    animation: toast-slide-out 0.25s cubic-bezier(0.5, 0, 1, 0.4) forwards;
}

/* Types */
.toast-notification.toast-success {
    background: var(--toast-bg-success);
    border-color: var(--toast-border-success);
}

.toast-notification.toast-error {
    background: var(--toast-bg-error);
    border-color: var(--toast-border-error);
}

.toast-notification.toast-warning {
    background: var(--toast-bg-warning);
    border-color: var(--toast-border-warning);
}

.toast-notification.toast-info {
    background: var(--toast-bg-info);
    border-color: var(--toast-border-info);
}

/* Content Layout */
.toast-icon {
    flex-shrink: 0;
    margin-right: 12px;
    /* Reduced from 16px */
    margin-top: 1px;
    /* Align with first line of text */
    font-size: 1.1rem;
    /* Reduced from 1.25rem */
}

.toast-success .toast-icon {
    color: var(--toast-border-success);
}

.toast-error .toast-icon {
    color: var(--toast-border-error);
}

.toast-warning .toast-icon {
    color: var(--toast-border-warning);
}

.toast-info .toast-icon {
    color: var(--toast-border-info);
}

.toast-content {
    flex: 1;
    min-width: 0;
    /* Text truncation fix */
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    /* Reduced from 0.95rem */
    margin-bottom: 2px;
    /* Reduced margin */
    color: var(--toast-title-color);
}

.toast-message {
    font-size: 0.85rem;
    /* Reduced from 0.9rem */
    color: var(--toast-message-color);
    line-height: 1.4;
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    margin-left: 12px;
    margin-top: -4px;
    background: transparent;
    border: none;
    color: var(--toast-message-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.toast-close:hover {
    color: var(--toast-title-color);
    background: rgba(0, 0, 0, 0.08);
}

/* Animations */
@keyframes toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1.0);
    }
}

@keyframes toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
        max-height: 200px;
        margin-bottom: 12px;
    }

    to {
        opacity: 0;
        transform: translateX(100%);
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        border: none;
    }
}

/* Progress Bar (Optional, for auto-dismiss) */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    width: 100%;
}

.toast-progress-bar {
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    width: 100%;
    transform-origin: left;
    animation: toast-progress linear forwards;
}

@keyframes toast-progress {
    from {
        transform: scaleX(1);
    }

    to {
        transform: scaleX(0);
    }
}