/* =========================================
   模块 1：基础变量与重置 (Base & Variables)
   功能：定义主题色、深浅模式切换、基础标签重置、全局动画
   ========================================= */

/* --- 1.1 全局 CSS 变量 (亮色模式默认值) --- */
:root {
    --primary-hue: 210;
    --primary-sat: 70%;
    --primary-light: 52%;
    --primary-color: hsl(var(--primary-hue), var(--primary-sat), var(--primary-light));
    --primary-fade: hsl(var(--primary-hue), 60%, 94%);

    --bg-body: #f5f7fa !important;
    --bg-card: #ffffff !important;
    --bg-glass: rgba(255, 255, 255, 0.85) !important;
    --text-main: #1d1d1f !important;
    --text-sub: #6e6e73 !important;
    --border: #e5e5e7 !important;
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.06) !important;
    
    --radius: 20px;
    --green-pwd: #34c759;
}

/* --- 1.2 深色模式控制 --- */
/* 手动触发的深色模式 */
body.dark-mode {
    --bg-body: #000000 !important;
    --bg-card: #1c1c1e !important;
    --bg-glass: rgba(28, 28, 30, 0.85) !important;
    --text-main: #f5f5f7 !important;
    --text-sub: #8e8e93 !important;
    --border: #2c2c2e !important;
    --primary-fade: hsl(var(--primary-hue), 40%, 20%) !important;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
}

/* 跟随系统原生的深色模式 */
@media (prefers-color-scheme: dark) {
    :root:not([data-manual-theme]) {
        --bg-body: #000000 !important;
        --bg-card: #1c1c1e !important;
        --bg-glass: rgba(28, 28, 30, 0.85) !important;
        --text-main: #f5f5f7 !important;
        --text-sub: #8e8e93 !important;
        --border: #2c2c2e !important;
        --primary-fade: hsl(var(--primary-hue), 40%, 20%) !important;
        --shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    }
}

/* --- 1.3 全局标签重置 (Reset) --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-body);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease !important;
}

/* 强制核心区块继承主题背景 (防止深色模式下有白块) */
.sidebar, .main-view, .modal-box, .card, .search-wrap, .weather-panel, .setting-group, .profile-user-card {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    border-color: var(--border) !important;
}

/* 强制表单元素继承主题背景 */
input, button, select, textarea {
    background: var(--bg-card) !important;
    color: var(--text-main) !important;
    border-color: var(--border) !important;
}

/* 隐藏浏览器原生滚动条 */
::-webkit-scrollbar {
    display: none;
}

/* --- 1.4 全局动画库 (Keyframes) --- */
@keyframes popIn {
    from { opacity: 0; transform: scale(0.9) translateY(10px) }
    to { opacity: 1; transform: scale(1) translateY(0) }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(15px) }
    to { opacity: 1; transform: translateY(0) }
}
@keyframes fadeIn {
    from { opacity: 0 }
    to { opacity: 1 }
}

/* =========================================
   模块 2：公共组件 (Components)
   功能：按钮、输入框、表单基础、标签等全站复用元素
   ========================================= */

/* --- 2.1 表单与输入框 --- */
.input-stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 10px;
}

.login-field-pro {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    font-size: 16px;
    outline: none;
    transition: all 0.2s;
    color: var(--text-main);
    height: 48px;
}

/* --- 2.2 按钮体系 --- */
/* 主按钮 (蓝底白字) */
.btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    background: var(--primary-color);
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    transition: 0.2s;
}

.btn-primary:active {
    opacity: 0.8;
    transform: scale(0.98);
}

/* 次按钮 (白底灰边/悬浮变蓝) */
.btn-secondary {
    padding: 8px 20px;
    border-radius: 99px;
    background: var(--bg-body);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 退出/警告按钮 (红底红字) */
.btn-logout {
    background-color: rgba(255, 59, 48, 0.1); 
    color: #ff3b30; 
    border: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-logout:hover {
    background-color: #ff3b30; 
    color: #ffffff;
}

body.dark-mode .btn-logout {
    background-color: rgba(255, 69, 58, 0.15);
    color: #ff453a;
}

body.dark-mode .btn-logout:hover {
    background-color: #ff453a;
    color: #ffffff;
}

/* --- 2.3 标签与小图标 --- */
/* 平台选择胶囊标签 (Win/Mac/Android) */
.plat-tag {
    padding: 8px 20px;
    border-radius: 99px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-sub);
    white-space: nowrap;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: 0.2s;
}

.plat-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.plat-tag.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 10px rgba(var(--primary-hue), 70%, 50%, 0.3);
}

