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

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', sans-serif;
    background: #e8f2f7;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.chat-wrapper {
    width: 100%;
    max-width: 900px;
    height: 92vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.chat-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* 헤더 */
.chat-header {
    background: #1e88e5;
    padding: 24px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-icon {
    font-size: 36px;
}

.header-text h1 {
    color: white;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-text p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    font-weight: 400;
}

.clear-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 10px 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.clear-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* 메시지 영역 */
.chat-messages {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #ffffff;
}

/* 선택 버튼 그룹 */
.option-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0 20px 0;
}

.option-btn {
    background: white;
    border: 2px solid #1e88e5;
    color: #1e88e5;
    padding: 12px 20px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(30, 136, 229, 0.1);
    width: fit-content;
}

.option-btn:hover {
    background: #1e88e5;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

.option-btn .icon {
    font-size: 20px;
}

/* 메시지 */
.message {
    margin-bottom: 16px;
    padding: 16px 20px;
    line-height: 1.7;
    border-radius: 16px;
    max-width: 75%;
    word-wrap: break-word;
    animation: slideIn 0.3s ease-out;
}

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

.message.user {
    margin-left: auto;
    background: #1e88e5;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant {
    margin-right: auto;
    background: #f5f5f5;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

/* 메시지 내 마크다운 스타일 */
.message h1 {
    font-size: 22px;
    font-weight: 700;
    margin: 8px 0 10px 0;
    color: #1e88e5;
    line-height: 1.3;
}

.message h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 10px 0 6px 0;
    color: #2563eb;
    line-height: 1.4;
}

.message h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 4px 0 4px 0;
    color: #1f2937;
}

.message hr {
    border: none;
    border-top: 2px solid #d1d5db;
    margin: 16px 0;
}

.message ul, .message ol {
    margin: 2px 0;
    padding-left: 0;
}

.message li {
    margin: 2px 0 2px 20px;
    line-height: 1.5;
    list-style-type: disc;
    list-style-position: outside;
}

.message strong {
    font-weight: 600;
    color: #111827;
    display: inline-block;
    margin-top: 4px;
    margin-bottom: 2px;
}

.message a {
    color: #1e88e5;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.message a:hover {
    border-bottom-color: #1e88e5;
}

.message br {
    display: block;
    content: "";
    line-height: 0.1;
    margin: 0;
}

/* 입력 영역 */
.chat-input-area {
    padding: 24px 30px 28px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.input-wrapper {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 6px;
    transition: all 0.3s;
}

.input-wrapper:focus-within {
    border-color: #1e88e5;
    background: white;
}

.input-wrapper input {
    flex: 1;
    padding: 14px 16px;
    border: none;
    background: transparent;
    outline: none;
    font-size: 15px;
    color: #1f2937;
}

.input-wrapper input::placeholder {
    color: #9ca3af;
}

.send-button {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 12px;
    background: #1e88e5;
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.send-button:hover {
    transform: scale(1.05);
    background: #1976d2;
    box-shadow: 0 4px 12px rgba(30, 136, 229, 0.4);
}

.send-button:active {
    transform: scale(0.95);
}

.send-icon {
    display: block;
}

/* 스크롤바 */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

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

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

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

/* 로딩 인디케이터 */
.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

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

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}