/*
 * _layout.css — 全局布局
 * ======================
 *
 * 覆盖范围：
 * - 全局 body 背景、字体、字色
 * - 滚动条暗色化（webkit + firefox）
 * - Layui 顶层容器 .layui-layout-body、.layui-layout-admin
 * - 主框架顶栏 .layui-header
 * - 主框架侧边栏 .layui-side（含 Logo 区）
 * - 主框架内容区 .layui-body
 * - 主框架消息抽屉 .sliderbar-container
 *
 * 不在此处覆盖：
 * - 导航交互（侧边菜单 / 顶部 Tab / 下拉） → _nav.css
 */

/* === 全局 body === */
html[data-skin="dark"],
html[data-skin="dark"] body {
    background: var(--bg-1);
    color: var(--text-1);
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html[data-skin="dark"] *,
html[data-skin="dark"] *::before,
html[data-skin="dark"] *::after {
    box-sizing: border-box;
}

/* === 链接基色 === */
html[data-skin="dark"] a {
    color: var(--text-1);
    transition: color var(--transition-fast);
}

html[data-skin="dark"] a:hover {
    color: var(--primary);
}

/* === 滚动条 === */
html[data-skin="dark"] *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

html[data-skin="dark"] *::-webkit-scrollbar-track {
    background: var(--bg-1);
}

html[data-skin="dark"] *::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    border: 2px solid var(--bg-1);
}

html[data-skin="dark"] *::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.18);
}

html[data-skin="dark"] {
    scrollbar-color: rgba(255, 255, 255, 0.12) var(--bg-1);
    scrollbar-width: thin;
}

/* === Layui 顶层容器 === */
html[data-skin="dark"] .layui-layout-body,
html[data-skin="dark"] .layui-layout-admin {
    background: var(--bg-1);
}

html[data-skin="dark"] .layui-layout-admin .layui-body {
    background: var(--bg-1);
    /* 不改 top —— 由 swiftadmin style.css 维持原 50px */
}

html[data-skin="dark"] .layui-fluid {
    background: transparent;
    /* 不改 padding —— 由 swiftadmin 维持原值 */
}

/* === 顶栏 ===
 * 严格"只改色不改 layout"：
 * 不动 height / line-height / padding-left / position 等 layout 属性，
 * 这些由 swiftadmin style.css 精心配置，改了会破坏对齐。
 * 只覆盖 background / border-bottom / 文字色。
 */
html[data-skin="dark"] .layui-layout-admin .layui-header {
    background: var(--bg-2);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

html[data-skin="dark"] .layui-header .layui-nav {
    background: transparent;
}

html[data-skin="dark"] .layui-header .layui-nav-item > a {
    color: var(--text-1);
    padding: 0 var(--space-4);
    transition: all var(--transition-base);
}

html[data-skin="dark"] .layui-header .layui-nav-item > a:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

html[data-skin="dark"] .layui-header .layui-nav-item .layui-icon,
html[data-skin="dark"] .layui-header .layui-nav-item .fa {
    font-size: 16px;
    color: var(--text-2);
    transition: color var(--transition-base);
}

html[data-skin="dark"] .layui-header .layui-nav-item:hover .layui-icon,
html[data-skin="dark"] .layui-header .layui-nav-item:hover .fa {
    color: var(--primary);
    text-shadow: 0 0 8px var(--primary-glow);
}

/* 头部用户头像 */
html[data-skin="dark"] .layui-header .layui-nav-img {
    border: 2px solid var(--border-strong);
    box-shadow: 0 0 0 1px var(--bg-2);
}

html[data-skin="dark"] .layui-header #username {
    color: var(--text-1);
    margin-left: var(--space-2);
}

/* 消息红点 */
html[data-skin="dark"] .layui-header .layui-badge-dot {
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
}

/* === 侧边栏 ===
 * 严格"只改色不改 layout"：
 * 不动 width、padding、box-shadow 浮动等，由 swiftadmin style.css 控制（默认 200/238px）
 * 只改背景色和右边线
 */
html[data-skin="dark"] .layui-layout-admin .layui-side {
    background: var(--bg-2);
    border-right: 1px solid var(--border);
}

/* Logo 区 — 只改背景、文字色、Logo 装饰，不动 height / padding / display */
html[data-skin="dark"] .layui-logo {
    background: var(--bg-3);
    border-bottom: 1px solid var(--border);
}

html[data-skin="dark"] .layui-logo img {
    /*box-shadow: 0 0 8px var(--primary-glow);*/
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.3));
    /* 不动 width / height，由 HTML inline 控制（35×35） */
}