/* 搜索结果文字高亮 */
mark {
    background-color: var(--primary-fade);
    color: var(--primary-color);
    padding: 0 2px;
    border-radius: 4px;
}

.icon-svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
    margin-right: 6px;
}

/* =========================================
   模块 3：宏观布局 (Layout)
   功能：侧边栏、顶部导航、主内容区、移动端底部导航
   ========================================= */

/* --- 3.1 页面基础分栏 --- */
/* 左侧边栏 (桌面端) */
.sidebar {
    width: 260px;
    background: var(--bg-glass);
    border-right: 1px solid var(--border);
    padding: 50px 24px;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(30px);
    flex-shrink: 0;
}

.sidebar-title {
    margin-bottom: 40px;
    padding-left: 10px;
    font-weight: 800;
    font-size: 24px;
}

.sidebar-footer {
    margin-top: auto !important;
}

/* 右侧主内容区 */
.main-view {
    flex: 1;
    position: relative;
    overflow-y: auto;
    padding: 30px 50px;
    scroll-behavior: smooth;
}

/* --- 3.2 顶部工具栏 (Header) --- */
.header-bar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

/* 搜索框包装区 */
.search-wrap {
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: 99px;
    border: none;
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 450px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-wrap:focus-within {
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-fade);
    background: var(--bg-card);
}

.search-icon {
    color: var(--text-sub);
    margin: 0 10px;
}

#search-input {
    border: none !important;
    background: transparent !important;
    outline: none !important;
    flex: 1;
    font-size: 15px;
    color: var(--text-main);
    caret-color: var(--text-main);
}

/* 解决浏览器输入框自动填充白色背景的 bug */
#search-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-card) inset !important;
    -webkit-text-fill-color: var(--text-main) !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* 右上角控件组 (天气、主题切换、登录) */
.controls-group {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.weather-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 8px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    color: var(--text-main);
}

.theme-toggle-btn {
    background: var(--bg-card) !important;
    border: 1px solid var(--border) !important;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0;
}

.theme-toggle-btn::after {
    content: '🌙';
    font-size: 16px;
}

body.dark-mode .theme-toggle-btn::after {
    content: '☀️';
}

.auth-btn {
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-text {
    font-weight: 600;
    font-size: 13px;
    color: var(--primary-color);
}

/* --- 3.3 导航系统 --- */
/* 桌面端侧边菜单按钮 */
.nav-btn {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 8px;
    cursor: pointer;
    color: var(--text-sub);
    display: flex;
    align-items: center;
    gap: 14px;
    font-weight: 600;
    transition: 0.2s;
}

.nav-btn:hover {
    background: var(--bg-body);
    color: var(--text-main);
}

.nav-btn.active {
    background: var(--primary-fade);
    color: var(--primary-color);
}

/* 移动端底部菜单栏 (默认隐藏) */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 90px;
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-glass);
    backdrop-filter: blur(30px);
    border-top: 1px solid var(--border);
    justify-content: space-around;
    padding-top: 12px;
    z-index: 100;
}

.tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-sub);
    cursor: pointer;
    width: 60px;
    font-weight: 600;
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
    transition: 0.2s;
}

.tab-btn.active svg {
    transform: translateY(-2px);
}

/* 底部 ICP 备案号 */
.footer-icp {
    margin-top: 40px;
    text-align: center;
    color: var(--text-sub);
    font-size: 12px;
    padding-bottom: 20px;
}

/* =========================================
   模块 4：内容展示 (Content)
   功能：特定页面的卡片、轮播图、个人中心、列表
   ========================================= */

/* --- 4.1 页面视图切换通用 --- */
.page {
    display: none;
    animation: slideUp 0.4s ease;
}

.page.active {
    display: block;
}

.page-title {
    margin-bottom: 20px;
}

/* --- 4.2 首页专属：Banner 轮播与横向滚动 --- */
.banner {
    height: 200px;
    border-radius: var(--radius);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.banner-item {
    width: 100%;
    height: 100%;
    position: absolute;
    background-size: cover;
    background-position: center;
    transition: opacity 0.6s ease;
    opacity: 0;
    display: flex;
    align-items: flex-end;
    padding: 40px;
}

.banner-item.active {
    opacity: 1;
}

.banner-txt {
    text-align: left;
    max-width: 80%;
}

.banner-txt h2 {
    color: #fff;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    line-height: 1.2;
}

.banner-txt p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    line-height: 1.5;
    transform: translateY(10px);
    opacity: 0;
    transition: all 0.6s ease 0.2s;
}

.banner-item.active .banner-txt p {
    transform: translateY(0);
    opacity: 1;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 15px;
}

