/* ===== 全局 ===== */
body, html {
    margin: 0;
    padding: 0;
    font-family: "Microsoft YaHei", "Songti SC", serif;
    background-color: #1f2223;
    color: #fff;
    scroll-behavior: smooth;
    overflow: hidden;
    height: 100%;
}

a { text-decoration: none; color: #fff; }

/* ===== 顶部栏 ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background-color: #1c1c1c;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.logo-container { display: flex; align-items: center; gap: 10px; }
.logo { width: auto; height: 24px; background-color: white; padding: 5px}
.site-title { font-size: 12px; font-weight: 600; }
.top-nav  {display: flex; align-items: center;}
.top-nav img {height: 24px; width: auto; margin-left: 20px}
.top-nav img:hover { color: #fff; }

/* ===== 主体布局 ===== */
.main-container {
    display: flex;
    height: calc(100vh - 52px); /* 减去顶部栏 */
    overflow: hidden; /* 阻止整个页面滚动 */
}

/* 左侧 Sidebar 固定 */
.sidebar {
    width: 220px;
    height: 100%;
    padding: 16px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 24px;
    background-color: #191919;
    overflow-y: auto;       /* 左侧多内容可滚动 */
    flex-shrink: 0;         /* 不缩小 */
    -webkit-overflow-scrolling: touch;
}

.sidebar-section { display: flex; flex-direction: column; gap: 8px; }

.sidebar input {
    padding: 8px 12px;
    border-radius: 20px;
    border: none;
    font-size: 14px;
}

#tag-list  button{
    background-color: #363535;
    font-weight: bold;
    border-radius: 12px;
    border: none;
    color: white;
    padding: 8px 12px;
}

#tag-list button:hover{
    background-color: #40B5AD;
}

#clear-btn {
    background-color: #545454;
    font-weight: bold;
    border-radius: 12px;
    border: none;
    color: white;
    padding: 8px 12px;
}

#clear-btn:hover{
    background-color: teal;
}

/* 卡片区 grid */
.card-container {
    flex: 1;
    padding: 24px;
    height: 100%;
    box-sizing: border-box;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    grid-auto-rows: 1.5fr;
    gap: 32px;
    overflow-y: auto;       /* 卡片区独立滚动 */
    -webkit-overflow-scrolling: touch;
}

/* 卡片样式调整 */
.file-item {
    width: 500px;
    height: 500px;
    max-height: 100%;
    max-width: 100%;
    background-color: #2a2c2d;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 10px;
    box-sizing: border-box;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 0 ;
}
.file-item:hover { transform: translateY(-6px); box-shadow: 0 8px 16px rgba(0,0,0,0.3); }

.file-item .filename {
    text-align: center;
    font-weight: 600;
    word-break: break-word;
}

/* 图片适配 */
.file-item img {
    width: 100%;
    height: auto;
    cursor: pointer;
    border-radius: 6px;
}

/* 按钮 */
.file-item button, .file-item a {
    margin: 4px 2px;
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    background-color: #40B5AD;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    font-size: 14px;
}
.file-item button:hover, .file-item a:hover { background-color: #008080; }

/* ghfast 切换按钮 */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    margin-right: 8px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
    position: absolute;
    cursor: pointer;
    top:0; left:0; right:0; bottom:0;
    background-color: #ccc;
    transition:0.4s;
}
.slider:before {
    position:absolute; content:"";
    height:18px; width:18px; left:2px; bottom:2px;
    background-color:white; transition:0.4s;
}
input:checked + .slider { background-color:#2196F3; }
input:checked + .slider:before { transform: translateX(18px); }
.slider.round { border-radius:34px; }
.slider.round:before { border-radius:50%; }

/* modal */
.modal {
    position: fixed; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
    z-index: 10000;
    flex-direction: column;
}
.modal img { max-width: 90%; max-height: 90%; border-radius: 8px; }
.close-btn {
    position: absolute; top: 16px; right: 16px;
    background-color: rgba(0,0,0,0.5); color: #fff;
    border: none; border-radius: 50%; width: 32px; height: 32px;
    cursor: pointer; font-size: 18px; font-weight: 600;
}

/* 分页控件 */
.pagination-sidebar {
    display: flex;
    align-items: center;
    gap: 6px;
}
.pagination-sidebar button {
    padding: 6px 10px;
    border-radius: 6px;
    border: none;
    background-color: #40B5AD;
    color: #fff;
    cursor: pointer;
}
.pagination-sidebar input {
    width: 40px;
    text-align: center;
}

/* 全局滚动条美化 */
.card-container::-webkit-scrollbar {
    width: 6px;        /* 卡片区垂直滚动条宽度 */
}
.card-container::-webkit-scrollbar-thumb {
    background-color: rgba(64,181,173,0.6);
    border-radius: 3px;
}
.card-container::-webkit-scrollbar-track {
    background-color: rgba(255,255,255,0.05);
}

/* 左侧 sidebar 滚动条 */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-thumb {
    background-color: rgba(64,181,173,0.6);
    border-radius: 2px;
}
.sidebar::-webkit-scrollbar-track {
    background-color: rgba(255,255,255,0.05);
}

.sidebar-toggle { display: none; }

.sidebar, .card-container {padding-bottom: 54px }

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        height: calc(100vh - 52px);
        overflow: hidden;
    }

    .card-container {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* 抽屉式侧栏 */
    .sidebar {
        position: fixed;
        top: 55px;
        left: 0;
        width: 220px;
        height: calc(100% - 52px);
        transform: translateX(-100%);
        transition: transform 0.3s;
        z-index: 1000;
        overflow-y: auto;
    }
    .sidebar.open { transform: translateX(0); }

    /* 浮动按钮控制侧栏 */
    .sidebar-toggle {
        display: flex;
        position: fixed;
        top: 74px;
        left: 10px;
        z-index: 1100;
        background-color: #40B5AD;
        color: #fff;
        border-radius: 6px;
        padding: 6px 10px;
        border: none;
    }

    /* 遮罩层 */
    #sidebar-overlay {
        position: fixed;
        top: 0; left: 0; width: 100%; height: 100%;
        background-color: rgba(0,0,0,0.4);
        backdrop-filter: blur(6px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s;
        z-index: 999;
    }
    #sidebar-overlay.active { opacity: 1; pointer-events: auto; }
}
