/* 主样式文件 - 确保所有必要的样式都存在 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 页面整体背景：恢复为黑色，保证超宽屏两侧为黑色底色（历史视觉行为）。
   同时设定全局文字颜色为浅色以提高对比度。 */
body {
    background: #000; /* 两侧空白区域底色为黑色 */
    color: #e6eef8;
    -webkit-font-smoothing: antialiased;
}

/* 页面主容器最大宽度（恢复历史布局限制，避免在超大屏造成中间大片空白）
   在非全屏模式下限制最大宽度为 1800px 并水平居中；宽度仍为 100% 以便在窄屏时自适应。
   fullscreen 模式和 mobile 覆盖规则会在需要时覆写此值。 */
.container {
    width: 100%;
    max-width: 1700px;
    margin: 0 auto;
    padding-left: 16px;
    padding-right: 16px;
}

.tab-buttons {
    display: flex;
    gap: 6px;
    align-items: flex-start; /* 顶部对齐，保持选中与未选中标签同一基线 */
    padding-bottom: 0; /* 去掉额外底部间距，确保 tab 与面板紧靠 */
    margin-bottom: 0;
}
.tab-button {
    /* 经典标签页：保持统一高度与基线，未选中标签底部透明，选中标签覆盖面板顶部 */
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 140px; /* 增大最小宽度以避免长文本被截断 */
    height: 34px; /* 统一高度，稍微增加以适配较大文字 */
    padding: 0 16px;
    background: transparent;
    color: #fff;
    border-top: 1px solid #2b2b2b;
    border-left: 1px solid #2b2b2b;
    border-right: 1px solid #2b2b2b;
    border-bottom: 1px solid transparent; /* 未选中时底部透明以避免重复边框 */
    border-radius: 6px 6px 0 0; /* 顶部圆角，底部直角以便与面板无缝对接 */
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap; /* 保持单行显示，增加 min-width 以容纳标签文本 */
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background 0.12s, color 0.12s, border-color 0.12s, margin-bottom 0.08s;
}

/* 覆盖全局 button 宽度，确保 tab-button 能根据 padding/min-width 自适应宽度 */
.tab-button {
    width: auto !important;
}
.tab-button:hover {
    background: rgba(255,255,255,0.03);
}
.tab-button.active {
    /* 选中标签：使用醒目的橙色背景并深色文字，使标签突出 */
    background: #ff6b00; /* 恢复为橙色高亮 */
    color: #1a1a1a; /* 深色文字以提高可读性 */
    border-top-color: #2b2b2b;
    border-left-color: #2b2b2b;
    border-right-color: #2b2b2b;
    border-bottom-color: #2b2b2b; /* 用深色底边作为面板顶部视觉 */
    margin-bottom: 0; /* 保持与未选中标签同一基线 */
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    z-index: 4; /* 抬高以覆盖面板顶部的圆角处理 */
}

/* 强制确保标签底部为直角，避免被全局样式覆盖 */
button.tab-button, .tab-button {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

/* 面板整体边框，使 Tab 看起来是面板的一部分 */
.tab-panels {
    /* 移除面板顶部边框，让选中标签的底边成为视觉上的顶部边框，从而实现无缝衔接 */
    border: 1px solid #2b2b2b;
    border-top: none;
    border-top-left-radius: 0; /* 面板顶部圆角由选中标签处理 */
    border-top-right-radius: 0;
    border-radius: 6px;
    padding: 8px 10px 10px 10px; /* 适当增加上内边距，避免内容紧贴 */
    background: #151515;
    position: relative;
    z-index: 1;
    margin-top: 0;
}
.tab-panel {
    padding: 6px 2px;
}

/* 明确定义隐藏类，确保 JS 的切换能生效 */
.hidden {
    display: none !important;
    visibility: hidden !important;
}

/* 当活动 Tab 覆盖面板顶部时，确保面板顶部圆角仍然可见（被 tab 覆盖部分由 tab 本身处理） */
.tab-panels {
    overflow: visible;
}
.nav-links {
    margin-top: 15px;
}

.nav-link {
    display: inline-block;
    margin: 0 10px;
    padding: 8px 15px;
    background: #2d2d2d;
    color: #ff6b00;
    text-decoration: none;
    border-radius: 5px;
    transition: background 0.3s;
}

.nav-link:hover {
    background: #3d3d3d;
}

.upload-section {
    background: #2d2d2d;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.upload-group {
    margin-bottom: 15px;
}

.upload-group label {
    display: block;
    margin-bottom: 5px;
    color: #ccc;
}

.upload-group input {
    width: 100%;
    padding: 10px;
    background: #3d3d3d;
    border: 1px solid #555;
    border-radius: 5px;
    color: #fff;
}

.upload-group button {
    width: 100%;
    padding: 10px;
    background: #ff6b00;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 5px;
}

.upload-group button:hover {
    background: #e55a00;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0; /* 普通模式下与下方控件紧贴，避免不必要间隙 */
    display: block;
    /* 保持 16:9 比例以适配常见 1080p/720p 视频，避免上下黑边浪费屏幕空间 */
    aspect-ratio: 16 / 9;
    /* 限制高度，避免在超高视口下占用过多垂直空间（普通模式更紧凑） */
    max-height: 60vh;
    width: 100%;
}

#videoPlayer {
    display: none;
}

