/* 德语字幕查看器样式 */

/* CSS变量定义 - 浅色模式 */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #000000;
    --text-secondary: #757575;
    --text-muted: #6c757d;
    --border-color: #e9ecef;
    --panel-bg: rgba(248, 249, 250, 0.95);
    --panel-border: rgba(233, 236, 239, 0.8);
    --highlight-color: #2196F3;
    --button-bg: #007bff;
    --button-hover: #0056b3;
    --status-success: #4CAF50;
    --status-error: #f44336;
    --status-warning: #ff9800;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #e0e0e0;
    --scrollbar-thumb-hover: #bdbdbd;
    --sentence-rotation: 0deg;
}

/* 黑暗模式变量 */
[data-theme="dark"] {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-muted: #888888;
    --border-color: #404040;
    --panel-bg: rgba(45, 45, 45, 0.95);
    --panel-border: rgba(64, 64, 64, 0.8);
    --highlight-color: #64b5f6;
    --button-bg: #1976d2;
    --button-hover: #1565c0;
    --status-success: #66bb6a;
    --status-error: #ef5350;
    --status-warning: #ffa726;
    --scrollbar-track: transparent;
    --scrollbar-thumb: #555555;
    --scrollbar-thumb-hover: #777777;
    --sentence-rotation: 0deg;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 确保body使用主滚动条 */
html, body {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: 'Georgia', 'Times New Roman', serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.58;
    margin: 0;
    padding: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 100%;
    margin: 0;
    min-height: 100vh;
    position: relative;
    background: var(--bg-primary);
    transition: background-color 0.3s ease;
}

/* 头部样式 - 在右侧面板内 */
.header {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.header h1 {
    font-size: 18px;
    margin-bottom: 8px;
    font-weight: 400;
    text-shadow: none;
    text-align: center;
}

.status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    transition: color 0.3s ease;
}

.status-connected {
    color: var(--status-success);
    font-weight: normal;
}

.status-disconnected {
    color: var(--status-error);
    font-weight: normal;
}

.status-playing {
    color: var(--status-success);
    font-weight: normal;
}

.status-paused {
    color: var(--status-warning);
    font-weight: normal;
}

/* 控制面板 - 右侧悬浮 */
.control-panel {
    position: fixed;
    top: 0;
    right: 10px; /* 稍微向内，避免遮挡滚动条 */
    width: 280px;
    height: calc(100vh - 30px); /* 为底部滚动条留出更多空间 */
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
    border-radius: 8px; /* 添加圆角，更美观 */
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* 控制面板隐藏状态 */
.control-panel.hidden {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
}

/* 隐藏按钮 */
.hide-panel-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    z-index: 1001;
    transition: all 0.2s ease;
}

.hide-panel-btn:hover {
    background: rgba(255, 255, 255, 1);
    color: #333;
    transform: scale(1.1);
}

/* 右上角控制按钮 */
.toggle-panel-btn {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 48px;
    height: 48px;
    background: var(--panel-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--panel-border);
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    z-index: 1002;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.toggle-panel-btn:hover {
    background: var(--button-bg);
    color: white;
    transform: scale(1.1);
}

/* 控制面板样式 */
.control-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

.control-section:last-child {
    border-bottom: none;
}

.control-section h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.control-btn {
    width: 100%;
    background: var(--button-bg);
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 10px;
    transition: background 0.2s;
}

.control-btn:hover {
    background: var(--button-hover);
}

.control-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.time-display {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-align: center;
    padding: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

input[type="range"] {
    width: 100%;
    margin: 10px 0;
}

#test-time-display {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    transition: color 0.3s ease;
}

/* 播放倍率控制样式 */
.playback-rate-control {
    margin: 10px 0;
}

.playback-rate-control label {
    display: block;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-weight: 500;
    transition: color 0.3s ease;
}

#playback-rate-display {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    display: block;
    margin-top: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: color 0.3s ease;
}

/* 宽度控制样式 */
.width-control {
    margin: 10px 0;
}

.width-control label {
    display: block;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-weight: 500;
    transition: color 0.3s ease;
}

#content-width-display {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    display: block;
    margin-top: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: color 0.3s ease;
}

/* 旋转控制样式 */
.rotation-control {
    margin: 10px 0;
}

.rotation-control label {
    display: block;
    font-size: 12px;
    color: var(--text-primary);
    margin-bottom: 5px;
    font-weight: 500;
    transition: color 0.3s ease;
}

#sentence-rotation-display {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    display: block;
    margin-top: 5px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    transition: color 0.3s ease;
}

