/* English Coach Web Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4CAF50;
    --secondary-color: #81C784;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --text-color: #333;
    --text-secondary: #666;
    --border-color: #e0e0e0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --radius: 12px;
    --wendi-accent: #7CB342;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
}

.container {
    max-width: 900px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg-color);
    box-shadow: 0 0 20px rgba(0,0,0,0.2);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--wendi-accent) 0%, #558B2F 100%);
    color: white;
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow);
}

.header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.status-bar {
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 12px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #FFC107;
    animation: pulse 2s infinite;
}

.status-dot.ready {
    background: #4CAF50;
    animation: none;
}

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

/* Chat Container */
.chat-container {
    height: calc(100vh - 280px);
    overflow-y: auto;
    padding: 20px;
    background: var(--bg-color);
}

.message {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

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

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

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.ai-message .avatar {
    background: linear-gradient(135deg, #7CB342, #558B2F);
    box-shadow: 0 2px 8px rgba(124, 179, 66, 0.3);
}

.user-message .avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.5;
}

.ai-message .content {
    background: white;
    box-shadow: var(--shadow);
    color: var(--text-color);
}

.user-message .content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

/* Audio Play Button */
.audio-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 12px;
    background: var(--wendi-accent);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.audio-btn:hover {
    background: #558B2F;
    transform: scale(1.05);
}

.audio-btn.playing {
    background: #FF5722;
}

/* Input Area */
.input-area {
    background: white;
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 900px;
    margin: 0 auto;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
}

.controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 10px;
}

/* AI Message Controls */
.ai-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 5px;
}

.show-text-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #E8F5E9;
    color: #2E7D32;
    border: 1px solid #81C784;
    border-radius: 12px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.show-text-btn:hover {
    background: #C8E6C9;
}

.user-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-dots {
    color: #999;
    font-size: 14px;
}

/* Loading Animation */
.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(5, end) infinite;
}

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

/* Toggle Switch */
.toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    width: 48px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: var(--wendi-accent);
}

.toggle input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Text Input */
.text-input-wrapper {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

#text-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

#text-input:focus {
    border-color: var(--wendi-accent);
}

.btn-send {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-send:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

/* Recording Controls */
.recording-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.btn-record {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 30px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #FF5722, #E64A19);
    color: white;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.3);
}

.btn-record:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 87, 34, 0.4);
}

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

.btn-record.recording {
    background: #f44336;
    animation: recording-pulse 1s infinite;
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4); }
    50% { box-shadow: 0 6px 20px rgba(244, 67, 54, 0.6); }
}

.record-icon {
    font-size: 18px;
}

/* Recording Indicator */
.recording-indicator {
    display: none;
    align-items: center;
    gap: 8px;
    color: #f44336;
    font-size: 13px;
}

.recording-indicator.active {
    display: flex;
}

.wave {
    width: 4px;
    height: 16px;
    background: #f44336;
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.wave:nth-child(2) { animation-delay: 0.1s; }
.wave:nth-child(3) { animation-delay: 0.2s; }

@keyframes wave {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

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

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

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

/* Error Message */
.error-message {
    background: #FFEBEE;
    color: #C62828;
    padding: 10px 15px;
    border-radius: 8px;
    margin: 10px 0;
    font-size: 13px;
}

/* Scrollbar */
.chat-container::-webkit-scrollbar {
    width: 6px;
}

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

.chat-container::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

.chat-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        max-width: 100%;
    }

    .chat-container {
        height: calc(100vh - 260px);
    }

    .content {
        max-width: 80%;
    }

    .header h1 {
        font-size: 22px;
    }

    .input-area {
        max-width: 100%;
    }
}