#videoCanvas {
    width: 100%;
    height: 100%;
    max-height: 100%;
    background: #000;
    display: block;
}

.controls {
    background: #2d2d2d;
    /* 减小垂直内边距并去掉外部 margin，使 controls 与 video canvas 紧贴 */
    padding: 6px 12px;
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
    /* 取消依赖负 margin 的微调，避免在宽度变化时产生意外间隙。若需要微调，请使用 padding 或固定高度。 */
    margin: 0;
    transition: opacity 0.18s;
}

.controls-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.controls-right {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

/* 音量滑块样式 */
#volumeSlider {
    accent-color: #ff6b00;
    height: 4px;
    margin: 0 4px;
    vertical-align: middle;
}

#muteBtn {
    font-size: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0 4px;
}
#muteBtn:focus {
    outline: 2px solid #ff6b00;
}


.progress-container {
    flex: 1;
    margin: 0 15px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: #3d3d3d;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: #ff6b00;
    border-radius: 3px;
    width: 0%;
    transition: width 0.1s;
}

.progress-time {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #ccc;
    margin-top: 5px;
}

button {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.3s;
}

button:hover {
    background: rgba(255, 107, 0, 0.2);
}

.current-time {
    font-family: monospace;
    background: #3d3d3d;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
}

.file-info {
    background: #2d2d2d;
    padding: 15px;
    border-radius: 10px;
    font-size: 14px;
}

.file-info h3 {
    color: #ff6b00;
    margin-bottom: 10px;
}

.status {
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
}

.status.success {
    background: #2d5a2d;
    color: #90ee90;
}

.status.error {
    background: #5a2d2d;
    color: #ff6b6b;
}

.status.info {
    background: #2d3a5a;
    color: #90c0ee;
}

.subtitle-preview {
    background: #2d2d2d;
    /* 去掉与 controls 之间的外部间距，内边距稍作压缩以提升可视行数 */
    padding: 12px;
    border-radius: 8px;
     /* 保持 subtitle-preview 与 controls 的间距由 JS/微调决定，
        默认情况下不使用负 margin，避免在部分浏览器触发重排问题。 */
     margin-top: 0;
    font-size: 14px;
}

.subtitle-preview h3 {
    color: #ff6b00;
    margin-bottom: 10px;
}

.subtitle-preview-content {
    min-height: 60px;
    padding: 10px;
    background: #3d3d3d;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
}

.url-input-container {
    display: flex;
    gap: 10px;
}

.url-input-container input {
    flex: 1;
}

.url-input-container button {
    width: auto;
    padding: 0 15px;
}

.platform-info {
    font-size: 12px;
    color: #aaa;
    margin-top: 5px;
}

/* 角色按钮样式：无背景的非当前角色 + 带彩色小点，当前角色使用粗边框高亮 */
.role-button-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.role-style-group {
    margin-bottom: 10px;
}
.role-style-header {
    font-size: 12px;
    color: #9fc7ff;
    margin: 6px 0 6px 0;
}

