:root {
    --pm-primary: #5e35b1;
    --pm-primary-rgb: 94, 53, 177;
    --pm-primary-dark: #4527a0;
    --bs-primary: var(--pm-primary);
    --bs-primary-rgb: var(--pm-primary-rgb);
    --bs-link-color: var(--pm-primary);
    --bs-link-hover-color: var(--pm-primary-dark);
}

body {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: #f8f9fa;
}

a {
    color: var(--pm-primary);
}

a:hover {
    color: var(--pm-primary-dark);
}

.btn-primary {
    --bs-btn-bg: var(--pm-primary);
    --bs-btn-border-color: var(--pm-primary);
    --bs-btn-hover-bg: var(--pm-primary-dark);
    --bs-btn-hover-border-color: var(--pm-primary-dark);
    --bs-btn-active-bg: var(--pm-primary-dark);
    --bs-btn-active-border-color: var(--pm-primary-dark);
    --bs-btn-disabled-bg: var(--pm-primary);
    --bs-btn-disabled-border-color: var(--pm-primary);
}

.btn-outline-primary {
    --bs-btn-color: var(--pm-primary);
    --bs-btn-border-color: var(--pm-primary);
    --bs-btn-hover-bg: var(--pm-primary);
    --bs-btn-hover-border-color: var(--pm-primary);
    --bs-btn-active-bg: var(--pm-primary-dark);
    --bs-btn-active-border-color: var(--pm-primary-dark);
}

.text-primary {
    color: var(--pm-primary) !important;
}

.bg-primary {
    background-color: var(--pm-primary) !important;
}

.border-primary {
    border-color: var(--pm-primary) !important;
}

.form-control:focus,
.form-select:focus,
.btn:focus,
.btn-close:focus {
    border-color: rgba(var(--pm-primary-rgb), 0.45);
    box-shadow: 0 0 0 0.25rem rgba(var(--pm-primary-rgb), 0.18);
}

.sidebar {
    background: linear-gradient(180deg, #5e35b1 0%, #4527a0 100%);
}

.sidebar .nav-link {
    transition: background 0.15s;
}

.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
}

.sidebar .active-nav {
    background: rgba(255, 255, 255, 0.18) !important;
    font-weight: 600;
}

.agent-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.agent-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}

.prompt-textarea {
    resize: vertical;
    min-height: 400px;
    font-size: 0.82rem;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px;
}

.prompt-textarea:focus {
    background: #1e1e1e;
    color: #d4d4d4;
    border-color: var(--pm-primary);
    box-shadow: 0 0 0 2px rgba(var(--pm-primary-rgb), 0.25);
}

.prompt-textarea::placeholder {
    color: #777;
}

.prompt-preview {
    font-family: 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.82rem;
    line-height: 1.5;
    background: #1e1e1e;
    color: #d4d4d4;
    border-radius: 6px;
    padding: 12px;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 400px;
    margin: 0;
}

.badge {
    font-weight: 500;
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.chat-area {
    background: #f0f2f5;
    border-radius: 6px 6px 0 0;
}

.chat-bubble {
    max-width: 72%;
    padding: 8px 12px 4px;
    border-radius: 12px;
    position: relative;
    word-break: break-word;
}

.bubble-user {
    background: var(--pm-primary);
    color: #fff;
    border-bottom-right-radius: 2px;
}

.bubble-agent {
    background: #fff;
    color: #212529;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 2px;
}

.bubble-error {
    background: #fff3f3;
    color: #842029;
    border: 1px solid #f5c2c7;
    border-bottom-left-radius: 2px;
}

.bubble-text {
    font-size: 0.9rem;
    line-height: 1.45;
    white-space: pre-wrap;
}

.bubble-time {
    font-size: 0.68rem;
    opacity: 0.6;
    text-align: right;
    margin-top: 2px;
}

.bubble-meta {
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-family: monospace;
}

.bubble-user .bubble-meta {
    border-top-color: rgba(255, 255, 255, 0.25);
}

.chat-input {
    resize: none;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 2px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #adb5bd;
    border-radius: 50%;
    display: inline-block;
    animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}
