/* 组件专用样式 */

/* 说明页面样式 */
.instructions-content {
    background: #2d2d2d;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.instruction-section {
    margin-bottom: 40px;
}

.instruction-section h2 {
    color: #ff6b00;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #444;
}

/* 功能网格 */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.feature-card {
    background: #3d3d3d;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ff6b00;
}

.feature-card h3 {
    color: #ff6b00;
    margin-bottom: 10px;
}

.feature-card p {
    color: #ccc;
    line-height: 1.5;
}

/* 步骤指南 */
.step-by-step {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.step {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.step-number {
    background: #ff6b00;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.step-content h3 {
    color: #ff6b00;
    margin-bottom: 5px;
}

.step-content p {
    color: #ccc;
}

/* 功能列表 */
.feature-list {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: 8px 0;
    border-bottom: 1px solid #444;
    color: #ccc;
}

.feature-list li:last-child {
    border-bottom: none;
}

.feature-list strong {
    color: #ff6b00;
}

/* 快捷键网格 */
.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: #3d3d3d;
    border-radius: 8px;
}

.shortcut-item kbd {
    background: #2d2d2d;
    color: #ff6b00;
    padding: 5px 10px;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid #555;
}

.shortcut-item span {
    color: #ccc;
}

/* 常见问题 */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.faq-item {
    background: #3d3d3d;
    padding: 20px;
    border-radius: 8px;
}

.faq-item h3 {
    color: #ff6b00;
    margin-bottom: 10px;
}

.faq-item p {
    color: #ccc;
    line-height: 1.5;
}

.faq-item a {
    color: #ff6b00;
    text-decoration: none;
}

.faq-item a:hover {
    text-decoration: underline;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .shortcuts-grid {
        grid-template-columns: 1fr;
    }
    
    .instructions-content {
        padding: 20px;
    }
}

/* 下载面板与按钮样式优化 */
.download-panel {
    text-align: left;
    padding: 10px;
    border-radius: 6px;
    background: #121212;
    border: 1px solid #2e2e2e;
    color: #e6eef9;
}
.download-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.download-info {
    flex: 1 1 0%;
    min-width: 0;
}
.download-link {
    font-size: 12px;
    color: #9fc7ff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.download-container .btn {
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    background: #2f2f2f;
    color: #fff;
}
.download-container .btn.small {
    font-size: 13px;
    padding: 6px 10px;
}
.download-container .btn.primary {
    background: #ff6b00;
    color: #fff;
}
.status-close {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    background: transparent;
    border: none;
    color: #999;
    cursor: pointer;
}
.status-close:focus {
    outline: 2px solid rgba(255,107,0,0.25);
}

/* 文字超链接样式（下载面板） */
.download-link-a {
    font-size: 13px;
    color: #9fc7ff;
    text-decoration: underline;
    word-break: break-all;
}

.download-size {
    color: #bfcfe8;
    font-size: 12px;
    margin-top: 6px;
}

/* 移动端音量弹出控件（隐藏式）
   - 默认隐藏（不占位、不可交互），通过添加 .visible 类显示
   - 显示为绝对定位的小浮层，紧靠右侧控制区，支持平滑过渡 */
#mobileVolumePopup {
    position: absolute;
    right: 6px;
    top: -42px;
    background: rgba(20,20,20,0.95);
    border: 1px solid rgba(255,255,255,0.06);
    padding: 6px 8px;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.4);
    transform-origin: top right;
    transform: scale(0.8);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, transform 180ms ease;
    z-index: 1200;
}

#mobileVolumePopup.visible {
    transform: scale(1);
    opacity: 1;
    pointer-events: auto;
}

/* 滑块在移动端显示为较短的水平条，避免占用过多空间 */
#mobileVolumePopup input[type="range"] {
    width: 120px;
    height: 28px;
    background: transparent;
    -webkit-appearance: none;
}

#mobileVolumePopup input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    background: #3b3b3b;
    border-radius: 6px;
}
#mobileVolumePopup input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #ff6b00;
    border-radius: 50%;
    margin-top: -4px;
}

