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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #f0f2f5;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-container {
    width: 100%;
    max-width: 700px;
    height: 90vh;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: #1a56db;
    color: #fff;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.header-icon {
    font-size: 28px;
}

.chat-header h1 {
    font-size: 18px;
    font-weight: 600;
}

.chat-header p {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 2px;
}

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

.message {
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

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

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.message.bot .message-content {
    background: #f0f2f5;
    color: #1a1a1a;
    border-bottom-left-radius: 4px;
}

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

.message-sources {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    padding-left: 16px;
}

.message-sources span {
    background: #e8edf3;
    padding: 2px 8px;
    border-radius: 4px;
    margin-right: 4px;
    display: inline-block;
    margin-bottom: 4px;
}

.chat-input {
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
}

.chat-input form {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input input:focus {
    border-color: #1a56db;
}

.chat-input button {
    padding: 12px 24px;
    background: #1a56db;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-input button:hover {
    background: #1544b8;
}

.chat-input button:disabled {
    background: #93a3c0;
    cursor: not-allowed;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #f0f2f5;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: bounce 1.4s infinite;
}

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

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Iframe-läge för SharePoint */
@media (max-width: 500px) {
    body { background: #fff; }
    .chat-container {
        height: 100vh;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
    }
}
