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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 90%; 
    max-width: 600px; 
    height: 80vh;
    background: white; 
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    display: flex; 
    flex-direction: column; 
    overflow: hidden;
}

.chat-tabs {
    display: flex;
    background: #f3f3f3;
    border-bottom: 1px solid #e0e0e0;
}

.chat-tab {
    flex: 1;
    padding: 18px 0;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    color: #888;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.chat-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: default;
}

.chat-header {
    background: none;
    color: #333;
    padding: 10px 0 0 0;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
}

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

/* 수평 정렬용 wrapper */
.message-row {
    display: flex;
    align-items: flex-end;
    gap: 4px; /* 말풍선과 시간 간격 */
}

/* 사용자 메시지는 말풍선-시간 순서 역순 (오른쪽 정렬) */
.message.user .message-row {
    flex-direction: row-reverse;
}

/* 챗봇 메시지는 기본 방향 (왼쪽 정렬) */
.message.bot .message-row {
    flex-direction: row;
}

/* 기존 message 유지 */
.message {
    margin-bottom: 15px;
    display: flex;
    justify-content: flex-end;
}

/* 사용자 */
.message.user {
    justify-content: flex-end;
}

/* 챗봇 */
.message.bot {
    justify-content: flex-start;
}

/* 말풍선 */
.message .message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.4;
    position: relative;
    font-size: 1em;
    text-align: left;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* 사용자 말풍선 */
.message.user .message-content {
    background: #ffe34d;
    color: #222;
    border: 1px solid #ffe066;
    border-radius: 18px 18px 4px 18px;
}

/* 챗봇 말풍선 */
.message.bot .message-content {
    background: #f1f0f0;
    color: #333;
    border: 1px solid #e0e0e0;
    border-radius: 18px 18px 18px 4px;
}

/* 시간 */
.message-time {
    font-size: 0.7em;
    color: #999;
    white-space: nowrap;
}

.chat-input-container {
    padding: 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

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

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input:focus { 
    border-color: #667eea; 
}

.send-button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s;
}

.send-button:hover { 
    transform: translateY(-2px); 
}

.clear-button {
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    margin-top: 10px;
    transition: background-color 0.3s;
}

.clear-button:hover { 
    background: #c82333; 
}

.help-text {
    text-align: center;
    color: #666;
    font-size: 12px;
    margin-top: 10px;
}

.typing-indicator {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    min-width: 180px;
    z-index: 1000;
    display: none;
    padding: 14px 28px;
    background: linear-gradient(90deg, #764ba2 0%, #667eea 100%);
    color: #fff;
    border-radius: 24px;
    box-shadow: 0 4px 16px rgba(118,75,162,0.15);
    font-style: normal;
    font-weight: bold;
    font-size: 1.05em;
    letter-spacing: 0.02em;
    animation: pulse 1.5s ease-in-out infinite;
    border: 2px solid #fff;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading-dots {
    display: inline-block;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

.chat-input:disabled,
.send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.send-button:disabled:hover {
    transform: none;
}

@media (max-width: 768px) {
    .chat-container { 
        width: 95%; 
        height: 90vh; 
    }
    .message-content { 
        max-width: 85%; 
    }
    .typing-indicator {
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        min-width: 120px;
        padding: 10px 16px;
        font-size: 0.95em;
        z-index: 1000;
    }
} 