/* ========================================
   FRP 内网穿透管理后台 - 现代化样式
   ======================================== */

/* CSS 变量定义 - 基于 B 端 SaaS 设计风格 */
:root {
    /* 主色调 - 蓝色系 */
    --primary-color: #165DFF;
    --primary-hover: #0E42D2;
    --primary-light: #E8F3FF;

    /* 辅助色 */
    --success-color: #00B42A;
    --success-bg: #E8FFEA;
    --warning-color: #FF7D00;
    --warning-bg: #FFF7E8;
    --danger-color: #F53F3F;
    --danger-bg: #FFECE8;
    --info-color: #165DFF;
    --info-bg: #E8F3FF;

    /* 中性色 */
    --bg-body: #F2F3F5;
    --bg-card: #FFFFFF;
    --bg-input: #F2F3F5;
    --text-primary: #1D2129;
    --text-secondary: #86909C;
    --text-muted: #C9CDD4;
    --border-color: #E5E6EB;

    /* 阴影 - 轻量级投影 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 8px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 16px 0 rgba(0, 0, 0, 0.08);
    --shadow-xl: 0 12px 24px 0 rgba(0, 0, 0, 0.1);

    /* 圆角 - 大圆角设计 (8-12px) */
    --radius-sm: 0.5rem;    /* 8px */
    --radius-md: 0.625rem;  /* 10px */
    --radius-lg: 0.75rem;   /* 12px */
    --radius-xl: 0.875rem;  /* 14px */
    --radius-full: 9999px;

    /* 间距 */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* 过渡 */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 250ms ease-in-out;
    --transition-slow: 350ms ease-in-out;
    
    /* 侧边栏宽度 */
    --sidebar-width: 240px;
}

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 
                 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

/* 布局容器 */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-lg);
}

/* ========================================
   面板布局样式
   ======================================== */
.panel-wrapper {
    display: flex;
    min-height: 100vh;
}

/* 侧边栏 */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform var(--transition-base);
    display: flex;
    flex-direction: column;
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-base), visibility var(--transition-base);
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

.sidebar-brand {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand a {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg) 0;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 12px var(--spacing-lg);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.sidebar-nav-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-nav-item.active {
    background: #D6E9FF;
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    font-weight: 500;
}

.sidebar-nav-item svg {
    flex-shrink: 0;
}

/* 带有子菜单的菜单项 */
.sidebar-nav-item.has-submenu {
    justify-content: space-between;
}

.submenu-arrow {
    width: 16px;
    height: 16px;
    transition: transform var(--transition-fast);
}

.sidebar-nav-item.has-submenu.expanded .submenu-arrow {
    transform: rotate(180deg);
}

/* 子菜单容器 */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
    background: var(--bg-body);
}

.sidebar-submenu.show {
    max-height: 500px;
}

/* 子菜单项 */
.sidebar-submenu-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 10px var(--spacing-lg) 10px calc(var(--spacing-lg) * 2 + 18px);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.sidebar-submenu-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

.sidebar-submenu-item.active {
    background: #D6E9FF;
    color: var(--primary-color);
    font-weight: 500;
}

.sidebar-submenu-item svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* 主内容区域 */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* 顶部导航 */
.top-header {
    height: 64px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-lg);
    position: sticky;
    top: 0;
    z-index: 999;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    padding: var(--spacing-sm);
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.sidebar-toggle:hover {
    color: var(--primary-color);
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 var(--spacing-lg);
}

.header-logo img {
    max-height: 40px;
    object-fit: contain;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-user {
    color: var(--text-primary);
    font-weight: 500;
}

/* 页面内容 */
.page-content {
    padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-xl) var(--spacing-md);
    flex: 1;
}

/* 旧版 .content 兼容样式 */
.content {
    padding: var(--spacing-lg);
}

.container-fluid {
    width: 100%;
    padding: 0 var(--spacing-lg);
}