@media (max-width: 480px) {
    /* 小屏幕上稍微缩短滑块宽度 */
    #mobileVolumePopup input[type="range"] { width: 96px; }
}

/* 在移动屏幕上隐藏页面上原有的 volume slider（桌面控件），避免重复显示 */
@media (max-width: 768px) {
    .controls-right #volumeSlider {
        display: none !important;
        visibility: hidden;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* 强制隐藏桌面滑块的便捷类（由移动初始化脚本在需要时添加） */
.hidden-mobile-volume {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ==== 自定义模态对话框样式（ap-modal） ==== */
/* 供 UIController.showConfirmModal 使用：统一控制对话框外观与按钮样式，修复按钮尺寸与文字溢出问题 */
.ap-modal-overlay {
    position: fixed;
    inset: 0; /* top:0 right:0 bottom:0 left:0 */
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}
.ap-modal {
    background: #0b0c0e;
    color: #e7f0ff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.6);
    max-width: 620px;
    width: 100%;
    padding: 18px;
    box-sizing: border-box;
    font-size: 14px; /* 基础文字大小，避免被全局样式覆盖 */
    /* 增加浅色描边以与黑色背景分离，避免“黑底黑边”不易分辨的问题 */
    border: 1px solid rgba(255,255,255,0.08);
    position: relative; /* 供顶部高亮条定位使用 */
}
.ap-modal::after {
    /* 顶部细高亮条：与品牌橙保持一致，提升视觉层次 */
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    background: linear-gradient(90deg, #ff6b00, #ff8a33);
}
.ap-modal-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 15px;
    /* 标题用品牌橙，增强层次与可读性 */
    color: #ff6b00;
}
.ap-modal-body {
    margin-bottom: 14px;
    white-space: normal;
    line-height: 1.45;
    word-break: break-word;
    font-size: 13.5px;
}
.ap-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.ap-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px; /* 保证按钮有合理点击区域 */
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.06);
    background: transparent;
    color: #dfe8f8;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    box-sizing: border-box;
    /* 防止文字溢出按钮；在布局受限时显示省略号 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 日志查看器专用：操作者统计按钮组，避免被全局 .ap-btn 的 overflow/ellipsis 截断 */
.oplog-operator-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
    margin-bottom: 6px;
    /* 在父 flex 中不收缩，宽度随内容增长 */
    flex: 0 0 auto;
    overflow: visible; /* 允许内容溢出以显示完整姓名 */
}
.oplog-operator-btn {
    /* 覆盖全局 ap-btn 的截断规则，保证文本完整显示 */
    /* 使用 inline-flex 并禁止收缩，让按钮宽度随内容扩展；避免 overflow:visible 导致文本跑到外面 */
    display: inline-flex;
    align-items: center;
    white-space: nowrap; /* 保持姓名与计数在一行；若想换行可改为 normal */
    flex: 0 0 auto !important; /* 不允许收缩 */
    min-width: 0; /* 允许根据内容收敛/扩张（配合 flex:0 0 auto） */
    box-sizing: border-box; /* 包括 padding/border 在内的宽度计算，避免视觉溢出 */
}


/* ===== panel header 与认证区布局（从模板内联样式迁移） ===== */
.panel-header {
    display: flex;
    align-items: center;
    #apAuthModal {
         z-index: 99999 !important;
    }
    #apAuthModal .ap-modal {
         z-index: 100000 !important;
    }
    justify-content: space-between;
    gap: 12px;
}
.panel-header > div:first-child {
    /* 左侧标题容器允许收缩，防止长标题撑开布局 */
    min-width: 0;
}
.panel-header .app-title {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 20px;
}
.panel-header .app-description {
    margin: 4px 0 0 0;
    color: #bfcfe8;
    font-size: 13px;
}
.auth-area {
    min-width: 0; /* 允许在 flex 容器中正确收缩 */
    text-align: right;
    display: flex;
    align-items: center;
    gap: 8px;
}
.auth-area .ap-auth-btn {
    padding: 8px 12px;
    border-radius: 6px;
    background: #ff6b00;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 13px;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    min-width: 68px; /* 保证“登录”等文字不换行 */
}
.auth-area .ap-username {
    color: #dfe8f8;
    font-weight: 600;
}

