* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    color: #333;
}

/* ==================== 顶栏 ==================== */

.top-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 14px 24px;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}
.top-bar-inner {
    display: flex;
    align-items: baseline;
    gap: 16px;
}
.top-bar h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
}
.top-bar-desc {
    font-size: 13px;
    opacity: 0.8;
}

/* ==================== 左右布局 ==================== */

.layout {
    display: flex;
    gap: 0;
    height: calc(100vh - 56px);
    overflow: hidden;
}

.panel-left {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px;
    overflow-y: auto;
    /*background: #f6f7fb;*/
    border-right: 1px solid #e8e8ef;
}

.panel-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 16px;
    overflow: hidden;
}

/* ==================== 卡片 ==================== */

.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
    padding: 18px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-title .icon {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}
.icon-config { background: #667eea; color: #fff; }
.icon-audio  { background: #f5576c; color: #fff; }
.icon-log    { background: #1e1e2e; color: #cdd6f4; }

/* ==================== 表单 ==================== */

.form-group {
    margin-bottom: 12px;
}
.form-group:last-child {
    margin-bottom: 0;
}
.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #888;
    margin-bottom: 4px;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fafafa;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
    background: #fff;
}

/* ==================== 输入模式切换 ==================== */

.input-mode-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 14px;
    background: #f0f0f5;
    border-radius: 8px;
    padding: 3px;
}
.input-mode-tab {
    flex: 1;
    padding: 7px 0;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    background: transparent;
    color: #666;
    transition: all 0.2s;
    text-align: center;
}
.input-mode-tab.active {
    background: #fff;
    color: #667eea;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ==================== 麦克风区域 ==================== */

.mic-area {
    display: block;
    margin-bottom: 4px;
}
.mic-area.hidden {
    display: none;
}

/* 状态指示 */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
}
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
}
.status-dot.connected { background: #52c41a; }
.status-dot.recording {
    background: #f5576c;
    animation: pulse 1.2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(245, 87, 108, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 6px rgba(245, 87, 108, 0); }
}
.status-text {
    font-size: 12px;
    color: #888;
    font-weight: 500;
}

/* 音量条 */
.volume-bar-wrap {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}
.volume-bar {
    height: 100%;
    background: linear-gradient(90deg, #52c41a, #faad14, #f5576c);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s;
}

/* ==================== 文件上传 ==================== */

.upload-area {
    display: none;
    border: 2px dashed #d0d0e0;
    border-radius: 10px;
    padding: 24px 16px;
    text-align: center;
    margin-bottom: 10px;
    transition: all 0.2s;
    cursor: pointer;
}
.upload-area.visible {
    display: block;
}
.upload-area:hover,
.upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.04);
}
.upload-area .upload-icon {
    font-size: 28px;
    color: #667eea;
    margin-bottom: 6px;
}
.upload-area .upload-text {
    font-size: 12px;
    color: #888;
    line-height: 1.6;
}
.upload-area .upload-text strong {
    color: #667eea;
}
.upload-area .file-info {
    margin-top: 10px;
    font-size: 12px;
    color: #52c41a;
    font-weight: 500;
}
.upload-area input[type="file"] {
    display: none;
}

/* ==================== 操作按钮 ==================== */

.controls {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.35);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 5px 16px rgba(102, 126, 234, 0.5);
    transform: translateY(-1px);
}
.btn-danger {
    background: linear-gradient(135deg, #f5576c, #ff6b6b);
    color: #fff;
    box-shadow: 0 3px 10px rgba(245, 87, 108, 0.35);
}
.btn-danger:hover:not(:disabled) {
    box-shadow: 0 5px 16px rgba(245, 87, 108, 0.5);
    transform: translateY(-1px);
}

/* ==================== 字幕区域 ==================== */

.card-subtitle {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.panel-header {
    font-size: 13px;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.subtitle-content {
    flex: 1;
    overflow-y: auto;
    background: #f7f8fc;
    border-radius: 10px;
    padding: 16px;
    min-height: 200px;
}
.subtitle-content::-webkit-scrollbar {
    width: 5px;
}
.subtitle-content::-webkit-scrollbar-thumb {
    background: #d0d0e0;
    border-radius: 3px;
}

.subtitle-empty {
    color: #aaa;
    font-size: 14px;
    text-align: center;
    padding: 60px 0;
}

.subtitle-item {
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    animation: fadeIn 0.3s ease;
    transition: background 0.2s;
}
.subtitle-item.current {
    background: #f0f2ff;
    border-left: 3px solid #667eea;
}
.subtitle-item.final {
    background: #fff;
    border-left: 3px solid transparent;
}
.subtitle-source {
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    font-weight: 500;
}
.subtitle-target {
    font-size: 13px;
    line-height: 1.6;
    color: #667eea;
    margin-top: 3px;
    padding-top: 3px;
    border-top: 1px dashed rgba(102, 126, 234, 0.2);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==================== 悬浮字幕按钮 ==================== */

.float-subtitle-btn {
    padding: 5px 14px;
    border: 1.5px solid #667eea;
    border-radius: 6px;
    background: transparent;
    color: #667eea;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: 0;
}
.float-subtitle-btn:hover,
.float-subtitle-btn.active {
    background: #667eea;
    color: #fff;
}

/* ==================== 悬浮字幕窗口 ==================== */

.floating-subtitle {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    max-width: 90vw;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 20px 28px;
    z-index: 10000;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3);
    cursor: move;
    user-select: none;
}
.floating-subtitle.visible {
    display: block;
}
.floating-subtitle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.floating-subtitle-title {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.floating-subtitle-close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.floating-subtitle-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
.floating-subtitle-content {
    max-height: 200px;
    overflow-y: auto;
}
.floating-subtitle-content::-webkit-scrollbar {
    width: 4px;
}
.floating-subtitle-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}
.float-source {
    font-size: 18px;
    line-height: 1.6;
    color: #fff;
    font-weight: 500;
}
.float-target {
    font-size: 16px;
    line-height: 1.6;
    color: rgba(102, 180, 255, 0.95);
    margin-top: 6px;
}
.float-item {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.float-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

/* ==================== 日志区 ==================== */

.card-log {
    flex-shrink: 0;
    margin-bottom: 0;
}
.log-panel {
    background: #1e1e2e;
    border-radius: 8px;
    padding: 12px 14px;
    height: 180px;
    overflow-y: auto;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 11px;
    line-height: 1.7;
    color: #cdd6f4;
}
.log-panel::-webkit-scrollbar {
    width: 4px;
}
.log-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
.log-item { margin-bottom: 1px; }
.log-item .time { color: #6c7086; }
.log-item.info .msg { color: #89b4fa; }
.log-item.success .msg { color: #a6e3a1; }
.log-item.error .msg { color: #f38ba8; }
.log-item.warn .msg { color: #f9e2af; }

/* ==================== 响应式 ==================== */

@media (max-width: 860px) {
    .layout {
        flex-direction: column;
        padding: 12px;
    }
    .panel-left {
        width: 100%;
    }
    .card-subtitle {
        min-height: 300px;
    }
    .floating-subtitle {
        width: 95vw;
        bottom: 20px;
    }
}