/* ========================================
   栅格系统 - Grid System
   ======================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: -12px;
}

.row + .row {
    margin-top: 12px;
}

.row.mt-4 {
    margin-top: var(--spacing-xl);
}

.col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    flex: 0 0 100%;
    padding: 12px;
    max-width: 100%;
}

.col-1 { flex: 0 0 8.333333%; padding: 12px; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; padding: 12px; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; padding: 12px; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; padding: 12px; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; padding: 12px; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; padding: 12px; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; padding: 12px; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; padding: 12px; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; padding: 12px; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; padding: 12px; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; padding: 12px; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; padding: 12px; max-width: 100%; }

/* 响应式断点 */
@media (min-width: 576px) {
    .col-sm-1 { flex: 0 0 8.333333%; padding: 12px; max-width: 8.333333%; }
    .col-sm-2 { flex: 0 0 16.666667%; padding: 12px; max-width: 16.666667%; }
    .col-sm-3 { flex: 0 0 25%; padding: 12px; max-width: 25%; }
    .col-sm-4 { flex: 0 0 33.333333%; padding: 12px; max-width: 33.333333%; }
    .col-sm-5 { flex: 0 0 41.666667%; padding: 12px; max-width: 41.666667%; }
    .col-sm-6 { flex: 0 0 50%; padding: 12px; max-width: 50%; }
    .col-sm-7 { flex: 0 0 58.333333%; padding: 12px; max-width: 58.333333%; }
    .col-sm-8 { flex: 0 0 66.666667%; padding: 12px; max-width: 66.666667%; }
    .col-sm-9 { flex: 0 0 75%; padding: 12px; max-width: 75%; }
    .col-sm-10 { flex: 0 0 83.333333%; padding: 12px; max-width: 83.333333%; }
    .col-sm-11 { flex: 0 0 91.666667%; padding: 12px; max-width: 91.666667%; }
    .col-sm-12 { flex: 0 0 100%; padding: 12px; max-width: 100%; }
}

@media (min-width: 768px) {
    .col-md-1 { flex: 0 0 8.333333%; padding: 12px; max-width: 8.333333%; }
    .col-md-2 { flex: 0 0 16.666667%; padding: 12px; max-width: 16.666667%; }
    .col-md-3 { flex: 0 0 25%; padding: 12px; max-width: 25%; }
    .col-md-4 { flex: 0 0 33.333333%; padding: 12px; max-width: 33.333333%; }
    .col-md-5 { flex: 0 0 41.666667%; padding: 12px; max-width: 41.666667%; }
    .col-md-6 { flex: 0 0 50%; padding: 12px; max-width: 50%; }
    .col-md-7 { flex: 0 0 58.333333%; padding: 12px; max-width: 58.333333%; }
    .col-md-8 { flex: 0 0 66.666667%; padding: 12px; max-width: 66.666667%; }
    .col-md-9 { flex: 0 0 75%; padding: 12px; max-width: 75%; }
    .col-md-10 { flex: 0 0 83.333333%; padding: 12px; max-width: 83.333333%; }
    .col-md-11 { flex: 0 0 91.666667%; padding: 12px; max-width: 91.666667%; }
    .col-md-12 { flex: 0 0 100%; padding: 12px; max-width: 100%; }
}

@media (min-width: 992px) {
    .col-lg-1 { flex: 0 0 8.333333%; padding: 12px; max-width: 8.333333%; }
    .col-lg-2 { flex: 0 0 16.666667%; padding: 12px; max-width: 16.666667%; }
    .col-lg-3 { flex: 0 0 25%; padding: 12px; max-width: 25%; }
    .col-lg-4 { flex: 0 0 33.333333%; padding: 12px; max-width: 33.333333%; }
    .col-lg-5 { flex: 0 0 41.666667%; padding: 12px; max-width: 41.666667%; }
    .col-lg-6 { flex: 0 0 50%; padding: 12px; max-width: 50%; }
    .col-lg-7 { flex: 0 0 58.333333%; padding: 12px; max-width: 58.333333%; }
    .col-lg-8 { flex: 0 0 66.666667%; padding: 12px; max-width: 66.666667%; }
    .col-lg-9 { flex: 0 0 75%; padding: 12px; max-width: 75%; }
    .col-lg-10 { flex: 0 0 83.333333%; padding: 12px; max-width: 83.333333%; }
    .col-lg-11 { flex: 0 0 91.666667%; padding: 12px; max-width: 91.666667%; }
    .col-lg-12 { flex: 0 0 100%; padding: 12px; max-width: 100%; }
}

/* Flexbox 工具类 */
.d-flex {
    display: flex;
}

.d-none {
    display: none;
}

.flex-column {
    flex-direction: column;
}

