/* ============================================================================
   IBackTested — Branded Dialog & Modal System
   Replaces default browser alert(), confirm(), prompt() with clean institutional UI
   ========================================================================== */

.ib-dialog-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.2s;
}

.ib-dialog-backdrop.ib-active {
    opacity: 1;
    visibility: visible;
}

.ib-dialog-window {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    transform: scale(0.95) translateY(8px);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: var(--font-sans, 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif);
}

.ib-dialog-backdrop.ib-active .ib-dialog-window {
    transform: scale(1) translateY(0);
}

.ib-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.ib-dialog-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ib-dialog-logo {
    height: 18px;
    width: auto;
    object-fit: contain;
}

.ib-dialog-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.ib-dialog-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ib-dialog-close:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.ib-dialog-body {
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.ib-dialog-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ib-dialog-icon-wrap.danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fee2e2;
}

.ib-dialog-icon-wrap.warning {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fef3c7;
}

.ib-dialog-icon-wrap.info {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #dbeafe;
}

.ib-dialog-icon-wrap.success {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
}

.ib-dialog-content {
    flex: 1;
}

.ib-dialog-msg {
    font-size: 0.88rem;
    line-height: 1.55;
    color: #334155;
    word-break: break-word;
}

.ib-dialog-input-wrap {
    margin-top: 14px;
}

.ib-dialog-input {
    width: 100%;
    box-sizing: border-box;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.88rem;
    color: #0f172a;
    outline: none;
    font-family: inherit;
    transition: all 0.15s ease;
}

.ib-dialog-input:focus {
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.ib-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px 20px;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.ib-dialog-btn {
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ib-dialog-btn-secondary {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: #475569;
}

.ib-dialog-btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

.ib-dialog-btn-primary {
    background: #0f172a;
    border: 1px solid #0f172a;
    color: #ffffff;
}

.ib-dialog-btn-primary:hover {
    background: #1e293b;
    border-color: #1e293b;
}

.ib-dialog-btn-danger {
    background: #dc2626;
    border: 1px solid #dc2626;
    color: #ffffff;
}

.ib-dialog-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* Toast System */
.ib-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.ib-toast {
    background: #0f172a;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 0.84rem;
    font-weight: 500;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
    animation: ibToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.2s, transform 0.2s;
    max-width: 380px;
    font-family: var(--font-sans, 'Plus Jakarta Sans', sans-serif);
}

.ib-toast.error {
    background: #dc2626;
}

.ib-toast.success {
    background: #059669;
}

.ib-toast.warning {
    background: #d97706;
}

.ib-toast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ib-toast.out {
    opacity: 0;
    transform: translateY(8px);
}

@keyframes ibToastIn {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
