/*
 * ccr-notice — top-right toast stack for AJAX feedback.
 * Variants: error, warning, info, success.
 *
 * Tokens are sourced from the CDS plugin (--type-*, --panel, --fg, etc.)
 * with sane dark-mode fallbacks so toasts render even when CDS is absent.
 */

#ccr-notice-stack {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: calc(100vw - 32px);
    max-width: 380px;
    pointer-events: none; /* container is non-interactive */
}

.ccr-notice {
    pointer-events: auto;
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    align-items: center;
    column-gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    /* Hardcoded surface — don't depend on CDS tokens, which can resolve too
     * close to the page background on dark-themed pages (toast disappears). */
    background: #1f2024;
    color: #f5f5f5;
    border: 1px solid #3a3b40;
    border-left: 4px solid #3a3b40;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
    font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    opacity: 0;
    transform: translateX(12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.ccr-notice-visible {
    opacity: 1;
    transform: translateX(0);
}

.ccr-notice-dismissing {
    opacity: 0;
    transform: translateX(12px);
}

.ccr-notice-icon {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
    align-self: center;
}

/* Variant accent colours — left border + subtle tint into the bg so each
 * type reads at a glance even before reading the message. */
.ccr-notice-error   { border-left-color: #f43f5e; background: #2a1518; }
.ccr-notice-error   .ccr-notice-icon { color: #f43f5e; }

.ccr-notice-warning { border-left-color: #f59e0b; background: #2a2014; }
.ccr-notice-warning .ccr-notice-icon { color: #f59e0b; }

.ccr-notice-info    { border-left-color: #6aa9ff; background: #15192a; }
.ccr-notice-info    .ccr-notice-icon { color: #6aa9ff; }

.ccr-notice-success { border-left-color: #3ecf8e; background: #15261e; }
.ccr-notice-success .ccr-notice-icon { color: #3ecf8e; }

.ccr-notice-message {
    word-wrap: break-word;
    color: inherit;
    min-width: 0; /* allow flex/grid truncation */
}

.ccr-notice-action {
    background: transparent;
    color: #c4a8ff;
    border: 1px solid #c4a8ff;
    border-radius: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
}
.ccr-notice-action:hover {
    background: #c4a8ff;
    color: #1f2024;
}
.ccr-notice-action:focus-visible {
    outline: 2px solid #c4a8ff;
    outline-offset: 2px;
}

.ccr-notice-close {
    background: transparent;
    color: #999;
    border: none;
    cursor: pointer;
    padding: 0 4px;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}
.ccr-notice-close:hover { color: #fff; }
.ccr-notice-close:focus-visible {
    outline: 2px solid #c4a8ff;
    outline-offset: 2px;
    border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .ccr-notice {
        transition: opacity 0ms;
        transform: none;
    }
    .ccr-notice-dismissing { transform: none; }
}

@media (max-width: 480px) {
    #ccr-notice-stack {
        top: 8px;
        right: 8px;
        left: 8px;
        max-width: none;
        width: auto;
    }
}