.align-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: var(--spacing-md);
}

.gap-3 {
    gap: var(--spacing-lg);
}

/* 卡片行等高布局 */
.row-cards .card {
    height: 100%;
}

.row-cards .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-footer-info {
    margin-top: var(--spacing-lg);
}

/* 卡片图标 */
.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: var(--spacing-md);
    flex-shrink: 0;
}

.card-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: var(--spacing-xs);
}

.card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 卡片链接样式 */
.card-link {
    display: block;
    text-decoration: none;
    transition: transform var(--transition-fast), box-shadow var(--transition-base), border-color var(--transition-fast);
}

.card-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-link:hover .card-value {
    color: var(--primary-hover);
}

/* 页面头部 */
.page-header {
    margin-bottom: var(--spacing-xl);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.page-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ========================================
   卡片样式
   ======================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: box-shadow var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-lg);
}

/* 可点击的卡片 */
.card[href] {
    transition: transform var(--transition-fast), box-shadow var(--transition-base), border-color var(--transition-fast);
}

.card[href]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.card-body {
    padding: var(--spacing-lg);
}

/* 表单卡片紧凑模式 */
.card-body.form-compact {
    padding: var(--spacing-md);
}

.card-body.form-compact .form-group {
    margin-bottom: 6px !important;
}

.card-body.form-compact .form-control {
    padding: 7px 10px;
}

.card-body.form-compact .form-label {
    margin-bottom: 3px !important;
}

.card-body.form-compact .form-text {
    margin-top: 4px;
    font-size: 0.8125rem;
}

.card-body.form-compact .form-section {
    padding: 8px 0;
    margin-bottom: 12px !important;
}

.card-body.form-compact .form-section-title {
    margin-bottom: 8px !important;
    padding-bottom: 4px;
}

/* 覆盖Bootstrap间距类在form-compact内的应用 */
.card-body.form-compact .mb-1,
.card-body.form-compact .mb-2,
.card-body.form-compact .mb-3,
.card-body.form-compact .mb-4,
.card-body.form-compact .mb-5 {
    margin-bottom: 6px !important;
}

.card-body.form-compact .mt-1,
.card-body.form-compact .mt-2,
.card-body.form-compact .mt-3,
.card-body.form-compact .mt-4,
.card-body.form-compact .mt-5 {
    margin-top: 6px !important;
}

.card-body.form-compact .row {
    margin-bottom: 8px !important;
    margin: -6px !important;
}

/* 覆盖栅格系统在form-compact内的padding */
.card-body.form-compact .col-1,
.card-body.form-compact .col-2,
.card-body.form-compact .col-3,
.card-body.form-compact .col-4,
.card-body.form-compact .col-5,
.card-body.form-compact .col-6,
.card-body.form-compact .col-7,
.card-body.form-compact .col-8,
.card-body.form-compact .col-9,
.card-body.form-compact .col-10,
.card-body.form-compact .col-11,
.card-body.form-compact .col-12,
.card-body.form-compact .col-md-1,
.card-body.form-compact .col-md-2,
.card-body.form-compact .col-md-3,
.card-body.form-compact .col-md-4,
.card-body.form-compact .col-md-5,
.card-body.form-compact .col-md-6,
.card-body.form-compact .col-md-7,
.card-body.form-compact .col-md-8,
.card-body.form-compact .col-md-9,
.card-body.form-compact .col-md-10,
.card-body.form-compact .col-md-11,
.card-body.form-compact .col-md-12 {
    padding: 6px !important;
}

.card-footer {
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

/* 图表容器 */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

.card-body canvas {
    width: 100% !important;
    height: auto !important;
    max-height: 300px;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    gap: 6px;
    outline: none;
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-default {
    background: var(--text-secondary);
    color: white;
}

.btn-default:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--bg-input);
    border-color: var(--text-muted);
}

.btn-sm {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.875rem;
}

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* 表单样式 */
.form-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.form-section:first-child {
    padding-top: 0;
}

.form-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    padding-bottom: var(--spacing-sm);
    border-bottom: 2px solid var(--bg-input);
}

.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-card);
}

