﻿* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0f172a;
    color: #e5e7eb;
    height: 100vh;
    display: flex;
}

.app-shell {
    display: flex;
    width: 100%;
    height: 100%;
}

.sidebar {
    width: 260px;
    background: #020617;
    border-right: 1px solid #1f2937;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-header {
    margin-bottom: 8px;
}

.sidebar-title {
    font-size: 18px;
    font-weight: 600;
}

.sidebar-subtitle {
    font-size: 12px;
    color: #9ca3af;
}

.interface-list {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.interface-item {
    border-radius: 8px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: background 0.15s, border-color 0.15s;
}

.interface-item:hover {
    background: #020617;
    border-color: #1f2937;
}

.interface-item.active {
    background: #0f172a;
    border-color: #22c55e;
}

.interface-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.interface-icon {
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #a5b4fc;
    flex: 0 0 auto;
}

.interface-icon img,
.interface-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.interface-icon svg {
    stroke: currentColor;
}

.interface-label {
    font-size: 14px;
    font-weight: 500;
}

.interface-description {
    font-size: 12px;
    color: #9ca3af;
}

.interface-tag {
    margin-top: 4px;
    font-size: 11px;
    color: #a5b4fc;
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 8px;
}

.mobile-interface-picker {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid #1f2937;
    background: #020617;
}

.mobile-interface-label {
    font-size: 12px;
    color: #9ca3af;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.interface-select {
    flex: 1;
    border-radius: 8px;
    border: 1px solid #1f2937;
    background: #0f172a;
    color: #e5e7eb;
    padding: 6px 10px;
    font-size: 14px;
    font-family: inherit;
}

.interface-select:focus {
    outline: none;
    border-color: #22c55e;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid #1f2937;
}

.current-interface-name {
    font-size: 16px;
    font-weight: 600;
}

.current-interface-desc {
    font-size: 12px;
    color: #9ca3af;
}

.status-badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid #1f2937;
    color: #9ca3af;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #22c55e;
}

.status-badge.loading .status-dot {
    background: #fbbf24;
}

.status-badge.error .status-dot {
    background: #ef4444;
}

.chat-window {
    flex: 1;
    margin-top: 8px;
    border-radius: 12px;
    border: 1px solid #1f2937;
    background: radial-gradient(circle at top, #020617 0, #020617 40%, #020617 100%);
    padding: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-row {
    display: flex;
    margin-bottom: 4px;
}

.message-row.user {
    justify-content: flex-end;
}

.message-row.assistant {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 70%;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message-bubble p {
    margin: 0 0 6px 0;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    margin: 8px 0 6px 0;
    font-size: 1em;
}

.message-bubble ul {
    margin: 6px 0;
    padding-left: 18px;
}

.message-bubble li {
    margin: 2px 0;
}

.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 6px 0;
    font-size: 13px;
}

.message-bubble th,
.message-bubble td {
    border: 1px solid #1f2937;
    padding: 6px 8px;
    text-align: left;
    vertical-align: top;
}

.message-bubble th {
    background: #111827;
    color: #e5e7eb;
}

.message-bubble.user {
    background: #22c55e;
    color: #022c22;
    border-bottom-right-radius: 4px;
}

.message-bubble.assistant {
    background: #020617;
    border: 1px solid #1f2937;
    border-bottom-left-radius: 4px;
}

.message-meta {
    font-size: 10px;
    color: #6b7280;
    margin-top: 2px;
}

.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #9ca3af;
    margin-top: 4px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    border-radius: 999px;
    background: #6b7280;
    animation: blink 1.2s infinite ease-in-out;
}

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

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

@keyframes blink {
    0%, 80%, 100% { opacity: 0.2; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-2px); }
}

.input-area {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-row {
    display: flex;
    gap: 8px;
}

.chat-input {
    flex: 1;
    resize: none;
    min-height: 48px;
    max-height: 120px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #1f2937;
    background: #020617;
    color: #e5e7eb;
    font-family: inherit;
    font-size: 14px;
}

.chat-input:focus {
    outline: none;
    border-color: #22c55e;
}

.send-button {
    padding: 0 16px;
    border-radius: 999px;
    border: none;
    background: #22c55e;
    color: #022c22;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.send-button:disabled {
    opacity: 0.6;
    cursor: default;
}

.hint-row {
    font-size: 11px;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
}

.hint-row span {
    opacity: 0.9;
}

.error-banner {
    display: none;
    margin-top: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.error-banner.visible {
    display: block;
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .mobile-interface-picker {
        display: flex;
    }
}