/* 自动滚动设置样式 */
.auto-scroll-label {
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.auto-scroll-sub-option {
    margin-left: 20px;
    margin-bottom: 6px;
    opacity: 0.8;
}

.auto-scroll-sub-label {
    font-size: 13px;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

/* 滚动模式按钮样式 */
.scroll-mode-btn {
    margin-bottom: 8px;
    font-size: 13px;
    padding: 8px 12px;
    background: var(--highlight-color);
    transition: all 0.3s ease;
}

.scroll-mode-btn:hover {
    background: var(--button-hover);
    transform: translateY(-1px);
}

/* 滚动模式信息样式 */
.scroll-mode-info {
    margin-bottom: 8px;
    padding: 6px 10px;
    background: var(--bg-secondary);
    border-radius: 4px;
    border-left: 2px solid var(--highlight-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.scroll-mode-info small {
    color: var(--text-muted);
    font-size: 10px;
    line-height: 1.3;
    transition: color 0.3s ease;
}

.auto-scroll-info {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    border-left: 3px solid var(--highlight-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.auto-scroll-info small {
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.4;
    transition: color 0.3s ease;
}

/* 字幕容器 - 纯Telegraph风格，居中显示，使用主滚动条 */
.subtitle-container {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-primary);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: background-color 0.3s ease;
}

.subtitle-list {
    padding: 32px 40px;
    /* 移除为侧栏留出的空间，让字幕占满全屏 */
    padding-bottom: 100px; /* 底部留出更多空间，确保最后一个字幕可见 */
    width: var(--subtitle-width, 70%); /* 使用CSS变量控制宽度，默认70% */
  /*   max-width: 1200px; 最大宽度限制 */
   /*  min-width: 400px; 最小宽度限制 */
    margin: 0;
    font-size: 21px;
    line-height: 1.58;
    box-sizing: border-box;
}

/* 无数据状态 */
.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 50px 20px;
    transition: color 0.3s ease;
}

.no-data p {
    font-size: 1.2em;
    margin-bottom: 10px;
}

.hint {
    font-size: 1em;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

/* 字幕项样式 - 纯Telegraph风格 */
.subtitle-item {
    margin-bottom: 24px;
    padding: 0;
    background: transparent;
    border: none;
    cursor: text;
    transition: transform 0.3s ease;
    transform: rotate(var(--sentence-rotation));
    transform-origin: center left;
}

.subtitle-item:hover {
    background: transparent;
}

.subtitle-item.current {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 24px;
}

.subtitle-content {
    line-height: 1.58;
}

.german-text {
    font-size: 21px;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 8px;
    line-height: 1.58;
    font-family: 'Georgia', 'Times New Roman', serif;
    letter-spacing: 0.01em;
    transition: color 0.3s ease;
}

.chinese-text {
    font-size: 16px;
    color: var(--text-secondary);
    font-style: normal;
    font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    line-height: 1.58;
    margin-bottom: 0;
    transition: color 0.3s ease;
}

.chinese-text.hidden {
    display: none;
}

/* 高亮样式 - 使用字体颜色而不是背景色，与主题一致 */
.char-highlight {
    background: transparent;
    color: var(--highlight-color); /* 使用主题高亮颜色 */
    padding: 0;
    border-radius: 0;
    font-weight: inherit;
    transition: color 0.3s ease;
}

/* 已播放单词的高亮样式 - 使用主题高亮颜色 */
.word-played {
    background: transparent;
    color: var(--highlight-color); /* 使用主题高亮颜色 */
    padding: 0;
    border-radius: 0;
    font-weight: inherit;
    transition: color 0.3s ease;
    box-shadow: none;
    transform: none;
    animation: none;
}

/* 当前播放单词的高亮样式 - 使用主题高亮颜色 */
.word-current {
    background: transparent;
    color: var(--highlight-color); /* 使用主题高亮颜色 */
    padding: 0;
    border-radius: 0;
    font-weight: inherit;
    transition: color 0.3s ease;
    box-shadow: none;
    transform: none;
    animation: none;
}

/* 保留原有的word-highlight类以防兼容性问题，但设为透明 */
.word-highlight {
    background: transparent;
    color: inherit;
}

/* 底部状态栏 - 在右侧面板内 */
.footer {
    background: var(--bg-primary);
    padding: 15px 0;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    transition: color 0.3s ease;
}

/* 滚动条样式 - 极简，支持主题，使用主滚动条 */
body::-webkit-scrollbar {
    width: 8px;
}

body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

body::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .control-panel {
        width: 90%;
        max-width: 320px;
        right: 5%;
        top: 10px;
    }

    .toggle-panel-btn {
        width: 42px;
        height: 42px;
        font-size: 18px;
    }

    .subtitle-list {
        padding: 20px;
        width: 100%; /* 移动设备上使用全宽 */
        max-width: none;
        min-width: unset;
    }

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

    .status {
        flex-direction: column;
        gap: 6px;
    }

    .german-text {
        font-size: 16px;
    }

    .chinese-text {
        font-size: 14px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* VTT文件加载功能样式 */
.vtt-loader {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vtt-load-btn {
    background: var(--status-success);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.vtt-load-btn:hover {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.vtt-status {
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
}

.vtt-status.status-ready {
    background: rgba(76, 175, 80, 0.1);
    color: var(--status-success);
    border: 1px solid var(--status-success);
}

.vtt-status.status-loading {
    background: rgba(255, 152, 0, 0.1);
    color: var(--status-warning);
    border: 1px solid var(--status-warning);
}

.vtt-status.status-success {
    background: rgba(76, 175, 80, 0.1);
    color: var(--status-success);
    border: 1px solid var(--status-success);
}

.vtt-status.status-error {
    background: rgba(244, 67, 54, 0.1);
    color: var(--status-error);
    border: 1px solid var(--status-error);
}

/* 默认状态 */
.vtt-status:not(.status-ready):not(.status-loading):not(.status-success):not(.status-error) {
    background: var(--bg-secondary);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}