.role-item {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.role-current-text {
    font-size: 12px;
    color: #cfd8e8;
    max-width: 220px;
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
    opacity: 0.95;
}
.role-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.06);
    background: transparent; /* 非当前角色无背景 */
    cursor: pointer;
    font-size: 14px;
    color: inherit; /* 文本颜色由 JS 或父容器决定 */
    white-space: nowrap;
    min-width: 0; /* 允许根据文字自适应 */
    transition: border-color 0.12s, box-shadow 0.12s, background 0.12s, color 0.12s;
}
.role-button {
    /* 覆盖全局 button 宽度/高度限制，允许根据内容自适应 */
    width: auto !important;
    height: auto !important;
    padding: 6px 10px !important;
}
.role-button:hover {
    box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.role-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex: 0 0 auto;
    box-shadow: 0 1px 0 rgba(0,0,0,0.3) inset;
}
.role-label {
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 强制角色名称为白色（按钮前的彩色小点与边框已代表角色色） */
.role-label {
    color: #fff !important;
}

/* 分组折叠样式 */
.role-style-group .role-style-header {
    display: flex;
    align-items: center;
    gap: 8px;
}
.role-style-toggle {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.06);
    color: #9fc7ff;
    cursor: pointer;
    font-size: 12px;
}
.role-style-group.collapsed .role-button-list {
    display: none !important;
}

/* 面板顶部设置开关（按样式同步） */
.role-panel-settings {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.role-panel-settings .setting-label {
    color: #cfd8e8;
    font-size: 13px;
}
.role-panel-settings .setting-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* 整体底部当前字幕面板 */
.role-current-panel {
    /* 取消默认负 margin；由 JS 微调控件位置，避免静态负值导致跨浏览器遮挡 */
    margin-top: 0;
    padding: 10px;
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    color: #e6eef8;
    font-size: 15px; /* 更大字体 */
    line-height: 1.35;
}
.role-current-entry {
    margin-bottom: 6px;
}
.role-current-entry .rname {
    color: #9fc7ff;
    font-weight: 600;
    margin-right: 8px;
}

/* 当前角色：使用粗边框，边框颜色由 JS 设为角色色；可选使用浅色背景配合可读文字颜色 */
.role-button.current {
    border-width: 3px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
}

/* 确保每组的新增按钮文本始终为白色，避免字体颜色被继承或覆盖导致不可见 */
.role-button.add-role-button {
    color: #ffffff !important;
    font-weight: 600 !important;
}


.proxy-config {
    background: #3d3d3d;
    padding: 10px;
    border-radius: 5px;
    margin-top: 10px;
}

.proxy-config label {
    display: block;
    margin-bottom: 5px;
    color: #ccc;
}

.proxy-config input {
    width: 100%;
    padding: 8px;
    background: #4d4d4d;
    border: 1px solid #666;
    border-radius: 4px;
    color: #fff;
    margin-bottom: 10px;
}

.proxy-config button {
    width: 100%;
    padding: 8px;
    background: #007acc;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.proxy-config button:hover {
    background: #0066aa;
}

/* 控制面板 Tab 样式（用于右侧面板的分页） */
/* 控制面板 Tab 样式（用于右侧面板的分页） */

/* 右侧控制面板标题区样式：独立于 Tab 显示 */
.control-panel .panel-header {
    padding: 12px 10px 8px 0;
    border-bottom: 1px solid #2b2b2b;
    margin-bottom: 8px;
}
.control-panel .panel-header .app-title {
    color: #ff6b00;
    margin: 0 0 6px 0;
    font-size: 1.4rem;
}
.control-panel .panel-header .app-description {
    color: #ccc;
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}
.control-panel .panel-header .nav-links {
    margin-top: 6px;
}

/* 强制把常见面板的底部间距设为 0，减少拖动或宽度变化时 layout 抖动 */
.subtitle-preview,
.role-current-panel,
.upload-section,
.file-info,
.tab-panels,
.role-style-group,
.role-button-list {
    margin-bottom: 0 !important;
}