html[data-skin="dark"] .layui-logo h1 {
    color: var(--text-1);
    background: linear-gradient(90deg, var(--text-1) 0%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    /* 不动 font-size / margin / display，由原 CSS 控制 */
}

/* === 通知抽屉 — 重设计（紧凑版） === */
/* 原 inline <style> 用了白底 + 巨大 24px 字号 + 蓝色竖标签，全部覆盖。
   保留 JS 切换逻辑：right: -262px / right: 0 + .title click。 */
html[data-skin="dark"] .sliderbar-container {
    width: 260px !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    top: auto !important;
    bottom: 24px !important;
    right: 0 !important;
    /* 用 transform 控制开合（GPU 合成层，比 jQuery animate right 流畅得多） */
    transform: translateX(260px);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.24, 1);
    will-change: transform;
    border: 1px solid rgba(0, 229, 255, 0.18) !important;
    border-right: 0 !important;
    background: linear-gradient(135deg, rgba(20, 28, 50, 0.97) 0%, rgba(14, 20, 38, 0.98) 100%) !important;
    border-radius: 10px 0 0 10px;
    box-shadow:
        -8px 0 24px rgba(0, 0, 0, 0.4),
        inset 1px 0 0 rgba(0, 229, 255, 0.08);
    overflow: visible !important;
}

/* 展开态由 data-open 属性切换 — 由点击 .title 时 JS 改 attr 触发 */
html[data-skin="dark"] .sliderbar-container[data-open="true"] {
    transform: translateX(0);
}

/* 顶部高光线（与 stats-section 风格统一） */
html[data-skin="dark"] .sliderbar-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.5;
    pointer-events: none;
}

/* 侧凸标签（保持 right:260 + width 让 JS 的 -262px 平移有效，露出 ~22px） */
html[data-skin="dark"] .sliderbar-container .title {
    width: 22px !important;
    height: 120px !important;
    top: 18px !important;
    right: 260px !important;
    padding: 8px 2px !important;
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.22) 0%, rgba(124, 92, 255, 0.22) 100%) !important;
    border: 1px solid rgba(0, 229, 255, 0.28);
    border-right: 0;
    border-radius: 10px 0 0 10px !important;
    box-shadow: -4px 0 16px rgba(0, 229, 255, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
    color: var(--primary) !important;
    font-size: 11px !important;
    font-weight: 500;
    letter-spacing: 0 !important;
    line-height: 1.5 !important;
    writing-mode: horizontal-tb !important;
    word-break: break-all;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s var(--transition-base);
    user-select: none;
}

html[data-skin="dark"] .sliderbar-container .title:hover {
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.32) 0%, rgba(124, 92, 255, 0.32) 100%) !important;
    color: #FFFFFF !important;
    box-shadow: -6px 0 20px rgba(0, 229, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

html[data-skin="dark"] .sliderbar-container .title i {
    display: block;
    font-size: 13px !important;
    margin-bottom: 4px;
    color: var(--primary);
}

html[data-skin="dark"] .sliderbar-container .title:hover i {
    color: #FFFFFF;
}

/* body 容器：取消滚动条，自适应高度 */
html[data-skin="dark"] .sliderbar-container .body {
    width: auto !important;
    height: auto !important;
    padding: 10px !important;
    background: transparent !important;
    color: var(--text-1);
    font-size: 12px !important;
    overflow: visible !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 顶部标题区 */
html[data-skin="dark"] .sliderbar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px 6px;
    border-bottom: 1px solid rgba(0, 229, 255, 0.1);
}

html[data-skin="dark"] .sliderbar-head-title {
    color: var(--text-1);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1.5px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    line-height: 1.4;
}

html[data-skin="dark"] .sliderbar-head-title::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 12px;
    background: linear-gradient(180deg, var(--primary) 0%, var(--accent, #7C5CFF) 100%);
    border-radius: 2px;
}

/* 闪烁圆点：表示"实时" */
html[data-skin="dark"] .sliderbar-head-pulse {
    width: 7px;
    height: 7px;
    background: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 6px var(--success);
    animation: sliderbar-pulse 1.6s ease-in-out infinite;
    cursor: help;
}

@keyframes sliderbar-pulse {
    0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 6px var(--success); }
    50% { opacity: 0.5; transform: scale(0.85); box-shadow: 0 0 2px var(--success); }
}

/* 通知列表 */
html[data-skin="dark"] .sliderbar-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* 取消旧 .notice 容器的内边距/外边距/字号（HTML 仍包了一层 div.notice 用于兼容） */
html[data-skin="dark"] .sliderbar-container .body .notice {
    padding: 0 !important;
    margin: 0 !important;
    font-size: inherit !important;
    text-align: left !important;
}

/* 单条通知项 */
html[data-skin="dark"] .notice-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px 6px 12px;
    background: rgba(14, 20, 38, 0.55);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-1) !important;
    font-size: 12px !important;
    text-decoration: none;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.18s var(--transition-base);
}

