:root {
    --primary: #0d6efd;
    --secondary: #6c757d;
    --success: #198754;
    --warning: #ffc107;
    --danger: #dc3545;
    --light: #f8f9fa;
    --dark: #212529;
    --sidebar-width: 250px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7f9;
    overflow-x: hidden;
}

#app {
    display: flex;
    min-height: 100vh;
}

.tab-content {
    display: none;
}

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

/* 侧边栏样式 */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #2c3e50, #1a2530);
    color: white;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
    box-shadow: 3px 0 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.logo {
    padding: 20px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.logo i {
    font-size: 28px;
    margin-bottom: 10px;
    color: #4ecdc4;
}

.logo h1 {
    font-size: 20px;
    margin: 0;
    font-weight: 600;
}

.nav-menu {
    list-style: none;
    padding: 10px 0;
    margin: 0;
    flex-grow: 1;
}

.nav-menu li {
    margin: 5px 0;
}

.nav-menu a {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    padding: 12px 20px;
    display: block;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.nav-menu a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-menu a i {
    width: 25px;
    text-align: center;
    margin-right: 10px;
}

.nav-menu li.active a {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-left-color: #4ecdc4;
}

.sidebar-footer {
    padding: 20px;
    font-size: 12px;
    color: #8aa4af;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* 主内容区域样式 */
.main-content {
    flex: 1;
    padding: 20px;
    margin-left: 0;
    transition: all 0.3s;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.header h2 {
    margin: 0;
    font-weight: 600;
    color: #2c3e50;
}

/* 卡片样式 */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #eaeaea;
    padding: 15px 20px;
    font-weight: 600;
    color: #2c3e50;
    border-radius: 10px 10px 0 0 !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 20px;
}

/* 状态徽章 */
.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-synced {
    background-color: rgba(25, 135, 84, 0.15);
    color: var(--success);
}

.status-pending {
    background-color: rgba(255, 193, 7, 0.15);
    color: var(--warning);
}

.status-error {
    background-color: rgba(220, 53, 69, 0.15);
    color: var(--danger);
}

/* 进度条样式 */
.progress {
    height: 8px;
    border-radius: 4px;
}

/* 统计卡片网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
}

.stat-item h3 {
    font-size: 13px;
    color: #6c757d;
    margin: 0 0 5px 0;
}

.stat-item p {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    color: #2c3e50;
}

/* 历史记录项 */
.history-item {
    display: flex;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
}

.history-item:last-child {
    border-bottom: none;
}

.history-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    flex-shrink: 0;
}

.history-content {
    flex-grow: 1;
}

.history-content h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    font-weight: 600;
}

.history-content p {
    margin: 0 0 5px 0;
    color: #6c757d;
}

.history-time {
    font-size: 12px;
    color: #adb5bd;
}

/* 设置网格 */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.setting-group {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.setting-group h3 {
    font-size: 16px;
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-weight: 600;
}

.setting-item {
    margin-bottom: 15px;
}

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.setting-item:last-child {
    margin-bottom: 0;
}

/* 设备项样式 */
.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #f0f0f0;
    overflow: scroll;
}

.device-item:last-child {
    border-bottom: none;
}

.device-status {
    display: flex;
    align-items: center;
}

.device-status div {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.online {
    background-color: var(--success);
    min-width: 12px;
}

.offline {
    background-color: var(--secondary);
    min-width: 12px;
}

/* 按钮样式 */
.btn {
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 13px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* 文件列表样式 */
.file-list .file-item {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.file-list .file-item:hover {
    background-color: #f8f9fa;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .sidebar {
        width: 70px;
        overflow: visible;
    }

    .logo h1,
    .nav-menu span,
    .sidebar-footer p {
        display: none;
    }

    .sidebar-footer button {
        display: none;
    }

    .logo i {
        margin-bottom: 0;
        display: block;
        margin-left: auto;
        margin-right: auto;
    }

    .nav-menu a {
        text-align: center;
        padding: 15px 0;
        display: flex;
        justify-content: center;
        align-items: center;
    }

    .nav-menu a i {
        margin-right: 0;
    }

    .nav-menu li.active a {
        border-left: none;
        border-bottom: 3px solid #4ecdc4;
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .settings-grid {
        grid-template-columns: 1fr;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header div {
        margin-top: 15px;
    }
}

.file-input {
    width: 100%;
    padding: 15px;
    border: 2px dashed #ccc;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.file-input:hover {
    border-color: var(--primary);
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: #fff;
    margin: 10% auto;
    padding: 0;
    border-radius: 8px;
    width: 500px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.close {
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

/* .directory-item {
    margin: 5px 0;
    padding: 5px;
    border-radius: 4px;
} */

.directory-header {
    cursor: pointer;
    padding: 3px 0;
}

.directory-content {
    transition: all 0.2s ease;
}

.file-tree-level {
    position: relative;
}

.file-item {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.hidden {
    display: none;
}


/* webrtc connection status modal */
.webrtc-status-modal .status-display-container {
    padding: 10px 0;
}

.webrtc-status-modal .connection-panel {
    display: block;
    padding: 10px 0;
}

.webrtc-status-modal .no-connection-message {
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
    text-align: center;
}

.webrtc-status-modal .status-item {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.webrtc-status-modal .status-label {
    font-weight: bold;
    margin-right: 10px;
}

.webrtc-status-modal .status-value {
    color: var(--text-muted);
}

.webrtc-status-modal .stats-container {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--background-modifier-border);
}

.webrtc-status-modal h3 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: var(--text-normal);
}

/* State specific colors */
.webrtc-status-modal .state-connected {
    color: var(--color-green);
}

.webrtc-status-modal .state-disconnected {
    color: var(--color-red);
}

.webrtc-status-modal .state-connecting {
    color: var(--color-orange);
}

#contentDisplay {
    transition: all 0.3s ease;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding: 10px;
}

/* 优化按钮样式 */
#toggleContent {
    padding: 2px 8px;
    border-radius: 4px;
    cursor: pointer;
}

#toggleContent:hover {
    background-color: #f0f0f0;
}

.log-container {
    /* 设置最大高度，可根据需要调整数值 */
    max-height: 400px;
    /* 内容超出时显示垂直滚动条 */
    overflow-y: auto;
    /* 可选：添加内边距和边框增加可读性 */
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    /* 可选：设置滚动条样式（针对WebKit浏览器） */
    scrollbar-width: thin;
    white-space: normal;
    /* 允许正常换行（默认值，但显式设置更明确） */
    word-wrap: break-word;
    /* 允许长单词或URL在边界处换行 */
    word-break: break-all;
    /* 对于非CJK文字，允许在任意字符处换行 */
}

/* .lang-btn.active {
    background-color: #e9ecef;
    font-weight: 500;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
} */

/* 悬停效果优化 */
/* .lang-btn:not(.active):hover {
    background-color: #f8f9fa;
} */

/* 1. 全局字体栈配置（优先系统预装字体，保证兼容性） */
:root {
    /* 无衬线字体栈：适配正文/UI，兼顾中英文清晰度 */
    --font-sans:
        /* 英文字体（现代无衬线，清晰易读） */
        'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial,
        /* 中文字体（系统默认，避免加载延迟） */
        'PingFang SC', 'Microsoft YaHei', 'Heiti SC', 'Noto Sans SC', 'WenQuanYi Zen Hei',
        sans-serif;

    /* 标题字体栈：略粗，增强视觉层级 */
    --font-heading:
        'Inter', 'Segoe UI Semibold', 'Roboto Medium',
        'PingFang SC Medium', 'Microsoft YaHei Bold', 'Noto Sans SC Medium',
        sans-serif;

    /* 辅助字体：用于标签、按钮等小文本 */
    --font-sm:
        'Inter', 'Segoe UI', 'Roboto',
        'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC',
        sans-serif;
}

/* 2. 全局字体应用 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-sans);
}

/* 标题样式：使用标题字体栈，增强权重 */
h1,
h2,
h3,
.card-header span.fw-semibold,
.header h2 {
    font-family: var(--font-heading);
    font-weight: 600;
    /* 中英文统一粗度，避免中文过细 */
    letter-spacing: 0.01em;
    /* 微调间距，提升精致度 */
}

/* 小文本样式：按钮、标签等 */
.btn,
.text-sm,
.small,
.stat-item h3,
.setting-group h3 {
    font-family: var(--font-sm);
    font-size: 0.875rem;
    /* 统一小文本尺寸，适配中英文 */
}

/* 3. 字体渲染优化（解决模糊问题） */
body {
    -webkit-font-smoothing: antialiased;
    /* 苹果系统平滑渲染 */
    -moz-osx-font-smoothing: grayscale;
    /* 安卓/Windows 灰度抗锯齿 */
    font-feature-settings: "liga" 1, "calt" 1;
    /* 启用英文连字（如 fi/ff），不影响中文 */
    color: #212529;
    /* 深灰文字，比纯黑更易读 */
}

/* 4. 不同语言的细节微调 */
/* 中文：字符间距略宽，避免拥挤 */
:lang(zh) {
    letter-spacing: 0.02em;
}

/* 英文：保持紧凑，符合阅读习惯 */
:lang(en) {
    letter-spacing: 0.005em;
}

/* 5. 适配特殊元素 */
/* 侧边栏菜单：图标与文字对齐 */
.nav-menu li a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    /* 图标与文字间距，中英文一致 */
    font-family: var(--font-sm);
}

/* 表单元素：保持字体统一 */
.form-control,
.form-select,
.form-check-label {
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

/* 日志/状态文本：等宽对齐（可选，提升技术文本可读性） */
.log-container,
#fileContent {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace,
        'WenQuanYi Zen Hei Mono', 'Microsoft YaHei Mono';
    font-size: 0.85rem;
    line-height: 1.6;
}

/* 强制 Font Awesome 图标使用专属字体，避免被全局字体覆盖 */
.fas,
.fa-solid,
.fab,
.fa-brands,
.far,
.fa-regular {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    font-style: normal !important;
    /* 清除可能的斜体样式 */
    font-weight: 900 !important;
    /* 对应 solid 图标（fas）的权重，避免显示异常 */
}