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

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    background-color: #f0f2f5;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    height: 90vh;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    background-color: #ffffff;
    border-radius: 12px 12px 0 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-content h1 {
    font-size: 1.2rem;
    color: #1a1a1a;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f8f9fa;
}

.message {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    gap: 8px;
}

.message.sent {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.message-content {
    max-width: 60%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
}

.message.sent .message-content {
    background-color: #0084ff;
    color: white;
    border-radius: 16px 16px 4px 16px;
}

.message.received .message-content {
    background-color: white;
    color: black;
    border-radius: 16px 16px 16px 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-input {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    background-color: white;
    border-radius: 0 0 12px 12px;
}

.chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e0e0e0;
    border-radius: 24px;
    outline: none;
    font-size: 1rem;
    background-color: #f8f9fa;
    transition: border-color 0.2s, background-color 0.2s;
}

.chat-input input:focus {
    border-color: #0084ff;
    background-color: white;
}

.chat-input button {
    width: 46px;
    height: 46px;
    background-color: #0084ff;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
}

.chat-input button:hover {
    background-color: #0073e6;
    transform: scale(1.05);
}

.chat-input button svg {
    width: 20px;
    height: 20px;
}

/* スクロールバーのカスタマイズ */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* レスポンシブデザイン */
@media (max-width: 600px) {
    .chat-container {
        height: 100vh;
        border-radius: 0;
    }
    
    .chat-header {
        border-radius: 0;
    }
    
    .message-content {
        max-width: 75%;
    }
}

/* メッセージ送信時のアニメーション */
@keyframes messageAppear {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message {
    animation: messageAppear 0.3s ease-out;
}

/* Rotating loader */
.button-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3); /* Adjust color and transparency */
    border-top: 2px solid #ffffff; /* Adjust color for the visible part */
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Keyframes for spin animation */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