html[data-skin="dark"] .notice-item:hover {
    border-color: rgba(0, 229, 255, 0.45);
    background: rgba(14, 20, 38, 0.85);
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 229, 255, 0.12);
    color: var(--text-1) !important;
}

/* 左侧 3px stripe 色条 */
html[data-skin="dark"] .notice-item-stripe {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    transition: box-shadow var(--transition-base);
}

html[data-skin="dark"] .notice-item.is-register .notice-item-stripe { background: var(--text-2); }
html[data-skin="dark"] .notice-item.is-create .notice-item-stripe { background: #FF5C7C; }
html[data-skin="dark"] .notice-item.is-checkout .notice-item-stripe { background: #16BE8C; }
html[data-skin="dark"] .notice-item.is-recharge .notice-item-stripe { background: #6BB4F0; }
html[data-skin="dark"] .notice-item.is-withdrawal .notice-item-stripe { background: var(--accent, #7C5CFF); }

html[data-skin="dark"] .notice-item:hover .notice-item-stripe {
    box-shadow: 0 0 8px currentColor;
}

/* icon 槽 */
html[data-skin="dark"] .notice-item-icon {
    flex: 0 0 auto;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 229, 255, 0.06);
    border-radius: 5px;
    font-size: 12px;
    transition: all var(--transition-base);
}

html[data-skin="dark"] .notice-item.is-register .notice-item-icon { background: rgba(160, 170, 200, 0.12); color: var(--text-2); }
html[data-skin="dark"] .notice-item.is-create .notice-item-icon    { background: rgba(255, 92, 124, 0.14); color: #FF5C7C; }
html[data-skin="dark"] .notice-item.is-checkout .notice-item-icon  { background: rgba(22, 190, 140, 0.14); color: #16BE8C; }
html[data-skin="dark"] .notice-item.is-recharge .notice-item-icon  { background: rgba(107, 180, 240, 0.14); color: #6BB4F0; }
html[data-skin="dark"] .notice-item.is-withdrawal .notice-item-icon{ background: rgba(124, 92, 255, 0.14); color: var(--accent, #7C5CFF); }

html[data-skin="dark"] .notice-item-icon i {
    font-size: 12px;
    line-height: 1;
}

/* label */
html[data-skin="dark"] .notice-item-label {
    flex: 1;
    color: var(--text-1);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: 0.3px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* count badge — 强制（高优先级 selector）覆盖 layui-font-* 全局颜色 */
html[data-skin="dark"] .sliderbar-container .notice-item .notice-item-count {
    flex: 0 0 auto;
    min-width: 30px;
    height: 22px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(14, 20, 38, 0.7);
    border: 1px solid var(--border);
    border-radius: 11px;
    color: var(--text-3) !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    font-family: "SF Mono", Consolas, monospace;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    transition: all var(--transition-base);
}

/* count > 0 时由 layui-font-* class 指示，渲染为高亮渐变胶囊（高优先级覆盖） */
html[data-skin="dark"] .sliderbar-container .notice-item .notice-item-count.layui-font-gray {
    background: rgba(14, 20, 38, 0.7) !important;
    color: var(--text-2) !important;
}

html[data-skin="dark"] .sliderbar-container .notice-item .notice-item-count.layui-font-red {
    background: linear-gradient(135deg, #FF5C7C 0%, #FF7A95 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 0 12px rgba(255, 92, 124, 0.5);
}

html[data-skin="dark"] .sliderbar-container .notice-item .notice-item-count.layui-font-green {
    background: linear-gradient(135deg, #16BE8C 0%, #2DD4A8 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 0 12px rgba(22, 190, 140, 0.42);
}

html[data-skin="dark"] .sliderbar-container .notice-item .notice-item-count.layui-font-blue {
    background: linear-gradient(135deg, #1E9FFF 0%, #6BB4F0 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 0 12px rgba(30, 159, 255, 0.42);
}

html[data-skin="dark"] .sliderbar-container .notice-item .notice-item-count.layui-font-purple {
    background: linear-gradient(135deg, var(--accent, #7C5CFF) 0%, #9F86FF 100%) !important;
    color: #fff !important;
    border-color: transparent !important;
    box-shadow: 0 0 12px rgba(124, 92, 255, 0.42);
}

html[data-skin="dark"] .notice-item:hover .notice-item-count {
    transform: scale(1.06);
}