.section-title {
    font-size: 20px;
    margin: 0;
}

.section-subtitle {
    font-weight: 400;
    font-size: 13px;
    color: var(--text-sub);
}

.view-all-link {
    cursor: pointer;
    color: var(--primary-color);
    font-size: 13px;
    font-weight: 600;
}

.h-scroll {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 5px 5px 30px 5px;
    scroll-snap-type: x mandatory;
}

/* --- 4.3 通用资源卡片 (.card) --- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 160px;
    scroll-snap-align: start;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: 1px solid transparent;
    position: relative;
}

@media (min-width: 769px) {
    .card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
        border-color: var(--primary-fade)
    }
    .card:hover .get-btn {
        background: var(--primary-color);
        color: #fff
    }
}

.card:active {
    transform: scale(0.98);
}

.icon-box {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    margin-bottom: 16px;
    display: grid;
    place-items: center;
    font-size: 36px;
    color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.c-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text-main);
}

.c-sub {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.get-btn {
    background: var(--primary-fade);
    color: var(--primary-color);
    border: none;
    padding: 8px 24px;
    border-radius: 99px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: 0.2s;
}

/* --- 4.4 分类页专属：分类过滤与网格 --- */
.type-switch {
    display: flex;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 16px;
    width: fit-content;
    margin-bottom: 24px;
}

.type-opt {
    padding: 10px 32px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sub);
    transition: 0.2s;
}

