/* 语音输入法 - 现代化界面样式 */

/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.6;
    color: #333;
}

/* 页面容器 */
.page {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 登录页面样式 ===== */
.login-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    max-width: 400px;
    margin: 0 auto;
}

.login-container h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #4a5568;
}

.subtitle {
    color: #718096;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.login-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #4a5568;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.login-note {
    text-align: left;
    color: #718096;
    font-size: 0.9em;
    line-height: 1.5;
}

.login-note p {
    margin-bottom: 8px;
}

/* ===== 主页面样式 ===== */
.main-container {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    min-height: 70vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.header h1 {
    font-size: 2em;
    color: #4a5568;
}

/* 文本区域 */
.text-area-container {
    position: relative;
    margin-bottom: 30px;
}

#textArea {
    width: 100%;
    min-height: 200px;
    padding: 20px;
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
    background: #f8fafc;
    transition: all 0.3s ease;
}

#textArea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.text-area-label {
    position: absolute;
    top: -10px;
    right: 15px;
    background: white;
    padding: 5px 10px;
    font-size: 12px;
    color: #718096;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 控制面板 */
.control-panel {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

/* 按钮样式 */
.btn {
    position: relative;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    overflow: hidden;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #718096 0%, #4a5568 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(113, 128, 150, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(113, 128, 150, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(72, 187, 120, 0.4);
}

.btn-record {
    grid-column: span 1;
    transition: all 0.3s ease;
    /* iOS Safari 兼容性 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* 准备状态 - 橙色 */
.btn-record.ready {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(237, 137, 54, 0.3);
    border: 2px solid transparent;
}

.btn-record.ready:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(237, 137, 54, 0.4);
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
}

/* 录音状态 - 红色，明显不同 */
.btn-record.recording {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
    color: white;
    box-shadow: 0 4px 20px rgba(229, 62, 62, 0.5);
    border: 2px solid #fed7d7;
    animation: recordingPulse 1.5s infinite;
    transform: scale(1.05);
}

.btn-record.recording:hover {
    background: linear-gradient(135deg, #fc8181 0%, #e53e3e 100%);
    box-shadow: 0 6px 25px rgba(229, 62, 62, 0.6);
}

/* 处理状态 - 蓝色 */
.btn-record.processing {
    background: linear-gradient(135deg, #3182ce 0%, #2b6cb0 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(49, 130, 206, 0.4);
    border: 2px solid #bee3f8;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    min-height: auto;
}

.record-icon {
    margin-right: 8px;
    font-size: 1.2em;
}

/* 加载动画 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

.success-text {
    color: #48bb78;
    font-weight: 600;
}

/* 状态指示器 */
.status-indicator {
    text-align: center;
    padding: 10px;
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 8px;
    color: #2f855a;
    font-size: 14px;
    font-weight: 500;
}

.status-indicator.processing {
    background: #ebf8ff;
    border-color: #90cdf4;
    color: #2b6cb0;
}

.status-indicator.error {
    background: #fed7d7;
    border-color: #feb2b2;
    color: #c53030;
}

/* 录音指示器 */
.recording-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.recording-animation {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.pulse {
    width: 20px;
    height: 20px;
    background: #e53e3e;
    border-radius: 50%;
    margin-right: 10px;
    animation: pulse 1.5s infinite;
}

.recording-text {
    font-size: 18px;
    font-weight: 600;
}

.recording-time {
    font-size: 24px;
    font-weight: bold;
    color: #fed7d7;
}

/* 提示消息 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    max-width: 300px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
}

.toast.error {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

.toast.info {
    background: linear-gradient(135deg, #3182ce 0%, #2b6cb0 100%);
}

/* 动画 */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.7; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes recordingPulse {
    0% { 
        transform: scale(1.05);
        box-shadow: 0 4px 20px rgba(229, 62, 62, 0.5);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 6px 30px rgba(229, 62, 62, 0.7);
    }
    100% { 
        transform: scale(1.05);
        box-shadow: 0 4px 20px rgba(229, 62, 62, 0.5);
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .page {
        padding: 15px;
    }
    
    .main-container,
    .login-container {
        padding: 20px;
    }
    
    .control-panel {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .btn-record {
        grid-column: span 2;
    }
    
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .header h1 {
        font-size: 1.5em;
    }
    
    #textArea {
        min-height: 150px;
        font-size: 14px;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .toast {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ===== 词典管理样式 ===== */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

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

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8fafc;
}

.modal-header h2 {
    margin: 0;
    color: #2d3748;
    font-size: 1.5em;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #a0aec0;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #e2e8f0;
    color: #4a5568;
}

.modal-body {
    padding: 25px;
    flex: 1;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
}

/* 添加词汇区域 */
.add-word-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.input-group input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 词汇列表区域 */
.words-section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h3 {
    margin: 0;
    color: #2d3748;
    font-size: 1.2em;
}

.words-container {
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 15px;
    min-height: 200px;
    max-height: 250px;
    overflow-y: auto;
    background: #f8fafc;
}

.word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.word-item:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.word-text {
    flex: 1;
    color: #2d3748;
    font-size: 14px;
}

.delete-word-btn {
    background: #fed7d7;
    color: #e53e3e;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.delete-word-btn:hover {
    background: #feb2b2;
}

.loading-placeholder, .empty-placeholder {
    text-align: center;
    color: #a0aec0;
    padding: 40px 20px;
    font-style: italic;
}

/* 批量操作区域 */
.batch-section h3 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 1.2em;
}

.textarea-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s ease;
}

.textarea-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.batch-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.dict-info {
    text-align: center;
}

.dict-info p {
    margin: 5px 0;
    color: #718096;
    font-size: 14px;
}

/* 词典管理响应式 */
@media (max-width: 768px) {
    .header-buttons {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .batch-buttons {
        flex-direction: column;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
