/**
 * common.css - 统一公共样式
 * 用于所有设置页面的表单布局
 */

/* ========================================
   表单布局 - 统一180px标签宽度
   ======================================== */

.settings-form {
    max-width: 800px;
}

.settings-form dl,
.settings-form .form-row {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 0.5rem 1rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.settings-form dt,
.settings-form label {
    font-weight: 500;
    color: var(--tblr-body-color);
    font-size: 0.875rem;
}

.settings-form dd {
    margin: 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 输入框统一宽度 */
.settings-form input[type="text"],
.settings-form input[type="password"],
.settings-form input[type="number"] {
    max-width: 280px;
}

.settings-form select {
    max-width: 280px;
}

/* 提示文字 */
.settings-form .hint {
    font-size: 0.75rem;
    color: var(--tblr-muted);
}

/* 表单操作按钮区 */
.settings-form .form-actions {
    grid-column: 2;
    padding-top: 0.5rem;
}

/* 通用"保存/设置"大按钮样式，与 Output 页面风格保持一致 */
.btn-save,
.tabWrite .but {
    background-color: var(--tblr-primary);
    color: #ffffff;
    border: none;
    padding: 0.5rem 2.5rem;
    border-radius: var(--tblr-border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    min-width: 200px;
}

.btn-save:hover,
.tabWrite .but:hover {
    background-color: var(--tblr-primary-darken);
}

/* 页面级表单操作区域：对齐到第二列输入框
   计算：卡片左内边距 (1.25rem=20px) + 180px 标签宽 + 1rem 列间距(16px) = 216px */
.form-actions-page {
    margin-left: calc(1.25rem + 180px + 1rem);
    margin-top: 0.5rem;
}

/* ========================================
   设置分区样式
   ======================================== */

.settings-section {
    background: var(--tblr-bg-surface);
    border: 1px solid var(--tblr-border-color);
    border-radius: var(--tblr-border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

.settings-section h4 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--tblr-border-color);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--tblr-primary);
}

/* ========================================
   卡片表头样式 - 紧凑风格，与 Output 页面一致
   ======================================== */

.card-header {
    padding: 0 1rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    background: var(--tblr-card-cap-bg);
    border-bottom: 1px solid var(--tblr-border-color);
}

.card-header .card-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

/* ========================================
   状态页面区块标题 - 与卡片表头风格一致
   ======================================== */

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 1.5rem -1.25rem 1rem -1.25rem;  /* 上边距1.5rem，左右负边距撑满 */
    padding: 0.5rem 1.25rem;
    background: var(--tblr-card-cap-bg);
    border-top: 1px solid var(--tblr-border-color);
    border-bottom: 1px solid var(--tblr-border-color);
}

/* 只有 card-body 直接子元素的第一个标题才贴顶，且无顶部边框 */
.card-body > .section-title:first-child {
    margin-top: -1.25rem;
    border-top: none;
    border-radius: var(--tblr-border-radius) var(--tblr-border-radius) 0 0;
}

/* ========================================
   卡片内表单布局
   ======================================== */

.card-body.settings-form dl {
    margin-bottom: 0.75rem;
}

.card-body.settings-form dl:last-child {
    margin-bottom: 0;
}

/* ========================================
   主题切换器样式
   ======================================== */

.theme-switcher {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* 颜色指示器 */
.color-indicator {
    display: block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--tblr-border-color);
    transition: transform 0.15s;
}

.color-indicator:hover {
    transform: scale(1.1);
}

/* 颜色选择下拉菜单 */
.color-picker-dropdown {
    padding: 0.75rem;
    min-width: 140px;
}

/* 下拉菜单显示时使用grid布局 */
.dropdown-menu.color-picker-dropdown.show {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

/* 颜色选项 */
.color-option {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 0.15s, border-color 0.15s;
}

.color-option:hover {
    transform: scale(1.2);
}

.color-option.active {
    border-color: var(--tblr-body-color);
    box-shadow: 0 0 0 2px var(--tblr-bg-surface);
}

/* ========================================
   导航栏菜单样式 - 兼容旧版风格 & 主题色
   ======================================== */

/* 关闭 Tabler 在深色主题下对品牌图片的自动反相处理
   否则 logo.png 会被强制 brightness(0) + invert(1)，
   叠影/发光效果会比旧版更“硬”。 */
[data-bs-theme="dark"] .navbar-brand-autodark .navbar-brand-image {
    filter: none;
}

/* Logo 区域：进一步增高，接近旧版大标题效果 */
.navbar.navbar-vertical .navbar-brand {
    padding-top: 2.5rem;
    padding-bottom: 1.5rem;
}

/* 垂直导航中的 Logo 更大一些 */
.navbar.navbar-vertical .navbar-brand-image {
    height: 3.8rem;
    width: auto;
}

/* 顶级菜单项：按钮风格（未选中时使用主色块） */
.navbar.navbar-vertical .navbar-nav > .nav-item > .nav-link {
    margin: 0.5rem 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: var(--tblr-border-radius);
    background-color: rgba(var(--tblr-primary-rgb), 0.95);
    color: #ffffff;
    box-shadow: var(--tblr-shadow-input);
}

/* 顶级菜单中的图标颜色跟随文字 */
.navbar.navbar-vertical .navbar-nav > .nav-item > .nav-link .nav-link-icon {
    color: inherit;
}

/* 第一个顶级菜单项，上边距略小一点 */
.navbar.navbar-vertical .navbar-nav > .nav-item:first-child > .nav-link {
    margin-top: 0rem;
}

/* 当前顶级菜单：反色显示，类似旧版白色块
   - encode/OSD/系统设置：通过 li.nav-item.active 标记
   - 状态显示：首页：通过 a.nav-link.active 标记 */
.navbar.navbar-vertical .navbar-nav > .nav-item.active > .nav-link,
.navbar.navbar-vertical .navbar-nav > .nav-item > .nav-link.active {
    background-color: #ffffff;
    color: color-mix(in srgb, var(--tblr-primary) 80%, #000000);
}


/* 子菜单容器：紧贴当前目录，略微留一点内边距 */
.navbar.navbar-vertical .dropdown-menu {
    padding: 0.25rem 0 0.25rem 0;
}

/* 子菜单项：仅文字高亮，不整块铺色，接近旧版风格 */
.navbar.navbar-vertical .dropdown-menu .dropdown-item {
    padding: 0.35rem 1rem 0.35rem 2rem;
    margin: 0;
    border-radius: 0;
    color: var(--tblr-muted);
    background-color: transparent;
}

/* 当前子菜单项：文字更亮、更粗 */
.navbar.navbar-vertical .dropdown-menu .dropdown-item.active {
    color: var(--tblr-body-color);
    font-weight: 600;
    background-color: transparent;
}

/* 子菜单悬停时：轻微主色背景提示，可点击 */
	.navbar.navbar-vertical .dropdown-menu .dropdown-item:hover {
	    color: var(--tblr-body-color);
	    background-color: rgba(var(--tblr-primary-rgb), 0.08);
	}

/* ========================================
   视频预览弹窗（替代 artDialog），与 Tabler 风格统一
   ======================================== */

.video-preview-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.video-preview-modal {
    background: var(--tblr-bg-surface);
    border-radius: var(--tblr-border-radius-lg, var(--tblr-border-radius));
    box-shadow: var(--tblr-shadow-card);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.video-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0.5rem;
    min-height: 1.4rem;
    background: var(--tblr-card-cap-bg);
    border-bottom: 1px solid rgba(var(--tblr-border-color-rgb, 148, 163, 184), 0.5);
}

.video-preview-title {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--tblr-muted);
}

.video-preview-close {
    padding: 0;
    width: 1rem;
    height: 1rem;
    border: none;
    background: transparent;
    color: var(--tblr-muted);
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.video-preview-close:hover {
    color: var(--tblr-body-color);
}

.video-preview-body {
    padding: 0.5rem;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    min-width: 0;
    min-height: 0;
}

.video-preview-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    flex: 0 0 auto;
    max-width: 100%;
    max-height: 100%;
}

.video-preview-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    filter: alpha(Opacity=80);
    opacity: 0.8;
    z-index: 1;
}

.video-preview-canvas,
.video-preview-video {
    display: block;
    width: 100%;
    height: 100%;
    background: #000;
}

/* ========================================
   Sidebar scroll behavior
   ======================================== */

@media (min-width: 992px) {
    .page {
        background: linear-gradient(90deg, var(--tblr-gray-800) 0 15rem, var(--tblr-body-bg) 15rem 100%);
        flex-direction: row;
        align-items: flex-start;
    }

    .page > .navbar.navbar-vertical.navbar-expand-lg {
        position: static;
        overflow: visible;
        flex: 0 0 15rem;
    }

    .navbar-vertical.navbar-expand-lg ~ .page-wrapper {
        margin-inline-start: 0;
        margin-inline-end: 0;
        min-width: 0;
    }
}

/* ========================================
   URL 复制按钮样式
   ======================================== */

.btn-copy {
    padding: 0.125rem;
    background: transparent;
    border: none;
    color: var(--tblr-muted);
    cursor: pointer;
    transition: color 0.15s, opacity 0.15s;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    opacity: 0;
    margin-left: 4px;
}

/* 鼠标悬停在行上时显示图标 */
.status-item:hover .btn-copy {
    opacity: 0.6;
}

.status-item:hover .btn-copy:hover {
    color: var(--tblr-primary);
    opacity: 1;
}

/* 复制成功后始终显示 */
.btn-copy.copied {
    opacity: 1;
    color: var(--tblr-success);
}

.btn-copy svg {
    width: 14px;
    height: 14px;
}
