/**
 * Global toast / flash notifications (layout.html + notifications.js)
 * Fixed viewport layer — must not participate in normal document flow below footer.
 */

.global-notification-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10060;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    width: min(100vw - 2rem, 28rem);
    max-width: 28rem;
    pointer-events: none;
    box-sizing: border-box;
}

.global-notification-container .global-notification {
    pointer-events: auto;
}

.global-notification {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1rem 0.85rem;
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
    box-shadow:
        0 10px 40px rgba(15, 23, 42, 0.12),
        0 0 0 1px rgba(15, 23, 42, 0.06);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.45;
    opacity: 0;
    transform: translateY(-0.75rem) scale(0.98);
    transition:
        opacity 0.28s ease,
        transform 0.28s ease;
    border-left: 4px solid #64748b;
}

.global-notification.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.global-notification.hide {
    opacity: 0;
    transform: translateY(-0.5rem) scale(0.98);
}

.global-notification--success {
    border-left-color: #16a34a;
}

.global-notification--error {
    border-left-color: #dc2626;
}

.global-notification--warning {
    border-left-color: #ca8a04;
}

.global-notification--info {
    border-left-color: #2563eb;
}

.global-notification__message {
    flex: 1;
    min-width: 0;
    padding-top: 0.1rem;
    word-break: break-word;
}

.global-notification__close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    margin: -0.2rem -0.25rem 0 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.global-notification__close:hover {
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.global-notification__progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    width: 100%;
    border-radius: 0 0 10px 10px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.35), rgba(37, 99, 235, 0.85));
    transform-origin: left center;
}

.global-notification {
    position: relative;
    overflow: hidden;
}

.global-notification--success .global-notification__progress {
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.35), rgba(22, 163, 74, 0.9));
}

.global-notification--error .global-notification__progress {
    background: linear-gradient(90deg, rgba(220, 38, 38, 0.35), rgba(220, 38, 38, 0.9));
}

.global-notification--warning .global-notification__progress {
    background: linear-gradient(90deg, rgba(202, 138, 4, 0.35), rgba(202, 138, 4, 0.9));
}

@media (max-width: 768px) {
    .global-notification-container {
        top: max(4.5rem, calc(env(safe-area-inset-top, 0px) + 3.75rem));
        width: min(calc(100vw - 1.5rem), 28rem);
        max-width: calc(100vw - 1.5rem);
        padding-left: env(safe-area-inset-left, 0px);
        padding-right: env(safe-area-inset-right, 0px);
        box-sizing: border-box;
    }

    .global-notification {
        max-height: min(42vh, 300px);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        align-items: flex-start;
        padding: 0.85rem 0.9rem;
    }

    .global-notification__message {
        overflow-wrap: anywhere;
        word-break: break-word;
    }
}

@media print {
    .global-notification-container {
        display: none !important;
    }
}
