* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: #0f0f0f;
    color: #e0e0e0;
    height: 100vh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 800px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px 20px 0;
}

header {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 1px solid #2a2a2a;
    flex-shrink: 0;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #fff;
}

.subtitle {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
}

.stats {
    font-size: 0.75rem;
    color: #666;
    margin-top: 8px;
}

.chat {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    line-height: 1.5;
    font-size: 0.95rem;
}

.message.user .message-content {
    background: #2563eb;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: #1e1e1e;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
    border: 1px solid #2a2a2a;
}

.message.loading .message-content {
    color: #888;
}

.dots::after {
    content: '';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}

.sources {
    margin-top: 8px;
    padding: 10px 14px;
    background: #161616;
    border-radius: 8px;
    border: 1px solid #222;
    font-size: 0.8rem;
    color: #999;
}

.sources strong {
    color: #bbb;
}

.sources ul {
    list-style: none;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sources li {
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-text { background: #1e3a5f; color: #60a5fa; }
.badge-document { background: #3b1f5e; color: #c084fc; }
.badge-image { background: #1a3f2e; color: #4ade80; }
.badge-video { background: #5c3a1e; color: #fb923c; }

.score {
    color: #555;
    font-size: 0.7rem;
    margin-left: auto;
}

.media-gallery {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.media-item {
    background: #161616;
    border: 1px solid #222;
    border-radius: 10px;
    overflow: hidden;
}

.media-item img {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    display: block;
    background: #0a0a0a;
}

.media-item video {
    width: 100%;
    max-height: 400px;
    display: block;
    background: #000;
}

.media-label {
    padding: 8px 12px;
    font-size: 0.8rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid #222;
}

.input-area {
    display: flex;
    gap: 10px;
    padding: 16px 0 20px;
    border-top: 1px solid #2a2a2a;
    flex-shrink: 0;
}

#question {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #e0e0e0;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

#question:focus {
    border-color: #2563eb;
}

#question::placeholder {
    color: #555;
}

#send-btn {
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

#send-btn:hover {
    background: #1d4ed8;
}

#send-btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
}

pre {
    background: #111;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

code {
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 0.85rem;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 3px;
}