.form-control::placeholder {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control:disabled {
    background: var(--bg-body);
    cursor: not-allowed;
    opacity: 0.6;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
    padding: 10px 14px;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    padding-right: 40px;
}

/* 表单输入组 */
.input-group {
    display: flex;
    gap: var(--spacing-sm);
}

.input-group .form-control {
    flex: 1;
}

/* 表单文本 */
.form-text {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.text-danger {
    color: var(--danger-color);
}

/* 链接按钮 */
.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 0;
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
    transition: color var(--transition-fast);
}

.btn-link:hover {
    color: var(--primary-hover);
}

/* ========================================
   Alert 警告框
   ======================================== */
.alert {
    padding: var(--spacing-md) var(--spacing-lg);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border-left: 4px solid;
    position: relative;
}

.alert-success {
    background: var(--success-bg);
    border-color: var(--success-color);
    color: var(--success-color);
}

.alert-danger {
    background: var(--danger-bg);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background: var(--warning-bg);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

.alert-info {
    background: var(--info-bg);
    border-color: var(--info-color);
    color: var(--info-color);
}

.alert-close {
    position: absolute;
    top: 50%;
    right: var(--spacing-md);
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.alert-close:hover {
    opacity: 1;
}

/* ========================================
   Table 表格样式
   ======================================== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

thead {
    background: var(--bg-input);
}

th, td {
    padding: 12px var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--bg-input);
}

/* Bootstrap 兼容表格类 */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: var(--bg-input);
}

.table-valign-middle td,
.table-valign-middle th {
    vertical-align: middle;
}

/* ========================================
   Badge 标签样式
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: var(--radius-full);
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-color);
}

.badge-success {
    background: var(--success-bg);
    color: var(--success-color);
}

.badge-danger {
    background: var(--danger-bg);
    color: var(--danger-color);
}

.badge-warning {
    background: var(--warning-bg);
    color: var(--warning-color);
}

.badge-secondary {
    background: var(--bg-input);
    color: var(--text-secondary);
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* 隧道类型标签颜色 */
.badge-tcp {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #7dd3fc;
}

.badge-udp {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.badge-http {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #86efac;
}

.badge-https {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #4ade80;
}

.badge-stcp {
    background: #f3e8ff;
    color: #7e22ce;
    border: 1px solid #c084fc;
}

.badge-xtcp {
    background: #fce7f3;
    color: #be185d;
    border: 1px solid #f9a8d4;
}

/* ========================================
   登录页面样式
   ======================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-body) 100%);
    padding: 20px;
}

.login-box {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 48px;
    max-width: 400px;
    width: 100%;
}

.login-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
    margin-bottom: var(--spacing-sm);
}

.login-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: var(--spacing-xl);
}

.login-box .form-group {
    margin-bottom: var(--spacing-lg);
}

.login-box .btn {
    width: 100%;
    margin-top: var(--spacing-md);
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .page-content {
        padding: var(--spacing-lg);
    }
    
    .top-header {
        padding: 0 var(--spacing-md);
    }
    
    .login-box {
        padding: 32px 24px;
    }
}

@media (max-width: 576px) {
    .container {
        padding: 0 var(--spacing-md);
    }
    
    .row {
        margin: -8px;
    }
    
    [class*="col-"] {
        padding: 8px;
    }
}

/* ========================================
   进度条样式
   ======================================== */
.progress {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--primary-color);
    border-radius: var(--radius-full);
    transition: width var(--transition-base);
}

.progress-bar-success {
    background: linear-gradient(90deg, var(--success-color), #34C759);
}

.progress-bar-warning {
    background: linear-gradient(90deg, var(--warning-color), #FF9500);
}

.progress-bar-danger {
    background: linear-gradient(90deg, var(--danger-color), #F76560);
}

/* ========================================
   工具类
   ======================================== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }

.p-1 { padding: var(--spacing-sm); }
.p-2 { padding: var(--spacing-md); }
.p-3 { padding: var(--spacing-lg); }
.p-4 { padding: var(--spacing-xl); }

.bg-white { background: var(--bg-card); }
.border { border: 1px solid var(--border-color); }
.border-0 { border: none !important; }
.rounded { border-radius: var(--radius-md); }

/* 代码块 */
pre {
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

pre code {
    background: none;
    padding: 0;
}
/* ========================================
   Profile 个人资料页面样式
   ======================================== */

/* 统计卡片行容器 */
.profile-stats-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
}

/* 统计卡片 */
.profile-stat-card {
    flex: 1;
    min-width: 280px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    padding: var(--spacing-lg);
    transition: all var(--transition-base);
}

.profile-stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* 统计卡片头部 */
.profile-stat-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

/* 统计卡片图标 */
.profile-stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-stat-icon svg {
    width: 24px;
    height: 24px;
}

/* 统计卡片标题 */
.profile-stat-title {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* 统计卡片数值 */
.profile-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
    line-height: 1.2;
}

/* 统计卡片底部 */
.profile-stat-footer {
    padding-top: var(--spacing-sm);
    border-top: 1px solid var(--border-color);
}

/* 进度条警告色 */
.progress-bar-warning {
    background: var(--warning-color);
}

/* 辅助类 */
.mb-2 {
    margin-bottom: var(--spacing-md) !important;
}

.gap-2 {
    gap: var(--spacing-md) !important;
}
/* ========================================
   Proxies 隧道管理页面样式
   ======================================== */

/* 统计信息紧凑版 */
.stats-compact {
    display: flex;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
    flex-wrap: wrap;
}

.stats-compact-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: var(--spacing-md) var(--spacing-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    flex: 1;
    min-width: 200px;
}

.stats-compact-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stats-compact-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stats-compact-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 隧道类型介绍 */
.proxy-type-item {
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border-color);
}

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

.proxy-type-item h4 {
    margin: 0 0 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 状态指示点 */
.status-dot {
    display: inline-flex;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    animation: statusPulse 2s infinite;
}

.status-online {
    background: var(--success-color);
}

.status-offline {
    background: var(--text-muted);
}

@keyframes statusPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 开关按钮 */
.switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.switch input {
    display: none;
}

.switch .slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: var(--text-muted);
    border-radius: 24px;
    transition: all var(--transition-fast);
}

.switch .slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 2px;
    bottom: 2px;
    background: white;
    border-radius: 50%;
    transition: all var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
    background: var(--success-color);
}

.switch input:checked + .slider::before {
    transform: translateX(20px);
}

.switch.switch-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* 加载覆盖层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.loading-overlay.show {
    display: flex;
}

.loading-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    text-align: center;
    animation: loadingSlideIn 0.3s ease-out;
}

@keyframes loadingSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--bg-input);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto var(--spacing-md);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.loading-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 隧道信息网格 */
.proxyinfo-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    font-size: 0.95rem;
}

