/* ========== manager.toast.css (JS-compatible) ========== */
:root{
    --toast-w: 360px;
    --toast-gap: 10px;

    --toast-bg: rgba(255,255,255,.72);
    --toast-border: rgba(0,0,0,.08);
    --toast-shadow: 0 14px 30px rgba(0,0,0,.14);

    --toast-text: #111827;
    --toast-muted: #6b7280;

    --toast-radius: 14px;
    --toast-blur: 14px;

    --t-success: #16a34a;
    --t-error:   #dc2626;
    --t-warning: #f59e0b;
    --t-info:    #2563eb;
    --t-default: #64748b;
}

#toast-container{
    position: fixed;
    right: 20px;
    top: 20px;      /* было bottom */
    bottom: auto;   /* важно */
    z-index: 9999;

    width: var(--toast-w);
    max-width: calc(100vw - 40px);

    display: flex;
    flex-direction: column;
    gap: var(--toast-gap);

    pointer-events: none;
}
/* Card */
.toast{
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 12px;

    padding: 14px;
    border-radius: var(--toast-radius);

    background: var(--toast-bg);
    border: 1px solid var(--toast-border);
    box-shadow: var(--toast-shadow);

    backdrop-filter: blur(var(--toast-blur));
    -webkit-backdrop-filter: blur(var(--toast-blur));

    color: var(--toast-text);

    transform: translateY(-10px);
    opacity: 0;

    transition: transform .18s ease, opacity .18s ease;
    overflow: hidden;
}

/* ВАЖНО: JS добавляет именно эти классы */
.toast.toast--show{
    transform: translateY(0);
    opacity: 1;
}
.toast.toast--hiding{
    transform: translateY(-10px);
    opacity: 0;
}

/* Icon (JS создаёт .toast__icon + img) */
.toast__icon{
    width: 36px;
    height: 36px;
    border-radius: 12px;
    flex: 0 0 auto;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.toast__icon img{
    width: 24px;
    height: 24px;
    display: block;
}

/* Content (JS создаёт .toast__content) */
.toast__content{
    flex: 1 1 auto;
    min-width: 0;
}

.toast__title{
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 2px 0;
    color: var(--toast-text);
}

.toast__message{
    font-size: 13px;
    line-height: 1.35;
    color: var(--toast-muted);
    margin: 0;
    word-break: break-word;
}

.toast__link{
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--t-info);
    text-decoration: none;
}
.toast__link:hover{ text-decoration: underline; }

/* Close button (JS: .toast__close) */
.toast__close{
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    color: #9ca3af;
    transition: background .15s ease, color .15s ease;
}
.toast__close:hover{
    background: rgba(0,0,0,.06);
    color: #111827;
}

/* Progress (JS: .toast__progress / row / bg / bar / text) */
.toast__progress{
    margin-top: 10px;
}

.toast__progress-row{
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast__progress-bg{
    flex: 1 1 auto;
    height: 6px;
    background: rgba(0,0,0,.08);
    border-radius: 999px;
    overflow: hidden;
}

.toast__progress-bar{
    height: 100%;
    width: 0%;
    border-radius: 999px;
    transition: width .12s linear;
}

.toast__progress-text{
    flex: 0 0 auto;
    font-size: 11px;
    color: var(--toast-text);
    min-width: 34px;
    text-align: right;
}

/* Actions (если используешь в options.actions) */
.toast__actions{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.toast__btn{
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    line-height: 1.2;
}

.toast__btn--secondary{
    background: rgba(0,0,0,.04);
    border-color: rgba(0,0,0,.08);
    color: var(--toast-text);
}
.toast__btn--secondary:hover{
    background: rgba(0,0,0,.07);
}

.toast__btn--primary{
    background: var(--t-info);
    color: #fff;
}
.toast__btn--primary:hover{
    filter: brightness(.95);
}

/* Types — JS использует toast--success/error/missed/status/update/message/default */
.toast--success .toast__icon{ background: color-mix(in srgb, var(--t-success) 14%, transparent); }
.toast--success .toast__progress-bar{ background: var(--t-success); }

.toast--error .toast__icon{ background: color-mix(in srgb, var(--t-error) 14%, transparent); }
.toast--error .toast__progress-bar{ background: var(--t-error); }

.toast--missed .toast__icon{ background: color-mix(in srgb, var(--t-warning) 14%, transparent); }
.toast--missed .toast__progress-bar{ background: var(--t-warning); }

.toast--status .toast__icon{ background: color-mix(in srgb, var(--t-info) 14%, transparent); }
.toast--status .toast__progress-bar{ background: var(--t-info); }

.toast--update .toast__icon{ background: color-mix(in srgb, var(--t-info) 14%, transparent); }
.toast--update .toast__progress-bar{ background: var(--t-info); }

.toast--message .toast__icon{ background: color-mix(in srgb, var(--t-default) 14%, transparent); }
.toast--message .toast__progress-bar{ background: var(--t-default); }

.toast--default .toast__icon{ background: color-mix(in srgb, var(--t-default) 14%, transparent); }
.toast--default .toast__progress-bar{ background: var(--t-default); }

/* fallback если браузер не поддерживает color-mix */
@supports not (background: color-mix(in srgb, #000 10%, transparent)){
    .toast--success .toast__icon{ background: rgba(100,116,139,.14);}
    .toast--error   .toast__icon{ background: rgba(220,38,38,.14); }
    .toast--missed  .toast__icon{ background: rgba(245,158,11,.14); }
    .toast--status  .toast__icon{ background: rgba(100,116,139,.14);}
    .toast--update  .toast__icon{ background: rgba(100,116,139,.14); }
    .toast--message .toast__icon{ background: rgba(100,116,139,.14); }
    .toast--default .toast__icon{ background: rgba(100,116,139,.14); }
}

@media (max-width: 420px){
    #toast-container{ right: 12px; bottom: 12px; max-width: calc(100vw - 24px); }
    .toast{ padding: 12px; }
}