.type-opt.active {
    background: var(--bg-body);
    color: var(--text-main);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.platform-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.platform-bar.hidden {
    display: none !important;
}

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.page-btn {
    padding: 10px 18px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: var(--primary-fade);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.page-info {
    font-weight: 600;
    color: var(--text-sub);
    padding: 0 10px;
}

/* --- 4.5 个人中心全新布局 --- */
.profile-cover {
    height: 200px; 
    background: linear-gradient(120deg, #89f7fe 0%, #66a6ff 100%); 
    border-radius: 20px;
    position: relative;
    z-index: 1;
}

body.dark-mode .profile-cover {
    background: linear-gradient(120deg, #2c3e50 0%, #3498db 100%);
}

.profile-layout {
    display: flex;
    gap: 24px;
    position: relative;
    z-index: 2;
    padding: 0 10px;
    margin-top: -70px;
    align-items: flex-start;
}

.profile-sidebar {
    width: 320px; 
    flex-shrink: 0;
}

.profile-user-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 35px 24px 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

body.dark-mode .profile-user-card {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.profile-avatar-img {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 5px solid var(--bg-card); 
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 15px;
    background: var(--bg-card);
    object-fit: cover;
}

.header-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    object-fit: cover;
}

.profile-stats {
    display: flex;
    justify-content: center;
    gap: 40px; 
    margin: 20px 0 30px;
    width: 100%;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-main);
}

.stat-label {
    font-size: 13px;
    color: var(--text-sub);
    margin-top: 4px;
}

.profile-actions {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-btn {
    width: 100%;
    margin: 0 !important;
}

.profile-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0; 
}

.setting-group {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border);
    margin-bottom: 20px;
    overflow: hidden;
    width: 100%; 
}

body.dark-mode .setting-group {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.setting-group .list-card {
    padding: 18px 24px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-main);
}

.setting-group .list-card:hover {
    background: var(--primary-fade);
    padding-left: 30px;
}

.setting-group .list-card:last-child {
    border-bottom: none;
}

.list-icon {
    font-size: 20px;
    margin-right: 15px;
    width: 24px;
    text-align: center;
}

.list-text {
    font-weight: 600;
    color: var(--text-main);
    font-size: 15px;
}

.card-arrow {
    margin-left: auto;
    color: var(--text-sub);
    font-size: 12px;
}

#my-submission-link, .profile-edit-btn, .admin-entry-btn {
    display: none;
}

/* --- 4.6 提交历史记录页 --- */
.page-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.back-btn {
    font-size: 20px;
    cursor: pointer;
    margin-right: 15px;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: var(--text-sub);
    display: none;
}

.status-overlay {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    z-index: 5;
}

.status-overlay.pending { background: #f1c40f; }
.status-overlay.published { background: #34c759; }
.status-overlay.rejected { background: #ff3b30; }

.user-delete-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: rgba(255, 59, 48, 0.8);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
}

.user-delete-btn:hover {
    background: #ff3b30;
    transform: scale(1.05);
}

/* =========================================
   模块 5：弹窗系统 (Modals & Overlays)
   功能：悬浮按钮、各类提示弹窗、提交资源表单
   ========================================= */

/* --- 5.1 悬浮动作按钮 (FAB) --- */
.fab {
    position: fixed;
    right: 40px;
    bottom: 40px;
    width: 56px;
    height: 56px;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 300;
    box-shadow: 0 8px 25px rgba(var(--primary-hue), 70%, 50%, 0.3);
    cursor: pointer;
    z-index: 999;
    transition: all 0.2s ease-in-out;
}

.fab:hover {
    transform: scale(1.08);
    box-shadow: 0 12px 30px rgba(var(--primary-hue), 70%, 50%, 0.4);
}

.fab:active {
    transform: scale(0.95);
}

/* --- 5.2 基础弹窗框架 --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s;
    transition: opacity 0.3s ease;
}

.modal-box {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 24px;
    width: 85%;
    max-width: 340px;
    text-align: center;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: popIn 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    border: 1px solid var(--border);
}

.modal-cancel {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-sub);
    cursor: pointer;
    text-align: center;
}

.modal-action {
    margin-top: 25px;
}

/* --- 5.3 网盘密码与提示类弹窗 --- */
.pwd-box {
    border: 1px dashed var(--green-pwd);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    color: var(--text-main);
    font-size: 16px;
    background: rgba(52, 199, 89, 0.05);
    font-family: monospace;
}

.copy-tip {
    font-size: 12px;
    color: var(--text-sub);
    margin-bottom: 15px;
    display: none;
}

.tip-modal-box {
    max-width: 300px;
    padding-top: 35px;
}

.tip-icon {
    font-size: 48px;
    margin-bottom: 15px;
    text-align: center;
}

.tip-title, .notify-title {
    font-size: 19px;
    font-weight: 700;
    margin-bottom: 10px;
    text-align: center;
}

.tip-message, .notify-message {
    font-size: 14px;
    color: var(--text-sub);
    line-height: 1.5;
    margin-bottom: 25px;
    text-align: center;
}

.notify-modal {
    max-width: 320px;
    padding: 35px 25px;
}

.notify-icon {
    font-size: 52px;
    margin-bottom: 15px;
    text-align: center;
}

.notify-btn { width: 100%; }
#notify-ok-btn.success { background: #34c759; }
#notify-ok-btn.error { background: #ff3b30; }

/* --- 5.4 复杂表单弹窗 (资源提交 / 资料编辑) --- */
.admin-modal-box {
    background: var(--bg-card);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--border);
    padding: 30px;
    border-radius: 24px;
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow);
    animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: block;
    color: var(--text-main);
}

.profile-edit-modal { max-width: 400px; }

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close-btn { cursor: pointer; }

.submission-description {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 20px;
}

.form-top-grid {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* 图片上传区域 */
.upload-zone {
    width: 100px;
    height: 100px;
    border-radius: 22px;
    background: var(--bg-body);
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
}

.avatar-upload { border-radius: 50%; }

.upload-zone:hover {
    border-color: var(--primary-color);
    background: var(--primary-fade);
}

.upload-zone img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.upload-icon {
    font-size: 24px;
    margin-bottom: 5px;
    color: var(--text-sub);
}

.upload-text {
    font-size: 10px;
    color: var(--text-sub);
}

.file-input { display: none; }

/* 颜色/下拉框杂项 */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    padding: 8px 15px;
    border-radius: 12px;
    border: 1px solid transparent;
    margin-top: 10px;
}

.select-wrapper { position: relative; }
.select-field { appearance: none; cursor: pointer; }
.profile-input-stack { justify-content: center; }

/* 平台链接输入网格 */
.plat-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: var(--bg-body);
    padding: 15px;
    border-radius: 16px;
    border: 1px solid var(--border);
    margin-bottom: 15px;
}

.plat-full { grid-column: span 2; }

.plat-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.plat-icon-label {
    position: absolute;
    left: 12px;
    font-size: 16px;
    opacity: 0.8;
    z-index: 2;
}

.plat-input-field {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    font-size: 13px;
    outline: none;
    transition: 0.2s;
    color: var(--text-main);
}

.plat-input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-fade);
}

.profile-edit-note {
    font-size: 12px;
    color: var(--text-sub);
    text-align: center;
    margin-bottom: 20px;
}

.form-error-text {
    color: #ff3b30;
    font-size: 13px;
    font-weight: 500;
    text-align: left;
    margin-top: 5px;
    min-height: 1.2em;
    display: none;
}

/* =========================================
   模块 6：响应式布局 (Responsive)
   功能：处理桌面端与移动端的差异化排版
   ========================================= */