.proxyinfo-label {
    color: var(--text-secondary);
    font-weight: 500;
    padding-right: 16px;
    text-align: right;
}

.proxyinfo-value {
    color: var(--text-primary);
    word-break: break-all;
}

/* 辅助类 */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.gap-2 {
    gap: 8px !important;
}

/* ========================================
   Switch 开关按钮样式
   ======================================== */
.switch-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--text-muted);
    transition: var(--transition-base);
    border-radius: 28px;
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-base);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.switch input:checked + .switch-slider {
    background-color: var(--primary-color);
}

.switch input:focus + .switch-slider {
    box-shadow: 0 0 0 3px var(--primary-light);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(24px);
}

.switch-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    user-select: none;
}

.switch-wrapper .switch-label.active {
    color: var(--primary-color);
    font-weight: 500;
}

/* 表单组中的开关 */
.form-group .switch-wrapper {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    min-height: 44px;
}

/* ========================================
   侧边栏滚动优化
   ======================================== */

/* 确保侧边栏正确高度 */
.sidebar {
    height: 100vh;
    max-height: 100vh;
}

/* 侧边栏导航区域滚动 */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--spacing-lg) 0;
    /* 改善滚动体验 */
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    scroll-behavior: smooth;
}

/* 自定义滚动条 - Webkit 浏览器 (Chrome, Safari, Edge) */
.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
    transition: background-color var(--transition-fast);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background-color: var(--text-muted);
}

/* Firefox 自定义滚动条 */
@supports (scrollbar-width: thin) {
    .sidebar-nav {
        scrollbar-width: thin;
        scrollbar-color: var(--border-color) transparent;
    }
}

/* 确保子菜单在滚动时正确显示 */
.sidebar-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-base);
    background: var(--bg-body);
    /* 确保子菜单不会因为滚动条被遮挡 */
    margin-left: 0;
}

.sidebar-submenu.show {
    max-height: 500px;
}