/* 我的按钮样式（登录后显示） */
.auth-area .ap-my-btn {
    background: transparent;
    color: #9fbfff;
    border: 1px solid #2b2b2b;
    padding: 8px 12px;
    border-radius: 6px;
    min-width: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.auth-area .ap-my-btn:hover {
    background: rgba(255,255,255,0.02);
}

/* 响应式：窄屏时把 header 纵向排列并让认证区靠右显示（避免遮挡标题） */
@media (max-width: 720px) {
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .auth-area {
        width: 100%;
        text-align: right;
        justify-content: flex-end;
    }
    .panel-header .app-title {
        white-space: normal; /* 允许换行以提高可读性 */
    }
}

/* 全局固定右上角认证区样式（优先级高于 .auth-area） */
.global-auth {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 12000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    pointer-events: auto;
}
.global-auth button {
    white-space: nowrap;
    font-size: 13px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.35);
    cursor: pointer;
    line-height: 1;
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
}
.global-auth .ap-auth-btn {
    background: #ff6b00;
    color: #fff;
    border: none;
    min-width: 68px; /* 保证“登录”等文字不换行 */
    padding: 8px 14px;
}
.global-auth .ap-logout-btn {
    background: transparent;
    color: #9fbfff;
    border: 1px solid #2b2b2b;
    min-width: 68px;
    padding: 8px 12px;
}
.global-auth .ap-username {
    color: #dfe8f8;
    font-weight: 600;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .global-auth { right: 8px; top: 8px; }
    .global-auth .ap-username { max-width: 120px; }
}

/* 管理页（/admin/db）专用样式：覆盖全局深色主题，在管理卡片内使用浅色背景与深色文字，保证可读性 */
.admin-db-wrapper {
    max-width: 980px;
    margin: 18px auto;
    padding: 18px;
    border: 1px solid #e6e6e6;
    border-radius: 8px;
    background: #fafafa; /* 浅色卡片背景 */
    color: #222; /* 深色文字，覆盖全局浅色文字设置 */
}
.admin-db-wrapper a.button {
    display: inline-block;
    background: #ff6b00;
    color: #fff !important;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
}
.admin-db-wrapper .button {
    display: inline-block;
    margin: 6px 4px 0 0;
}
.admin-db-wrapper .admin-section {
    background: #fff;
    border: 1px solid #eee;
    padding: 12px;
    border-radius: 6px;
}
.admin-db-wrapper h1, .admin-db-wrapper h3, .admin-db-wrapper h4 {
    color: #222;
}
.admin-db-wrapper label {
    color: #333;
    font-size: 13px;
}
.admin-db-wrapper input[type="text"], .admin-db-wrapper input[type="file"] {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #222;
}
.admin-db-wrapper form > div { margin-bottom: 10px; }
.admin-db-wrapper button { display: inline-block; padding: 8px 12px; border-radius:6px; }
.admin-db-wrapper label { display:block; margin-bottom:6px; }
.admin-db-wrapper .admin-section h3 { margin-top:0; }

/* 强制管理页内所有表单按列垂直排列，避免在窄屏或不同缩放下文字与按钮重叠 */
.admin-db-wrapper form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch; /* 子项默认拉伸到容器宽度 */
}
.admin-db-wrapper form input[type="file"],
.admin-db-wrapper form input[type="text"],
.admin-db-wrapper form select,
.admin-db-wrapper form textarea {
    width: 100%;
    box-sizing: border-box;
}
.admin-db-wrapper form .button,
.admin-db-wrapper form button {
    /* 按钮靠左显示，但不占满整行 */
    display: inline-block;
    width: auto;
    align-self: flex-start;
}

