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

:root {
    --primary-color: #4a90e2;
    --success-color: #52c41a;
    --danger-color: #ff4d4f;
    --warning-color: #faad14;
    --text-color: #333;
    --text-secondary: #666;
    --bg-color: #f5f5f5;
    --card-bg: #ffffff;
    --border-color: #e8e8e8;
    --header-height: 60px;
    --footer-height: 100px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    word-wrap: break-word;
    overflow-x: hidden;
}

/* 按钮样式 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #357abd;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-secondary {
    background-color: #fff;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: #f8fbff;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background-color: #d9363e;
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background-color: #389e0d;
    transform: translateY(-1px);
}

.btn-text {
    background: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 14px;
}

.btn-text:hover {
    color: var(--primary-color);
    background-color: rgba(74, 144, 226, 0.1);
}

.btn-icon {
    background: none;
    border: none;
    font-size: 20px;
    padding: 10px;
    color: var(--text-color);
    border-radius: 8px;
}

.btn-icon:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
}

/* 录音按钮 */
.recorder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.btn-record {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color) 0%, #357abd 100%);
    color: white;
    font-size: 32px;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.4);
    position: relative;
}

.btn-record:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.5);
}

.btn-record:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-record.recording {
    background: linear-gradient(135deg, var(--danger-color) 0%, #d9363e 100%);
    box-shadow: 0 4px 15px rgba(255, 77, 79, 0.4);
    animation: recording-pulse 1.5s infinite;
}

.btn-record.recording:hover {
    box-shadow: 0 6px 20px rgba(255, 77, 79, 0.5);
}

@keyframes recording-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 rgba(255, 77, 79, 0.4);
    }
    50% { 
        box-shadow: 0 0 0 15px rgba(255, 77, 79, 0);
    }
}

.record-label {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.btn-record .record-icon {
    font-size: 32px;
}

/* 头部导航 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
}

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

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

.user-select {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background-color: var(--card-bg);
    color: var(--text-color);
    cursor: pointer;
}

.user-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.app-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
}

.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.current-date {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-color);
    padding: 8px 20px;
    background-color: var(--bg-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.current-date:hover {
    background-color: #e0e0e0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 主内容区域 */
.main-content {
    margin-top: var(--header-height);
    margin-bottom: var(--footer-height);
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
    padding: 20px;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* 录音区域 */
.audio-section {
    margin-bottom: 20px;
}

.audio-result {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.audio-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.audio-result-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
}

.transcript-text {
    width: 100%;
    min-height: 120px;
    max-height: 300px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    resize: vertical;
    margin-bottom: 16px;
    font-family: inherit;
    line-height: 1.6;
}

.transcript-text:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.audio-result-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 表格区域 */
.records-section {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.records-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.records-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.date-range-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-input {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.date-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.date-separator {
    color: var(--text-secondary);
    font-size: 14px;
}

.action-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.records-title {
    font-size: 20px;
    font-weight: 700;
}

.records-table-container {
    overflow-x: auto;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 100%;
}

.records-table th,
.records-table td {
    padding: 14px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    word-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.records-table-container {
    overflow-x: auto;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 100%;
}

.records-table th {
    background-color: #fafafa;
    font-weight: 600;
    color: var(--text-color);
    position: sticky;
    top: 0;
}

.records-table tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.records-table tbody tr:hover {
    background-color: #f8fbff;
}

.records-table .draft {
    background-color: #f6ffed;
}

.records-table .draft td {
    border-left: 4px solid var(--success-color);
}

.records-table .checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.records-table .keyword-tag {
    display: inline-block;
    padding: 4px 10px;
    background-color: #e6f7ff;
    color: #1890ff;
    border-radius: 12px;
    font-size: 12px;
    margin-right: 4px;
    margin-bottom: 4px;
    font-weight: 500;
}

.records-table .status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.records-table .status-draft {
    background-color: #f6ffed;
    color: #52c41a;
}

.records-table .status-committed {
    background-color: #f0f0f0;
    color: #666;
}

.records-table .benefit-badge {
    color: var(--success-color);
    font-size: 18px;
}

.no-records {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

/* 底部录音控制 */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: var(--footer-height);
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    gap: 20px;
}

.toggle-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    z-index: 1001;
}

.toggle-btn:hover {
    background-color: var(--border-color);
}

.toggle-btn.rotated {
    transform: rotate(90deg);
}

.recorder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.recording-buttons {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-circle:hover {
    transform: scale(1.05);
}

.audio-section-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    max-width: 600px;
}

.audio-section {
    flex: 1;
    transition: all 0.3s ease;
}

.recording-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--danger-color);
    font-weight: 600;
    font-size: 16px;
}

.recording-dot {
    width: 12px;
    height: 12px;
    background-color: var(--danger-color);
    border-radius: 50%;
    animation: blink 1s infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.recording-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 12px;
}

/* 弹窗 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 700;
}

.modal-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
}

/* 表单样式 */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group textarea {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
    width: 100%;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.login-info {
    margin-top: 24px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

/* 消息提示 */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 3000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background-color: var(--success-color);
}

.toast.error {
    background-color: var(--danger-color);
}

.toast.info {
    background-color: var(--primary-color);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }
    
    .app-title {
        font-size: 16px;
    }
    
    .current-date {
        font-size: 13px;
        padding: 6px 12px;
    }
    
    .main-content {
        padding: 12px;
    }
    
    .records-table {
        font-size: 12px;
    }
    
    .records-table th,
    .records-table td {
        padding: 10px 6px;
    }
    
    .btn-record {
        width: 70px;
        height: 70px;
        font-size: 28px;
    }
    
    .modal-content {
        max-width: 100%;
        border-radius: 0;
        max-height: 100vh;
    }
}

/* 深色模式 */
body.dark-mode {
    --text-color: #e8e8e8;
    --text-secondary: #b0b0b0;
    --bg-color: #1a1a1a;
    --card-bg: #2d2d2d;
    --border-color: #404040;
}

body.dark-mode .header {
    background-color: var(--card-bg);
    border-bottom-color: var(--border-color);
}

body.dark-mode .footer {
    background-color: var(--card-bg);
    border-top-color: var(--border-color);
}

body.dark-mode .current-date {
    background-color: #404040;
    color: var(--text-color);
}

body.dark-mode .current-date:hover {
    background-color: #505050;
}

body.dark-mode .records-table th {
    background-color: #404040;
    color: var(--text-color);
}

body.dark-mode .records-table tbody tr:hover {
    background-color: #404040;
}

body.dark-mode .records-table .draft {
    background-color: #1f2e1d;
}

body.dark-mode .btn-secondary {
    background-color: #404040;
    border-color: #505050;
    color: var(--text-color);
}

body.dark-mode .btn-text {
    color: var(--text-secondary);
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea,
body.dark-mode .transcript-text {
    background-color: #404040;
    border-color: #505050;
    color: var(--text-color);
}

body.dark-mode .records-table .keyword-tag {
    background-color: #1a3a4a;
    color: #40a9ff;
}

body.dark-mode .records-table .status-committed {
    background-color: #404040;
    color: var(--text-secondary);
}

body.dark-mode .records-table .status-draft {
    background-color: #1f2e1d;
}

body.dark-mode .audio-result,
body.dark-mode .records-section {
    background-color: var(--card-bg);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}