/* Soniq8 Notification System — Toasts + Modals */

/* ── Toast Container ─────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 420px;
    width: calc(100% - 40px);
}

/* ── Toast ────────────────────────────────────────── */
.toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-lg);
    background: var(--surface-2);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
    pointer-events: auto;
    transform: translateX(120%);
    opacity: 0;
    transition: transform .35s cubic-bezier(.22,1,.36,1), opacity .35s ease;
    cursor: default;
    min-width: 280px;
}
.toast.toast-visible {
    transform: translateX(0);
    opacity: 1;
}
.toast.toast-exit {
    transform: translateX(120%);
    opacity: 0;
}

.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .7rem;
    margin-top: 1px;
}
.toast-body {
    flex: 1;
    min-width: 0;
}
.toast-title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}
.toast-message {
    font-size: .82rem;
    color: var(--text-2);
    line-height: 1.4;
    word-break: break-word;
}
.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    color: rgba(255,255,255,.3);
    cursor: pointer;
    font-size: .9rem;
    padding: 2px 4px;
    transition: color .2s;
}
.toast-close:hover { color: var(--text); }
.toast-action {
    flex-shrink: 0;
    background: none;
    border: 1px solid rgb(var(--primary-rgb) / .5);
    color: var(--primary-bright);
    cursor: pointer;
    font: inherit;
    font-size: .76rem;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    transition: all .18s;
}
.toast-action:hover { background: var(--primary); color: #06120c; }

/* Toast progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    transition: width linear;
}

/* Toast variants */
.toast-success .toast-icon { background: rgba(34,197,94,.15); color: #4ade80; }
.toast-success .toast-progress { background: #4ade80; }
.toast-success { border-color: rgba(34,197,94,.2); }

.toast-error .toast-icon { background: rgba(239,68,68,.15); color: #f87171; }
.toast-error .toast-progress { background: #f87171; }
.toast-error { border-color: rgba(239,68,68,.2); }

.toast-warning .toast-icon { background: rgba(234,179,8,.15); color: #facc15; }
.toast-warning .toast-progress { background: #facc15; }
.toast-warning { border-color: rgba(234,179,8,.2); }

.toast-info .toast-icon { background: rgba(59,130,246,.15); color: #60a5fa; }
.toast-info .toast-progress { background: #60a5fa; }
.toast-info { border-color: rgba(59,130,246,.2); }

/* ── Modal Overlay ───────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0);
    backdrop-filter: blur(0);
    transition: background .3s ease, backdrop-filter .3s ease;
    opacity: 0;
    pointer-events: none;
}
.modal-overlay.modal-visible {
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(4px);
    opacity: 1;
    pointer-events: auto;
}

/* ── Modal Dialog ────────────────────────────────── */
.modal-dialog {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 460px;
    width: 100%;
    transform: scale(.92) translateY(10px);
    transition: transform .3s cubic-bezier(.22,1,.36,1);
    overflow: hidden;
}
.modal-visible .modal-dialog {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 0;
}
.modal-header-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .95rem;
    flex-shrink: 0;
}
.modal-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.modal-body {
    padding: 16px 24px 4px;
    font-size: .9rem;
    color: var(--text-2);
    line-height: 1.5;
}
.modal-body input,
.modal-body textarea,
.modal-body select {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    font-size: .9rem;
    font-family: inherit;
    margin-top: 8px;
    transition: border-color .2s;
}
.modal-body input:focus,
.modal-body textarea:focus,
.modal-body select:focus {
    outline: none;
    border-color: var(--primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 20px;
}

.modal-btn {
    padding: 9px 20px;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    border: none;
    font-family: inherit;
}
.modal-btn-cancel {
    background: var(--surface-2);
    color: var(--text-2);
    border: 1px solid var(--line);
}
.modal-btn-cancel:hover {
    background: var(--surface-2);
    color: var(--text);
}
.modal-btn-confirm {
    background: var(--primary);
    color: var(--on-primary);
}
.modal-btn-confirm:hover {
    background: var(--primary-bright);
}
.modal-btn-danger {
    background: rgba(239,68,68,.15);
    color: #f87171;
    border: 1px solid rgba(239,68,68,.25);
}
.modal-btn-danger:hover {
    background: rgba(239,68,68,.25);
}

/* Modal variants */
.modal-confirm .modal-header-icon { background: rgba(29,185,84,.12); color: var(--primary); }
.modal-danger .modal-header-icon { background: rgba(239,68,68,.12); color: #f87171; }
.modal-warning .modal-header-icon { background: rgba(234,179,8,.12); color: #facc15; }
.modal-info .modal-header-icon { background: rgba(59,130,246,.12); color: #60a5fa; }

/* ── Cost Preview (Analysis Confirmation) ───────── */
.cost-preview {
    margin: -4px 0 4px;
}
.cost-thumb {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 14px;
}
.cost-thumb img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius);
    opacity: .85;
}
.cost-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,.75);
    color: var(--text);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .3px;
    font-variant-numeric: tabular-nums;
}
.cost-title {
    font-size: .92rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 14px;
    line-height: 1.35;
}
.cost-details {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}
.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: .85rem;
    color: var(--text-2);
}
.cost-row-after {
    border-top: 1px solid var(--line);
    margin-top: 2px;
    padding-top: 8px;
}
.cost-value {
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.cost-negative {
    color: #f87171;
}
.cost-warning {
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(239,68,68,.08);
    border: 1px solid rgba(239,68,68,.15);
    border-radius: var(--radius);
    color: #f87171;
    font-size: .82rem;
    text-align: center;
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 480px) {
    .toast-container { top: 10px; right: 10px; max-width: calc(100% - 20px); }
    .modal-dialog { max-width: 100%; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-btn { width: 100%; text-align: center; }
}