/* 文件选择控件在某些浏览器会尝试占满宽度，显式设置为 auto 以避免与 label 同行时溢出 */
.admin-db-wrapper input[type="file"] {
    width: auto;
}
.admin-upload-list {
    max-height: 220px;
    overflow: auto;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #eee;
}
.admin-upload-list ul { margin:0; padding-left:18px; }
.admin-upload-list li { margin-bottom:6px; }
.admin-upload-list a { color: #0b66c3; text-decoration: underline; }

.admin-upload-list li { line-height: 1.6; }
.admin-db-wrapper code { background:#f4f4f4; padding:4px 6px; border-radius:4px; display:inline-block; }

/* 微交互：卡片阴影与间距微调 */
.admin-db-wrapper .admin-section + .admin-section { margin-top: 12px; }
.admin-db-wrapper .button { text-decoration:none }

/* 响应式：小屏幕单列显示 */
@media (max-width: 800px) {
    .admin-db-wrapper { padding: 12px; }
}
.ap-btn:focus { outline: 2px solid rgba(159,199,255,0.18); }
.ap-btn-primary {
    background: linear-gradient(180deg,#2b6df6,#1e54d6);
    border: none;
    color: #fff;
}
.ap-btn-cancel {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.06);
    color: #dfe8f8;
}

@media (max-width: 420px) {
    .ap-modal { padding: 12px; }
    .ap-modal-title { font-size: 14px; }
    .ap-modal-body { font-size: 13px; }
    .ap-btn { min-width: 64px; padding: 8px 12px; font-size: 13px; }
}

/* 在角色面板设置区域内的按钮不要被 flex 容器压缩，保持可点击区域与文本可见性 */
.role-panel-settings .ap-btn {
    flex-shrink: 0;
}

/* 颜色选择器弹窗样式（简易） */
.ap-color-picker-popup {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* 角色面板右上角字幕加载状态指示器 */
#subtitle-load-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    color: #111;
    transition: background-color 180ms ease, color 180ms ease, transform 200ms ease;
    flex-shrink: 0;
}
#subtitle-load-status.loading {
    background: rgba(255,215,64,0.12);
    color: #ffcc00;
}
#subtitle-load-status.loaded {
    background: #1ee07a;
    color: #022a0f;
    transform: scale(1.05);
}
#subtitle-load-status[title] { cursor: default; }

/* 包装器样式：文字 + 徽章，放在面板右侧 */
.subtitle-load-status-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.subtitle-load-status-label {
    color: #cfdff5;
    font-size: 12px;
}
.subtitle-load-status {
    /* 缩小徽章尺寸并微调字体，尽量与 h3 字体视觉一致 */
    height: 16px;
    min-width: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.subtitle-load-status.loading {
    background: rgba(255,215,64,0.09);
    color: #ffb700;
    border: 1px solid rgba(255,183,0,0.12);
}
.subtitle-load-status.loaded {
    background: rgba(30,224,122,0.12);
    color: #06a05a;
    border: 1px solid rgba(6,160,90,0.12);
}

/* 超链接样式：操作者列表使用轻量链接替代按钮以避免 ap-btn 的截断 */
.oplog-operator-link {
    display: inline-flex;
    align-items: center;
    color: #cfe8ff;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
    box-sizing: border-box;
    white-space: nowrap;
    flex: 0 0 auto;
}
.oplog-operator-link:hover {
    background: rgba(255,255,255,0.04);
    text-decoration: none;
}
.oplog-operator-link span { margin-left: 6px; font-size: 11px; opacity: 0.95; }

/* 高亮状态：当前筛选的操作者或“全部”按钮 */
.oplog-operator-link.active, .oplog-all-btn.active {
    background: #ff6b00 !important; /* 品牌橙 */
    color: #fff !important;
    border-color: transparent !important;
}

/* 活动态下仍保持同样的内边距与圆角 */
.oplog-operator-link.active span, .oplog-all-btn.active span { color: rgba(255,255,255,0.95); }