/* 军事科技 AI配音系统 - 样式表 */

:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --bg-card: #1e1e2a;
    --bg-card-hover: #252535;
    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --border-color: #27272a;
    --border-hover: #3f3f46;
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;
    --emotion-happy: #fbbf24;
    --emotion-sad: #60a5fa;
    --emotion-excited: #f97316;
    --emotion-surprised: #a855f7;
    --emotion-fearful: #ec4899;
    --emotion-disgusted: #14b8a6;
    --minimax-color: #00d4aa;
    --cosyvoice-color: #ff6b6b;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --transition-fast: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 16px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.logo { display: flex; align-items: center; gap: 16px; }
.logo-icon { width: 36px; height: 36px; color: var(--accent-primary); }
.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.logo-sub { font-size: 0.875rem; opacity: 0.8; margin-left: 8px; }

.engine-badge {
    padding: 8px 16px;
    background: var(--accent-gradient);
    color: white;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 16px;
    flex: 1;
}

.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.panel-header h2 { font-size: 1rem; font-weight: 600; }
.char-count { font-size: 0.75rem; color: var(--text-muted); }

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    flex-wrap: wrap;
}
.toolbar-label { font-size: 0.85rem; color: var(--text-secondary); }
.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

#engine-select {
    padding: 10px 36px 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: #ffffff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition-fast);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    min-width: 140px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}
#engine-select:hover {
    border-color: var(--border-hover);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
#engine-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}
#engine-select option { background: #1a1a25; color: #ffffff; }

#emotion-global {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
}

#emotion-per-sentence {
    color: #71717a;
    padding: 8px;
    font-size: 0.85rem;
}

.emotion-btn {
    width: 32px; height: 32px;
    font-size: 1.1rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex; align-items: center; justify-content: center;
}
.emotion-btn:hover { transform: scale(1.15); border-color: var(--text-muted); }
.emotion-btn.active { border-color: var(--accent-primary); background: rgba(99, 102, 241, 0.2); }

.editor-wrapper {
    flex: 1;
    position: relative;
    margin-bottom: 16px;
    min-height: 300px;
}

.editor {
    width: 100%; height: 100%; min-height: 300px;
    padding: 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.8;
    outline: none;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.editor:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2); }

.editor-placeholder {
    position: absolute; top: 16px; left: 16px;
    color: var(--text-muted); font-size: 0.95rem;
    line-height: 1.6; pointer-events: none; display: none;
}
.editor:empty + .editor-placeholder, .editor.is-empty .editor-placeholder { display: block; }
.editor-placeholder .hint { font-size: 0.8rem; opacity: 0.7; }

.emotion-tag {
    display: inline; padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem; font-weight: 600;
    vertical-align: middle; margin: 0 2px;
}
.emotion-tag[data-emotion="happy"] { background: rgba(251,191,36,0.2); color: var(--emotion-happy); }
.emotion-tag[data-emotion="sad"] { background: rgba(96,165,250,0.2); color: var(--emotion-sad); }
.emotion-tag[data-emotion="excited"] { background: rgba(249,115,22,0.2); color: var(--emotion-excited); }
.emotion-tag[data-emotion="surprised"] { background: rgba(168,85,247,0.2); color: var(--emotion-surprised); }
.emotion-tag[data-emotion="fearful"] { background: rgba(236,72,153,0.2); color: var(--emotion-fearful); }
.emotion-tag[data-emotion="disgusted"] { background: rgba(20,184,166,0.2); color: var(--emotion-disgusted); }

.param-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.param-group { display: flex; flex-direction: column; gap: 4px; }
.param-group label { font-size: 0.8rem; color: var(--text-secondary); }
.param-group input[type="range"] {
    width: 100%; height: 6px;
    background: var(--bg-card);
    border-radius: var(--radius-full);
    outline: none; -webkit-appearance: none;
}
.param-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px;
    background: var(--accent-primary); border-radius: 50%; cursor: pointer;
}
.param-value { font-size: 0.85rem; font-weight: 600; text-align: center; }

.action-buttons { display: flex; gap: 16px; margin-top: auto; }
.btn {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none; border-radius: var(--radius-md);
    font-size: 0.95rem; font-weight: 600;
    cursor: pointer; transition: var(--transition-fast);
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--accent-gradient); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(99,102,241,0.4); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--bg-card); color: var(--text-primary); }

.audio-display {
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 150px; margin-bottom: 16px;
}
.audio-display.has-audio { border-style: solid; border-color: var(--accent-primary); }
.audio-placeholder svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 12px; }
.audio-placeholder p { color: var(--text-muted); font-size: 0.85rem; }

.audio-controls {
    display: flex; align-items: center; gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.control-btn {
    width: 40px; height: 40px;
    background: var(--bg-card); border: none; border-radius: 50%;
    color: var(--text-primary); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition-fast);
}
.control-btn:hover { background: var(--accent-primary); }
.control-btn svg { width: 16px; height: 16px; }
.play-btn { width: 48px; height: 48px; background: var(--accent-gradient); }
.play-btn:hover { transform: scale(1.1); }
.progress-bar { flex: 1; height: 4px; background: var(--bg-card); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent-gradient); width: 0%; transition: width 0.1s linear; }
.time-display { font-size: 0.75rem; color: var(--text-muted); min-width: 80px; text-align: center; }
.download-btn:hover { background: var(--success); }

