/* ============================================================
   iBase — ui.css
   Toasts + Modal
   ============================================================ */

/* === TOASTS === */
.toast-container {
    position: fixed;
    top: 88px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    background: var(--toast-bg, rgba(15, 15, 22, 0.95));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--accent-soft);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    animation: toastIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
    transition: transform 0.3s, opacity 0.3s;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(120%) scale(0.9); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

.toast.removing {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastOut {
    to { opacity: 0; transform: translateX(120%) scale(0.9); }
}

.toast::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
}

.toast.success::before { background: var(--success); box-shadow: 0 0 12px var(--success); }
.toast.error::before   { background: var(--error);   box-shadow: 0 0 12px var(--error); }
.toast.warning::before { background: var(--warning); box-shadow: 0 0 12px var(--warning); }
.toast.info::before    { background: var(--accent);  box-shadow: 0 0 12px var(--accent); }

.toast-icon {
    width: 32px; height: 32px;
    border-radius: 10px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 18px; height: 18px;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

.toast.success .toast-icon { background: rgba(16, 185, 129, 0.15);  color: var(--success); }
.toast.error   .toast-icon { background: rgba(239, 68, 68, 0.15);   color: var(--error); }
.toast.warning .toast-icon { background: rgba(245, 158, 11, 0.15);  color: var(--warning); }
.toast.info    .toast-icon { background: var(--accent-soft);        color: var(--accent-hover); }

.toast-body { flex: 1; min-width: 0; }

.toast-title {
    font-weight: 700;
    font-size: 0.95em;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.toast-message {
    font-size: 0.85em;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toast-close svg {
    width: 14px; height: 14px;
    stroke-width: 2.5;
    stroke-linecap: round;
    display: block;
}

.toast-progress {
    position: absolute;
    left: 0; bottom: 0;
    height: 2px;
    background: var(--accent);
    animation: toastProgress linear forwards;
}

.toast.success .toast-progress { background: var(--success); }
.toast.error   .toast-progress { background: var(--error); }
.toast.warning .toast-progress { background: var(--warning); }

@keyframes toastProgress {
    from { width: 100%; }
    to   { width: 0%; }
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay, rgba(0, 0, 0, 0.7));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--modal-bg, #0F0F16);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    max-width: 480px;
    width: 100%;
    box-shadow: var(--shadow-modal, 0 24px 64px rgba(0, 0, 0, 0.6));
    transform: scale(0.92) translateY(20px);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s;
    position: relative;
    overflow: hidden;
}

.modal-overlay.visible .modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-primary);
    background-size: 200% auto;
    animation: gradShift 3s ease infinite;
}

.modal.modal-danger::before {
    background: linear-gradient(90deg, var(--error), #F87171);
}

.modal.modal-warning::before {
    background: linear-gradient(90deg, var(--warning), #FBBF24);
}

.modal.modal-success::before {
    background: linear-gradient(90deg, var(--success), #34D399);
}

.modal-icon {
    width: 56px; height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.modal.modal-danger .modal-icon  { background: rgba(239, 68, 68, 0.15);  color: var(--error); }
.modal.modal-warning .modal-icon { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.modal.modal-success .modal-icon { background: rgba(16, 185, 129, 0.15); color: var(--success); }

.modal-icon svg {
    width: 28px; height: 28px;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

.modal-title {
    font-size: 1.3em;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.modal-text {
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.5;
    font-size: 0.95em;
}

.modal .field {
    margin-bottom: 24px;
}

.modal .field-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s;
}

.modal .field-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-actions .btn {
    width: auto;
    min-width: 110px;
    padding: 12px 22px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: all 0.2s;
    z-index: 1;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-close svg {
    width: 18px; height: 18px;
    stroke-width: 2.5;
    stroke-linecap: round;
    display: block;
}

/* === АДАПТИВ === */
@media (max-width: 720px) {
    .toast-container {
        left: 16px;
        right: 16px;
        top: 76px;
        max-width: none;
    }
    .modal {
        padding: 24px;
    }
    .modal-actions {
        flex-direction: column-reverse;
    }
    .modal-actions .btn {
        width: 100%;
    }
}