/* ========== 全局布局 ========== */
.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ========== 背景壁纸与蒙版 ========== */
body {
    background-image: url('');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    z-index: 0;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.60);   /* 浅色模式：更通透，壁纸更清晰 */
    z-index: -1;
    pointer-events: none;
    transition: background 0.3s;
}

[data-bs-theme="dark"] body::before {
    background: rgba(0, 0, 0, 0.75);
}

/* ========== 侧边栏 ========== */
.sidebar {
    width: 220px;
    min-width: 220px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    overflow-y: auto;
    transition: width 0.25s ease, min-width 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-decoration: none;
    color: #fff;
}

.sidebar-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    margin-right: 10px;
}

.sidebar-brand span {
    font-size: 1.2rem;
    font-weight: bold;
}

/* 侧边栏导航 */
.sidebar-nav {
    list-style: none;
    padding: 8px 0;
    margin: 0;
}

.sidebar-nav li {
    margin: 2px 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.sidebar-nav a:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}

.sidebar-nav a.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
    border-left: 3px solid #5c7cfa;
    padding-left: 17px;
}

.sidebar-nav a .nav-icon {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

/* 折叠按钮 */
.sidebar-collapse-btn {
    position: absolute;
    top: 20px;
    right: 8px;
    background: rgba(255,255,255,0.1);
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: 0.2s;
    z-index: 20;
    line-height: 1;
}

.sidebar-collapse-btn:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

.collapse-icon {
    display: inline-block;
    transition: transform 0.2s;
}

/* 折叠状态 */
.sidebar.collapsed {
    width: 66px;
    min-width: 66px;
}

.sidebar.collapsed .sidebar-brand span {
    display: none;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 10px 0;
}

.sidebar.collapsed .nav-icon {
    margin-right: 0;
}

.sidebar.collapsed .sidebar-footer .theme-toggle-btn span {
    display: none;
}

.sidebar.collapsed .sidebar-footer {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.sidebar.collapsed .theme-toggle-btn {
    width: auto;
    padding: 6px 10px;
}

.sidebar.collapsed .collapse-icon {
    transform: rotate(180deg);
}

/* 侧边栏底部 */
.sidebar-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.theme-toggle-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    width: 100%;
    font-size: 0.9rem;
}

/* ========== 主内容区 ========== */
.main-content {
    flex: 1;
    margin-left: 220px;
    min-width: 0;
    transition: margin-left 0.25s ease;
}

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

/* ========== 顶部栏 ========== */
.topbar {
    background: rgba(255,255,255,0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid #e9ecef;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
    min-height: 56px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #495057;
    padding: 4px 8px;
    display: none;
}

/* 搜索框 */
.search-box {
    display: flex;
    align-items: center;
}

.search-box input {
    width: 240px;
    border-radius: 20px;
    padding: 6px 16px;
    border: 1px solid #dee2e6;
    font-size: 0.9rem;
}

.search-box button {
    border-radius: 20px;
    padding: 6px 16px;
    margin-left: 6px;
    font-size: 0.9rem;
}

/* 消息图标 */
.msg-icon {
    position: relative;
    color: #495057;
    text-decoration: none;
    font-size: 1.2rem;
    padding: 4px 8px;
}

.msg-badge {
    position: absolute;
    top: 0;
    right: 2px;
    background: #dc3545;
    color: #fff;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 用户区域 */
.user-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 页面内容 */
.page-content {
    padding: 20px;
}

/* ========== 暗色模式 ========== */
[data-bs-theme="dark"] .topbar {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-color: #2a2a3e;
}

[data-bs-theme="dark"] .sidebar-toggle {
    color: #ccc;
}

[data-bs-theme="dark"] .msg-icon {
    color: #ccc;
}

[data-bs-theme="dark"] .search-box input {
    background: #2a2a3e;
    border-color: #444;
    color: #eee;
}

/* ========== 移动端适配 ========== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .sidebar-toggle {
        display: block;
    }
    .search-box input {
        width: 140px;
    }
    .sidebar.collapsed ~ .main-content {
        margin-left: 0;
    }
}
.lang-toggle-btn {
    border: 1px solid #ff7a00;
    color: #ff7a00;
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    background: transparent;
    white-space: nowrap;
    pointer-events: auto !important;
    position: relative;
    z-index: 999;
}
.lang-toggle-btn:hover {
    background: rgba(255, 122, 0, 0.12);
    border-color: #ff9500;
    color: #ff9500;
}
.lang-toggle-btn:focus {
    box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.25);
    outline: none;
}
[data-bs-theme="dark"] .lang-toggle-btn {
    background: rgba(255,255,255,0.05);
}
[data-bs-theme="light"] .lang-toggle-btn {
    background: #fff;
    border: 1px solid #ff7a00;
    color: #ff7a00;
}
[data-bs-theme="light"] .lang-toggle-btn:hover {
    background: rgba(255, 122, 0, 0.08);
}
.judgex-orange-dropdown {
    background: rgba(20, 15, 35, 0.92);
    backdrop-filter: blur(22px);
    -webkit-backdrop-filter: blur(22px);
    border: 1px solid rgba(255, 122, 0, 0.55);
    border-radius: 12px;
    box-shadow: 0 8px 35px rgba(0, 0, 0, 0.45);
    padding: 8px;
    margin-top: 6px;
    min-width: 180px;
    z-index: 99999 !important;
    pointer-events: auto !important;
}
.judgex-orange-dropdown .dropdown-item {
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    pointer-events: auto !important;
}
.judgex-orange-dropdown .dropdown-item:hover {
    background: rgba(255, 122, 0, 0.35);
    color: #ffd700;
}
[data-bs-theme="light"] .judgex-orange-dropdown {
    background: rgba(255, 255, 255, 0.96);
    border-color: rgba(255, 122, 0, 0.35);
}
[data-bs-theme="light"] .judgex-orange-dropdown .dropdown-item {
    color: #1a1a2e;
}
[data-bs-theme="light"] .judgex-orange-dropdown .dropdown-item:hover {
    background: rgba(255, 122, 0, 0.18);
    color: #ff7a00;
}
.flex-shrink-0 {
    flex-shrink: 0 !important;
}
.flex-grow-1 {
    flex-grow-1 !important;
}