.audio-info {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 16px;
}
.info-row {
    display: flex; justify-content: space-between;
    padding: 4px 0;
    font-size: 0.85rem;
}
.info-row:not(:last-child) { border-bottom: 1px solid var(--border-color); }
.info-label { color: var(--text-muted); }
.info-value { color: var(--text-primary); font-weight: 500; }

.history-section h3 {
    font-size: 0.9rem; font-weight: 600;
    margin-bottom: 12px; color: var(--text-secondary);
}
.history-list { flex: 1; overflow-y: auto; max-height: 180px; }
.history-empty { text-align: center; padding: 16px; color: var(--text-muted); font-size: 0.85rem; }
.history-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.history-item:hover { background: var(--bg-card-hover); }
.history-item svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.history-item span { flex: 1; font-size: 0.8rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.loading-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(10,10,15,0.9);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    z-index: 1000;
}
.loading-spinner { width: 60px; height: 60px; margin-bottom: 16px; }
.loading-spinner svg { width: 100%; height: 100%; animation: spin 1s linear infinite; }
.loading-spinner circle { stroke: var(--accent-primary); stroke-dasharray: 90,150; stroke-linecap: round; }
@keyframes spin { 100% { transform: rotate(360deg); } }
#loadingText { color: var(--text-secondary); font-size: 1rem; }

.toast {
    position: fixed; bottom: 32px; left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card); border: 1px solid var(--border-color);
    border-radius: var(--radius-md); padding: 12px 24px;
    box-shadow: var(--shadow-md); opacity: 0;
    transition: all 0.3s ease; z-index: 1001;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }

@media (max-width: 1024px) {
    .main-content { grid-template-columns: 1fr; }
    .panel-right { display: none; }
}
@media (max-width: 768px) {
    .toolbar { flex-direction: column; gap: 12px; }
    .param-controls { grid-template-columns: 1fr; }
}

/* ========== 登录页 ========== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1f35 100%);
}

.auth-card {
    background: #1e2438;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    color: #fff;
    font-size: 24px;
    margin-top: 12px;
}

.auth-header h1 span {
    color: #00d4aa;
}

.auth-logo {
    width: 48px;
    height: 48px;
    color: #00d4aa;
}

.auth-form h2 {
    color: #ccc;
    font-size: 18px;
    margin-bottom: 20px;
    text-align: center;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    color: #999;
    font-size: 13px;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    background: #151929;
    border: 1px solid #333;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: #00d4aa;
}

.btn-full {
    width: 100%;
    margin-top: 10px;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    color: #999;
    font-size: 13px;
}

.auth-switch a {
    color: #00d4aa;
    text-decoration: none;
}

.auth-error {
    color: #ff6b6b;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    min-height: 20px;
}

/* ========== 用户信息 ========== */
.user-info {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: #ccc;
    font-size: 13px;
    margin-left: 12px;
}

.admin-link, .logout-link {
    color: #00d4aa;
    text-decoration: none;
    font-size: 12px;
}

.logout-link {
    color: #999;
}

.admin-link:hover, .logout-link:hover {
    text-decoration: underline;
}

/* ========== 管理后台 ========== */
.admin-container {
    min-height: 100vh;
    background: #0d1117;
    color: #e6e6e6;
    padding: 20px 30px;
}

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

.admin-header h1 {
    font-size: 22px;
    color: #fff;
}

.admin-nav {
    display: flex;
    gap: 10px;
}

.admin-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid #2a2f3f;
}

.tab-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn.active {
    color: #00d4aa;
    border-bottom-color: #00d4aa;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.panel-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.panel-toolbar h2 {
    font-size: 18px;
    color: #fff;
}

.invite-create {
    display: flex;
    gap: 10px;
}

.invite-create input {
    padding: 8px 12px;
    background: #151929;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 14px;
    outline: none;
}

.invite-code {
    background: #00d4aa22;
    color: #00d4aa;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 14px;
    letter-spacing: 1px;
    user-select: all;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th {
    background: #1a1f35;
    color: #999;
    padding: 10px 12px;
    text-align: left;
    font-weight: normal;
    white-space: nowrap;
}

.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #1e2438;
    vertical-align: top;
}

.admin-table tr:hover td {
    background: #151929;
}

.text-cell {
    max-width: 400px;
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 12px;
    color: #ccc;
    line-height: 1.5;
}

.nowrap {
    white-space: nowrap;
}

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.badge-active {
    background: #00d4aa22;
    color: #00d4aa;
}

.badge-used {
    background: #ff6b6b22;
    color: #ff6b6b;
}

.btn-sm {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #fff;
    background: #333;
}

.btn-sm.btn-primary {
    background: #00d4aa;
    color: #000;
}

.btn-sm.btn-danger {
    background: #ff6b6b;
}

.log-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.log-filters select,
.log-filters input[type="date"] {
    padding: 6px 10px;
    background: #151929;
    border: 1px solid #333;
    border-radius: 6px;
    color: #fff;
    font-size: 13px;
    outline: none;
}

.pagination {
    margin-top: 16px;
    display: flex;
    gap: 4px;
}

.stats-summary {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: #1a1f35;
    border-radius: 12px;
    padding: 20px 30px;
    text-align: center;
    flex: 1;
}

.stat-card h3 {
    font-size: 32px;
    color: #00d4aa;
    margin: 0;
}

.stat-card p {
    color: #999;
    margin: 8px 0 0;
    font-size: 13px;
}