* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chatbot-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    max-height: 800px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
}

.header-text h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 4px;
}

.header-text p {
    font-size: 14px;
    opacity: 0.9;
}

.clear-chat-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.clear-chat-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chatbot-messages::-webkit-scrollbar {
    width: 8px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.welcome-message {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 8px;
}

.welcome-icon {
    font-size: 32px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 12px;
    flex-shrink: 0;
}

.welcome-text {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.welcome-text h2 {
    font-size: 20px;
    margin-bottom: 8px;
    color: #333;
}

.welcome-text p {
    color: #666;
    margin-bottom: 16px;
    line-height: 1.6;
}

.suggested-questions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.suggest-btn {
    background: #f0f0f0;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s;
    color: #333;
    font-size: 14px;
}

.suggest-btn:hover {
    background: #e0e0e0;
    transform: translateX(4px);
}

.message {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message.bot .message-avatar {
    background: #e9ecef;
    color: #495057;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 마크다운 스타일 */
.message-content :first-child {
    margin-top: 0;
}

.message-content :last-child {
    margin-bottom: 0;
}

.message-content h1,
.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5,
.message-content h6 {
    margin-top: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    line-height: 1.4;
}

.message-content h1 {
    font-size: 1.5em;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 8px;
}

.message-content h2 {
    font-size: 1.3em;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 6px;
}

.message-content h3 {
    font-size: 1.15em;
}

.message-content h4 {
    font-size: 1.05em;
}

.message-content p {
    margin: 8px 0;
    line-height: 1.6;
}

.message-content ul,
.message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-content ul li {
    list-style-type: disc;
}

.message-content ol li {
    list-style-type: decimal;
}

.message-content strong {
    font-weight: 600;
    color: #333;
}

.message-content em {
    font-style: italic;
}

.message-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #e83e8c;
}

.message-content pre {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 12px 0;
    border: 1px solid #e9ecef;
}

.message-content pre code {
    background: none;
    padding: 0;
    color: #333;
    font-size: 0.9em;
}

.message-content blockquote {
    border-left: 4px solid #667eea;
    padding-left: 16px;
    margin: 12px 0;
    color: #666;
    font-style: italic;
}

.message-content a {
    color: #667eea;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.message-content a:hover {
    border-bottom-color: #667eea;
}

.message-content hr {
    border: none;
    border-top: 1px solid #e9ecef;
    margin: 16px 0;
}

.message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.message-content table th,
.message-content table td {
    border: 1px solid #e9ecef;
    padding: 8px 12px;
    text-align: left;
}

.message-content table th {
    background: #f8f9fa;
    font-weight: 600;
}

.message-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

.message.user .message-time {
    text-align: right;
}

.chatbot-input-container {
    background: white;
    border-top: 1px solid #e9ecef;
    padding: 16px 24px;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s;
    outline: none;
}

#messageInput:focus {
    border-color: #667eea;
}

#messageInput::placeholder {
    color: #adb5bd;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-footer {
    margin-top: 8px;
    height: 20px;
}

.typing-indicator {
    font-size: 12px;
    color: #667eea;
    font-style: italic;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    
    .chatbot-container {
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .header-text h1 {
        font-size: 20px;
    }
    
    .header-text p {
        font-size: 12px;
    }
    
    .message-content {
        max-width: 85%;
    }
}

/* 로딩 애니메이션 */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #667eea;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}