/* --- 6.1 桌面端增强 --- */
@media (min-width: 769px) {
    .mobile-only { display: none !important }
    .desktop-only { display: flex !important }
    
    .header-bar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .controls-group {
        width: auto;
        justify-content: flex-end;
        gap: 12px;
    }
}

/* --- 6.2 移动端核心适配 --- */
@media (max-width: 768px) {
    /* 隐藏左侧栏，显示底部导航栏 */
    .sidebar { display: none; }
    .mobile-nav { display: flex; }
    .desktop-only { display: none !important; }
    .mobile-only { display: flex !important; }
    
    /* 缩小主视图边距，给底部导航留出空间 */
    .main-view { padding: 15px 15px 100px 15px; }
    
    /* 顶部工具栏紧凑化 */
    .header-bar { gap: 10px; margin-bottom: 15px; }
    .search-wrap { width: 100%; height: 40px; }
    
    .controls-group {
        width: 100%;
        justify-content: space-between;
        gap: 5px;
    }
    
    .weather-panel {
        padding: 5px 10px;
        font-size: 12px;
        height: 36px;
        max-width: 45%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .controls-group>div:last-child { gap: 8px; }
    
    /* 首页的卡片由横向滚动变为纵向堆叠 */
    #home-apps, #home-disk, #home-webs {
        flex-direction: column !important;
        overflow-x: visible !important;
        padding-bottom: 0 !important;
        gap: 15px !important;
    }
    
    /* 卡片变成横向长条状 */
    .card {
        min-width: 100% !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        padding: 14px !important;
        border-radius: 18px !important;
    }
    
    .icon-box {
        margin-bottom: 0 !important;
        margin-right: 15px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
    }
    
    .card-content { flex: 1 !important; }
    
    .get-btn {
        margin-top: 0 !important;
        margin-left: 10px !important;
        padding: 6px 16px !important;
        font-size: 12px !important;
    }
    
    /* 分类页平台标签撑满 */
    .platform-bar { justify-content: space-between; }
    .plat-tag {
        padding: 8px 12px !important;
        flex: 1;
        justify-content: center;
        margin: 0 4px;
        font-size: 12px !important;
    }
    
    /* 资源库网格变单列 */
    .grid-list { grid-template-columns: 1fr; gap: 15px; }
    
    /* 悬浮按钮上移，防止被底部导航挡住 */
    .fab { right: 20px; bottom: 110px; }
    
    .section-header { margin: 20px 0 15px; }
    
    /* 个人中心适配*/
    .profile-layout {
        flex-direction: column;
        padding: 0;
        align-items: stretch; 
    }
    
    .profile-sidebar, .profile-main {
        width: 100%; /* 确保手机端绝对 100% 宽度 */
    }
    
    .setting-group {
        margin-bottom: 15px;
    }
    
    .profile-edit-btn, .admin-entry-btn {
        padding: 6px 16px;
        font-size: 13px;
    }
}

/* =========================================
   头像框通用容器与层级样式
   ========================================= */
.avatar-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 预留一点空间给外扩的头像框，防止被 overflow:hidden 裁剪 */
    padding: 4px; 
}

/* 确保内部的真实头像保持完美的圆形裁剪 */
.avatar-container img:not(.avatar-frame) {
    border-radius: 50%;
    object-fit: cover;
}

/* 头像框核心图层 */
.avatar-frame {
    position: absolute;
    top: 50%;
    left: 50%;
    /* 头像框通常需要比原头像稍大（如 115% ~ 125%），包裹感才更好 */
    width: 122%;  
    height: 122%;
    transform: translate(-50%, -50%);
    
    /* 💡 核心：允许鼠标事件穿透头像框，绝不影响下方头像的点击事件 */
    pointer-events: none; 
    z-index: 2;
}

/* =========================================
   中间大头像框专属完美对齐样式
   ========================================= */
.main-avatar-wrapper {
    position: relative !important;
    width: 90px;         /* 严格与你原本大头像的宽度保持一致 */
    height: 90px;        /* 严格与你原本大头像的高度保持一致 */
    margin: 0 auto 15px; /* 居中对齐，并和下方用户名留出 15px 间距 */
    overflow: visible !important; /* 🌟 极重要：允许头像框比头像大并溢出显示 */
}

/* 圆形头像本身 */
#profile-avatar {
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block;
}

/* 覆盖在最上层的透明头像框 */
.avatar-frame {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important; /* 保持绝对居中 */
    
    width: 138% !important;  /* 👈 从 124% 改为 138% */
    height: 138% !important; /* 👈 从 124% 改为 138% */
    
    pointer-events: none !important;
    z-index: 10 !important;
}