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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.3);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px 30px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
}

.chat-header h1 {
    font-size: 24px;
    color: #333;
    margin-bottom: 4px;
}

.chat-header p {
    font-size: 14px;
    color: #666;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #fafafa;
}

.welcome-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.welcome-message h3 {
    font-size: 24px;
    color: #333;
    margin-bottom: 12px;
}

.welcome-message p {
    font-size: 16px;
    margin-bottom: 8px;
}

.hint {
    font-size: 14px;
    color: #999;
    font-style: italic;
    margin-top: 20px;
}

.message {
    margin-bottom: 24px;
    display: flex;
    flex-direction: column;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-content {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 18px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.user .message-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Thinking Indicator */
.thinking-indicator {
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fafafa;
    border-top: 1px solid #e0e0e0;
}

.thinking-dots {
    display: flex;
    gap: 6px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: thinking 1.4s infinite ease-in-out;
}

.thinking-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

.thinking-indicator p {
    color: #666;
    font-size: 14px;
}

@keyframes thinking {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

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

.chat-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

#messageInput {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: border-color 0.2s;
}

#messageInput:focus {
    outline: none;
    border-color: #667eea;
}

#sendBtn {
    width: 44px;
    height: 44px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

#sendBtn:hover {
    background: #5568d3;
}

#sendBtn:active {
    transform: scale(0.95);
}

#sendBtn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar,
.chat-list::-webkit-scrollbar {
    width: 8px;
}

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

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

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Tabs */
.header-tabs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.tab-btn {
    padding: 8px 16px;
    background: transparent;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: #f0f0f0;
}

.tab-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Tab Content */
.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* Article Container */
.article-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    background: #fafafa;
    overflow-y: auto;
}

.article-header {
    margin-bottom: 24px;
}

.article-header h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.article-header p {
    font-size: 14px;
    color: #666;
}

.article-step {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

.article-step h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #667eea;
}

.article-input-section {
    margin-bottom: 16px;
}

.article-controls {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}

#articlePromptInput {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

#articlePromptInput:focus {
    outline: none;
    border-color: #667eea;
}

.article-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.article-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s;
}

.article-btn:hover {
    background: #5568d3;
}

.article-btn:active {
    transform: scale(0.98);
}

.article-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.article-btn.secondary {
    background: #6c757d;
}

.article-btn.secondary:hover {
    background: #5a6268;
}


.article-status {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-status.loading {
    color: #667eea;
}

.article-status.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.article-status.error {
    color: #e74c3c;
}

.article-status.success {
    color: #27ae60;
}

.article-output-section {
    margin-top: 16px;
}

.article-text {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 15px;
    line-height: 1.8;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.article-actions {
    display: flex;
    gap: 12px;
}

.article-audio-section {
    margin-top: 16px;
}

.article-audio-status {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.article-audio-status.loading {
    color: #667eea;
}

.article-audio-status.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.article-audio-status.error {
    color: #e74c3c;
}

.article-audio-status.success {
    color: #27ae60;
}

.article-audio-output {
    margin-top: 16px;
}

/* TTS Container */
.tts-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 30px;
    background: #fafafa;
    overflow-y: auto;
}

.tts-header {
    margin-bottom: 24px;
}

.tts-header h2 {
    font-size: 24px;
    color: #333;
    margin-bottom: 8px;
}

.tts-header p {
    font-size: 14px;
    color: #666;
}

.tts-input-section {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 24px;
}

#ttsTextInput {
    width: 100%;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    resize: vertical;
    min-height: 120px;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

#ttsTextInput:focus {
    outline: none;
    border-color: #667eea;
}

.tts-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tts-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s;
}

.tts-btn:hover {
    background: #5568d3;
}

.tts-btn:active {
    transform: scale(0.98);
}

.tts-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.tts-status {
    font-size: 14px;
    color: #666;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tts-status.loading {
    color: #667eea;
}

.tts-status.loading::after {
    content: '';
    width: 12px;
    height: 12px;
    border: 2px solid #667eea;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.tts-status.error {
    color: #e74c3c;
}

.tts-status.success {
    color: #27ae60;
}

.tts-output-section {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.tts-output-section h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 16px;
}

.audio-player-container {
    margin-bottom: 16px;
}

.audio-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.audio-actions {
    display: flex;
    gap: 12px;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #27ae60;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.2s;
}

.download-btn:hover {
    background: #229954;
}

/* Responsive */
@media (max-width: 768px) {
    .article-container,
    .tts-container {
        padding: 20px;
    }
}
