/* 메인 대화 영역 */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

.chat-header {
    padding: 15px 25px;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #4a6cf7;
    color: white;
}

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

.header-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 8px 15px;
    margin-left: 10px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.header-actions button:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.conversation-history {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    max-width: 85%;
    padding: 0;
}

.message-avatar {
    width: 36px;
    height: 36px;
    margin-top: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

.user-avatar {
    background-color: #4a6cf7;
    margin-left: 15px;
}

.assistant-avatar {
    background-color: #10b981;
    margin-right: 15px;
}

.message-content {
    flex: 1;
}

.message-sender {
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 14px;
}

.message-text {
    line-height: 1.6;
    font-size: 15px;
}

.user-message {
    display: flex;
    align-self: flex-end;
    flex-direction: row-reverse;
}

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

.user-message .message-sender {
    display: flex;
    flex-direction: row-reverse;
}

.system-message {
    align-self: center;
    background-color: #f8f9fa;
    padding: 8px 15px;
    border-radius: 15px;
    font-size: 13px;
    color: #666;
    max-width: 70%;
    text-align: center;
}

.message-input-container {
    padding: 15px 25px 25px;
    border-top: 1px solid #eaeaea;
}

.message-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2px;
    background-color: #fff;
}

.message-input {
    flex: 1;
    border: none;
    padding: 4px 15px;
    font-size: 15px;
    resize: none;
    outline: none;
    max-height: 120px;
    min-height: 24px;
    height: 48px;
    font-family: inherit;
}

.send-button {
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    margin-right: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.send-button:hover {
    background-color: #3a5ce5;
}

/* 로딩 애니메이션 */
.loading-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 15px 0;
}

.loading-dots {
    display: flex;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    margin: 0 4px;
    background-color: #ccc;
    border-radius: 50%;
    animation: pulse 1.5s infinite ease-in-out;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes pulse {
    0%, 100% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* 표 스타일 */
.message-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
    font-size: 14px;
    background-color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.message-text table thead {
    background-color: #f8f9fa;
}

.message-text table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
}

.message-text table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
    color: #212529;
}

.message-text table tbody tr:hover {
    background-color: #f8f9fa;
}

.message-text table tbody tr:last-child td {
    border-bottom: none;
}

/* 반응형 표 */
@media (max-width: 768px) {
    .message-text table {
        font-size: 12px;
    }
    
    .message-text table th,
    .message-text table td {
        padding: 8px 10px;
    }
}

/* 우하단 고정 챗봇 버튼 */
.chatbot-button-fixed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.chatbot-btn-small {
    width: 50px;
    height: 50px;
    background-color: #3b82f6;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
    position: relative;
    overflow: hidden;
}

.chatbot-btn-small:hover {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.chatbot-btn-small:active {
    transform: translateY(0);
}

.btn-icon {
    width: 30px;
    height: 30px;
    background-color: transparent;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.btn-icon svg {
    width: 24px;
    height: 24px;
}

/* 우하단 페이드 채팅창 (버튼 위에 위치) */
.chatbot-panel {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 367px; /* 350px * 1.05 = 367px */
    height: 525px; /* 500px * 1.05 = 525px */
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chatbot-panel:not(.hidden) {
    opacity: 1;
    visibility: visible;
}

/* 채팅창 내부 스타일 */
.chatbot-panel .chat-header {
    background-color: #4a6cf7;
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 12px 12px 0 0;
}

.chatbot-panel .chat-title {
    font-size: 16px;
    font-weight: 600;
}

.chatbot-panel .header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-panel .header-actions button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    cursor: pointer;
    font-size: 14px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.chatbot-panel .header-actions button:hover {
    background-color: rgba(255, 255, 255, 0.25);
}

.chatbot-panel .conversation-history {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chatbot-panel .message-input-container {
    padding: 15px;
    border-top: 1px solid #eaeaea;
}

.chatbot-panel .message-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2px;
    background-color: #fff;
}

.chatbot-panel .message-input {
    flex: 1;
    border: none;
    padding: 8px 12px;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 80px;
    min-height: 20px;
    height: 48px;
    font-family: inherit;
}

.chatbot-panel .send-button {
    background-color: #4a6cf7;
    color: white;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    margin-right: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.chatbot-panel .send-button:hover {
    background-color: #3a5ce5;
}

.chatbot-panel .send-button svg {
    width: 18px;
    height: 18px;
    transform: translate(-1px, 1px);
}

/* 반응형 스타일 */
@media (max-width: 768px) {
    .chatbot-panel {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 20px;
        left: 20px;
        max-width: none;
    }
    
    .chatbot-button-fixed {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-btn-small {
        width: 45px;
        height: 45px;
    }
    
    .btn-icon svg {
        width: 20px;
        height: 20px;
    }
}