/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* 全局变量 */
:root {
    --primary-color: #409eff;
    --success-color: #67c23a;
    --warning-color: #e6a23c;
    --danger-color: #f56c6c;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #303133;
    --text-secondary: #606266;
    --border-radius: 12px;
    --shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    padding-bottom: 80px;
}

/* 顶部导航栏 */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--card-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    padding: 0 16px;
    z-index: 999;
}

.menu-btn {
    width: 22px;
    height: 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-right: 16px;
}

.menu-btn span {
    width: 100%;
    height: 2px;
    background-color: var(--text-color);
    border-radius: 1px;
}

.search-box {
    flex: 1;
    height: 36px;
    background-color: var(--bg-color);
    border-radius: 18px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
}

.search-box input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    color: var(--text-color);
}

.header-title {
    font-size: 20px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.header-actions {
    display: flex;
    gap: 8px;
}

.refresh-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    color: var(--text-color);
}

/* 顶部操作按钮组（PC端） */
.top-buttons {
    display: flex;
    gap: 8px;
}

.top-btn {
    padding: 6px 12px;
    border: 1px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.top-btn:hover {
    background-color: var(--primary-color);
    color: #fff;
}

/* 暗黑模式切换按钮 */
.dark-mode-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.dark-mode-btn:hover {
    background: var(--bg-color);
}

/* 主内容区 */
.main-content {
    margin-top: 56px;
    padding: 16px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* API卡片网格布局 */
.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* API卡片样式 */
.api-card {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.api-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.15);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.card-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    background-color: var(--success-color);
}

.free-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    background-color: var(--success-color);
    margin-left: 4px;
}

.price-tag {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    background-color: var(--warning-color);
    margin-left: 4px;
    font-weight: 500;
}

.notify-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: #909399;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
}

.card-meta {
    padding: 0 20px 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}
.card-meta .status-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    background-color: var(--success-color);
}
.card-meta .free-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    background-color: var(--success-color);
}
.card-meta .price-tag {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
    background-color: var(--warning-color);
}
.card-count {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-desc {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    min-height: 40px;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cat-tag {
    font-size: 12px;
    color: #909399;
    border-radius: 4px;
}

.more-btn {
    padding: 6px 16px;
    background: transparent;
    border: none;
    color: var(--primary-color);
    font-size: 16px;
    cursor: pointer;
    border-radius: 4px;
    text-decoration: none;
    display: inline-block;
}

.more-btn:hover {
    background-color: rgba(64, 158, 255, 0.1);
}

/* 移动端底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--card-bg);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 999;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 12px;
}

.nav-item.active {
    color: var(--primary-color);
}

.nav-icon {
    font-size: 24px;
}

/* 移动端悬浮按钮 */
.float-buttons {
    position: fixed;
    right: 16px;
    bottom: 80px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.float-buttons.visible {
    opacity: 1;
    visibility: visible;
}

.float-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: none;
    cursor: pointer;
    color: #fff;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 深色模式样式 */
body.dark {
    --bg-color: #1e1e1e;
    --card-bg: #2d2d2d;
    --text-color: #ffffff;
    --text-secondary: #cccccc;
    --shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.3);
}

/* 响应式适配 */
@media (max-width: 840px) {
    .index_title{
        display: none;
    }
}
@media (max-width: 768px) {
    .api-grid {
        grid-template-columns: 1fr;
    }

    .header-title {
        display: none;
    }

    .top-buttons {
        display: none;
    }

    .search-box {
        max-width: 200px;
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }

    .float-buttons {
        display: none;
    }

    .header {
        padding: 0 24px;
    }

    .main-content {
        padding: 24px;
    }
}

/* 分类筛选栏 */
.category-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 12px 0;
    position: sticky;
    top: 60px;
    z-index: 100;
    background-color: var(--bg-color);
    transition: box-shadow 0.3s ease;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #c0c4cc transparent;
}

.category-bar::-webkit-scrollbar {
    height: 4px;
}

.category-bar::-webkit-scrollbar-thumb {
    background-color: #c0c4cc;
    border-radius: 2px;
}

.category-bar::-webkit-scrollbar-track {
    background: transparent;
}

.category-bar.sticky-shadow {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-bottom-color: transparent;
}

.category-btn {
    padding: 6px 16px;
    border: 1px solid #dcdfe6;
    background: var(--card-bg);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.category-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

body.dark .category-bar {
    border-bottom-color: #4a4a4a;
}

body.dark .category-btn {
    border-color: #555;
    background: var(--card-bg);
    color: var(--text-secondary);
}

body.dark .category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

body.dark .category-btn.active {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* 搜索框内搜索按钮 */
.search-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: var(--primary-color);
    color: #fff;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 13px;
    padding: 0;
}

.search-btn:hover {
    opacity: 0.8;
}

.search-box {
    max-width: 420px;
}

/* 侧滑菜单遮罩 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* 侧滑菜单 */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--card-bg);
    z-index: 1001;
    transition: left 0.3s ease;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #e4e7ed;
    font-size: 18px;
    font-weight: 600;
}

.sidebar-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 15px;
    transition: background 0.2s;
}

.sidebar-item:hover {
    background: var(--bg-color);
}

.sidebar-item.active {
    color: var(--primary-color);
    background: rgba(64, 158, 255, 0.1);
}

.sidebar-item .icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
}

body.dark .sidebar {
    border-right-color: #4a4a4a;
}

body.dark .sidebar-header {
    border-bottom-color: #4a4a4a;
}

/* API说明弹窗 */
.notice-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.notice-overlay.open {
    display: flex;
}

.notice-modal {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    max-height: 70vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.notice-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e4e7ed;
}

.notice-title {
    font-size: 16px;
    font-weight: 600;
}

.notice-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.notice-close:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.notice-body {
    padding: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.8;
    overflow-y: auto;
}

.notice-body b {
    color: var(--text-color);
}

.notice-body code {
    background: var(--bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    color: var(--primary-color);
}

body.dark .notice-header {
    border-bottom-color: #4a4a4a;
}

/* 友情链接区域 */
.friend-links {
    margin-top: 20px;
    padding: 20px 24px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.friend-links-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e4e7ed;
}

.friend-links-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.friend-link-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid #dcdfe6;
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    background: var(--bg-color);
}

.friend-link-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(64, 158, 255, 0.05);
}

body.dark .friend-links {
    border-color: #4a4a4a;
}

body.dark .friend-links-title {
    border-bottom-color: #4a4a4a;
}

body.dark .friend-link-item {
    border-color: #555;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

body.dark .friend-link-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: rgba(64, 158, 255, 0.1);
}

/* 公告轮播 */
.notice-carousel {
    background: var(--card-bg);
    border: 1px solid #e4e7ed;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    overflow: hidden;
    height: 48px;
}
.carousel-track {
    display: flex;
    flex-direction: column;
    transition: transform 0.5s ease;
}
.carousel-item {
    height: 48px;
    line-height: 48px;
    padding: 0 20px;
    font-size: 14px;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.carousel-item a { color: var(--primary-color); text-decoration: none; }
.carousel-item a:hover { text-decoration: underline; }
body.dark .notice-carousel {
    background: var(--card-bg);
    border-color: #4a4a4a;
}
body.dark .carousel-item { color: var(--text-color); }
body.dark .carousel-item a { color: #66b1ff; }