/* ============================================================
   OKSticker 商城 - 统一样式文件
   适用于 index.php 和 admin.php
   ============================================================ */

/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    background: #f5f6fa;
    color: #2d3436;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== 顶部导航（通用） ===== */
/* ===== 顶部导航 ===== */
.top-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 20px rgba(102, 126, 234, 0.3);
}

.top-bar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
    flex-wrap: wrap;
    gap: 8px;
}

/* 品牌 Logo */
.top-bar .logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    flex-shrink: 0;
}

.top-bar .logo span {
    font-weight: 300;
    opacity: 0.8;
    font-size: 14px;
}

/* 导航链接 - 居中 */
.top-bar .nav-links {
    display: flex;
    gap: 20px;
    font-size: 14px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
    justify-content: center;
}

.top-bar .nav-links a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: opacity 0.3s;
    white-space: nowrap;
}

.top-bar .nav-links a:hover {
    opacity: 1;
    color: #fff;
}

.top-bar .nav-links a.active {
    color: #fff;
    font-weight: 600;
    opacity: 1;
}

/* 购物车徽标 */
.cart-badge {
    background: #e17055;
    color: #fff;
    border-radius: 50%;
    padding: 0 5px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
    display: inline-block;
    line-height: 16px;
    position: absolute;
    top: -6px;
    right: -10px;
}

.cart-link {
    position: relative;
}

/* 语言切换 - 靠右 */
.top-bar .lang-group {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    margin-left: auto;
}

.top-bar .lang-group .lang-btn {
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
    background: transparent;
}

.top-bar .lang-group .lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

.top-bar .lang-group .lang-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.5);
}

/* 统计信息（隐藏在移动端） */
.top-bar .stats {
    display: flex;
    gap: 12px;
    font-size: 13px;
    flex-wrap: wrap;
    align-items: center;
}

.top-bar .stats .stat-item {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 14px;
    border-radius: 20px;
}

.top-bar .stats .stat-item a {
    color: #fff;
    text-decoration: none;
}

/* 菜单切换按钮（移动端显示） */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ===== 桌面端样式 ===== */
@media (min-width: 769px) {
    .menu-toggle {
        display: none !important;
    }
    
    .top-bar .container {
        flex-wrap: nowrap;
    }
    
    .top-bar .nav-links {
        flex: 1;
        justify-content: center;
    }
}

/* ===== 手机端样式 ===== */
@media (max-width: 768px) {
    .top-bar .container {
        flex-wrap: wrap;
        padding: 0 12px;
        gap: 6px;
    }
    
    .top-bar .logo {
        font-size: 17px;
        flex: 1;
    }
    
    .top-bar .logo span {
        font-size: 12px;
    }
    
    .top-bar .nav-links {
        order: 3;
        flex: 0 0 100%;
        justify-content: center;
        gap: 12px;
        padding-top: 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .top-bar .nav-links a {
        font-size: 13px;
    }
    
    .top-bar .lang-group .lang-btn {
        font-size: 11px;
        padding: 2px 8px;
    }
    
    .top-bar .stats {
        display: none;
    }
    
    .menu-toggle {
        display: block !important;
        order: 0;
    }
    
    .top-bar .lang-group {
        order: 2;
    }
}

@media (max-width: 480px) {
    .top-bar .logo {
        font-size: 15px;
    }
    
    .top-bar .logo span {
        font-size: 11px;
    }
    
    .top-bar .nav-links {
        gap: 8px;
    }
    
    .top-bar .nav-links a {
        font-size: 12px;
    }
    
    .top-bar .lang-group .lang-btn {
        font-size: 10px;
        padding: 2px 6px;
    }
}
/* ===== 一级分类导航 ===== */
.category-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding: 0 0 12px 0;
    border-bottom: 2px solid #f0f0f0;
    align-items: center;
}

.category-tabs .cat-tab {
    padding: 6px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: #888;
    background: #f5f6fa;
    transition: all 0.3s ease;
    text-decoration: none;
    white-space: nowrap;
    border: none;
    cursor: pointer;
}

.category-tabs .cat-tab:hover {
    background: #e8ecff;
    color: #667eea;
    transform: translateY(-1px);
}

.category-tabs .cat-tab.active {
    background: #667eea;
    color: #fff;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}

/* ===== 分类导航与标题的配合 ===== */
.category-tabs + .section-header {
    margin-top: 8px;
}

.category-tabs + .section-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.category-tabs + .section-header h2 .sort-label {
    font-size: 14px;
    font-weight: 400;
    color: #888;
    margin-left: 8px;
}

@media (max-width: 768px) {
    .category-tabs {
        gap: 4px;
        padding: 0 0 10px 0;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        display: flex;
    }
    .category-tabs::-webkit-scrollbar {
        display: none;
    }
    .category-tabs .cat-tab {
        font-size: 13px;
        padding: 4px 14px;
        flex-shrink: 0;
    }
    .category-tabs + .section-header h2 {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .category-tabs .cat-tab {
        font-size: 12px;
        padding: 3px 12px;
    }
}
/* ===== 购物车徽标 ===== */
.cart-badge {
    background: #e17055;
    color: #fff;
    border-radius: 50%;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    text-align: center;
    display: inline-block;
    line-height: 18px;
    position: absolute;
    top: -8px;
    right: -12px;
}

.cart-link {
    position: relative;
}

/* ===== 浮动购物车按钮 ===== */
.float-cart {
    position: fixed;
    bottom: 90px;
    right: 30px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.float-cart .cart-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.float-cart .cart-btn:hover {
    transform: scale(1.08);
}

.float-cart .cart-btn .badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #e17055;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border: 2px solid #fff;
}

.float-cart .cart-label {
    font-size: 11px;
    color: #888;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* ===== 回到顶部 ===== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #667eea;
    color: #fff;
    border: none;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
    z-index: 999;
}

.back-to-top:hover {
    transform: scale(1.08);
}

/* ===== 搜索横幅（首页） ===== */
.hero-section {
    background: linear-gradient(135deg, #f8f9ff 0%, #eef1ff 100%);
    padding: 25px 0 20px;
    border-bottom: 1px solid #e8ecf1;
}

.hero-section .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.hero-section h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.hero-section p {
    color: #888;
    font-size: 15px;
    margin-bottom: 14px;
}

.hero-section .search-box {
    display: flex;
    width: 100%;
    max-width: 520px;
    gap: 8px;
}

.hero-section .search-box input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #dfe6e9;
    border-radius: 30px;
    font-size: 15px;
    outline: none;
    background: #fff;
}

.hero-section .search-box input:focus {
    border-color: #667eea;
}

.hero-section .search-box button {
    padding: 12px 28px;
    border: none;
    border-radius: 30px;
    background: #667eea;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

.hero-section .search-box button:hover {
    background: #5a6fd6;
}

/* ===== 主体布局 ===== */
.main-layout {
    display: flex;
    gap: 24px;
    padding: 20px 0 30px;
    align-items: flex-start;
}

/* ===== 侧边栏 ===== */
.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: #fff;
    border-radius: 12px;
    padding: 12px 0 16px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 130px;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.sidebar .sidebar-title {
    padding: 0 16px 10px;
    font-size: 16px;
    font-weight: 700;
    border-bottom: 2px solid #f0f0f0;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar .sidebar-title .close-sidebar {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #888;
}

.sidebar .count-badge {
    font-size: 11px;
    color: #999;
    font-weight: 400;
    margin-left: 4px;
}

.sidebar .tree-link.active .count-badge {
    color: #667eea;
}

/* ===== 树形菜单 ===== */
.tree-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-menu .tree-item,
.tree-menu .tree-item-top {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-menu .tree-item-top>.tree-node {
    padding: 8px 12px 8px 16px;
    font-weight: 700;
    font-size: 15px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafbff;
}

.tree-menu .tree-item-top>.tree-node .tree-link {
    color: #2d3436;
    font-size: 15px;
}

.tree-menu .tree-item-top>.tree-node .tree-link:hover {
    color: #667eea;
}

.tree-menu .tree-item .tree-node {
    display: flex;
    align-items: center;
    padding: 4px 8px 4px 16px;
    border-radius: 4px;
    transition: background 0.2s;
    cursor: pointer;
    min-height: 30px;
}

.tree-menu .tree-item .tree-node:hover {
    background: #f0f2ff;
}

.tree-menu .tree-item .tree-node.active {
    background: #e8ecff;
}

.tree-menu .tree-item .tree-node .tree-link.active {
    color: #667eea;
    font-weight: 600;
}

.tree-menu .tree-node .toggle-icon {
    display: inline-block;
    width: 22px;
    font-size: 12px;
    color: #888;
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    text-align: center;
    transition: transform 0.3s;
}

.tree-menu .tree-node .toggle-icon.leaf {
    color: #ccc;
    cursor: default;
}

.tree-menu .tree-node .toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.tree-menu .tree-node .tree-link {
    flex: 1;
    padding: 2px 8px;
    font-size: 14px;
    color: #2d3436;
    border-radius: 4px;
    transition: color 0.2s;
}

.tree-menu .tree-node .tree-link:hover {
    color: #667eea;
}

.tree-menu .tree-children {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

/* ===== 侧边栏遮罩 ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== 内容区 ===== */
.content {
    flex: 1;
    min-width: 0;
}

/* ===== 内容区标题 ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #2d3436;
}

.section-header h2 .sort-label {
    font-size: 14px;
    font-weight: 400;
    color: #888;
    margin-left: 8px;
}

.section-header .count {
    font-size: 14px;
    color: #888;
}

/* 分类导航与标题之间的间距 */
.category-tabs + .section-header {
    margin-top: 4px;
}

/* ===== 商品网格 ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

/* ===== 商品卡片 ===== */
.product-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.product-card .image-wrapper {
    position: relative;
    padding-top: 100%;
    background: #f7f8fc;
    overflow: hidden;
}

.product-card .image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.product-card:hover .image-wrapper img {
    transform: scale(1.04);
}

.product-card .image-wrapper .placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #b2bec3;
    font-size: 14px;
}

.product-card .product-info {
    padding: 12px 14px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.product-card .product-info .name {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
    color: #2d3436;
}

.product-card .product-info .category-tag {
    font-size: 11px;
    color: #888;
    margin-top: 4px;
    display: inline-block;
    background: #f0f0f0;
    padding: 1px 10px;
    border-radius: 12px;
    align-self: flex-start;
}

.product-card .product-info .sales {
    font-size: 13px;
    color: #e17055;
    font-weight: 600;
    margin-top: 6px;
}

.product-card .product-info .sales::before {
    content: "🔥 ";
}

/* ===== 加入购物车按钮 ===== */
.add-to-cart-btn {
    width: 100%;
    padding: 8px 0;
    margin-top: 10px;
    border: none;
    border-radius: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-to-cart-btn:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.4);
}

.add-to-cart-btn:active {
    transform: scale(0.95);
}

.add-to-cart-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.add-to-cart-btn.added {
    background: #00b894;
}

/* ===== 分页 ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 30px;
    flex-wrap: wrap;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid #dfe6e9;
    border-radius: 6px;
    background: #fff;
    color: #2d3436;
    transition: all 0.2s;
    font-size: 14px;
    min-width: 40px;
    text-align: center;
}

.pagination a:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.pagination .active {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
    cursor: default;
}

.pagination .disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .ellipsis {
    border: none;
    background: transparent;
    cursor: default;
}

/* ===== 无数据 ===== */
.no-products {
    text-align: center;
    padding: 60px 20px;
    color: #b2bec3;
    font-size: 16px;
    grid-column: 1 / -1;
}

.no-products .icon {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
}

/* ===== Toast提示 ===== */
.toast {
    position: fixed;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    background: #2d3436;
    color: #fff;
    padding: 12px 30px;
    border-radius: 30px;
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: fadeInUp 0.3s ease;
    transition: opacity 0.3s ease;
}

.toast.hide {
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ===== 底部 ===== */
.footer {
    background: #2d3436;
    color: #b2bec3;
    padding: 20px 0;
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
}

.footer .container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer a {
    color: #dfe6e9;
}

.footer a:hover {
    color: #fff;
}

/* ============================================================
   admin.php 专用样式
   ============================================================ */

.admin-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 14px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.admin-header .logo {
    font-size: 22px;
    font-weight: 700;
}

.admin-header .logo span {
    font-weight: 300;
    opacity: 0.8;
    font-size: 16px;
}

.admin-header .user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
}

.admin-header .user-info a {
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.3s;
}

.admin-header .user-info a:hover {
    color: #fff;
}

.admin-body {
    display: flex;
    min-height: calc(100vh - 70px);
}

.admin-sidebar {
    width: 220px;
    background: #fff;
    padding: 16px 0;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.admin-sidebar .menu-item {
    display: block;
    padding: 12px 24px;
    font-size: 15px;
    color: #555;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.admin-sidebar .menu-item:hover {
    background: #f8f9ff;
    color: #667eea;
}

.admin-sidebar .menu-item.active {
    background: #f0f2ff;
    color: #667eea;
    border-left-color: #667eea;
    font-weight: 600;
}

.admin-sidebar .menu-item .icon {
    margin-right: 10px;
}

.admin-content {
    flex: 1;
    padding: 24px 30px;
    overflow-x: auto;
}

/* ===== 后台消息提示 ===== */
.alert {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ===== 后台统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-align: center;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: #667eea;
}

.stat-card .label {
    font-size: 14px;
    color: #888;
    margin-top: 4px;
}

/* ===== 后台配置表单 ===== */
.config-form {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    max-width: 700px;
}

.config-form .form-group {
    margin-bottom: 16px;
}

.config-form .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.config-form .form-group .desc {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.config-form .form-group input,
.config-form .form-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

.config-form .form-group input:focus,
.config-form .form-group select:focus {
    border-color: #667eea;
}

.config-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.config-form .checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.config-form .checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* ===== 后台通用按钮 ===== */
.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary {
    background: #667eea;
    color: #fff;
}

.btn-primary:hover {
    background: #5a6fd6;
}

.btn-success {
    background: #00b894;
    color: #fff;
}

.btn-success:hover {
    background: #00a381;
}

.btn-danger {
    background: #e17055;
    color: #fff;
}

.btn-danger:hover {
    background: #d63031;
}

.btn-warning {
    background: #fdcb6e;
    color: #2d3436;
}

.btn-warning:hover {
    background: #f9ca24;
}

.btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}

.btn-outline:hover {
    background: #667eea;
    color: #fff;
}

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

/* ===== 后台表格 ===== */
.table-container {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

table th {
    background: #f8f9fa;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e9ecef;
}

table td {
    padding: 10px 16px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

table tr:hover {
    background: #fafbff;
}

table .thumb {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    background: #f0f0f0;
}

table .thumb-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 12px;
}

/* ===== 后台工具栏 ===== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.toolbar .left {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* ===== 后台批量更新表单 ===== */
.batch-form {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    margin-top: 16px;
    max-width: 700px;
}

.batch-form .form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.batch-form .form-group {
    flex: 1;
    min-width: 200px;
}

.batch-form .form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.batch-form .form-group input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #dfe6e9;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.batch-form .form-group input:focus {
    border-color: #667eea;
}

/* ===== 后台编辑表单 ===== */
.edit-form {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    max-width: 700px;
}

.edit-form .form-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.edit-form .form-group {
    margin-bottom: 16px;
}

.edit-form .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.edit-form .form-group input,
.edit-form .form-group select,
.edit-form .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

.edit-form .form-group input:focus,
.edit-form .form-group select:focus,
.edit-form .form-group textarea:focus {
    border-color: #667eea;
}

.edit-form .form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.edit-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.edit-form .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 2px solid #f0f0f0;
}

/* ===== 后台缓存信息 ===== */
.cache-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    font-size: 13px;
    color: #555;
}

.cache-info strong {
    color: #2d3436;
}

/* ===== 后台信息框 ===== */
.info-box {
    background: #d1ecf1;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #bee5eb;
    font-size: 13px;
    color: #0c5460;
    margin-bottom: 16px;
}

.info-box code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
}

/* ===== 后台模态框 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    margin: 20px;
}

.modal-box h3 {
    font-size: 20px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-box .form-group {
    margin-bottom: 14px;
}

.modal-box .form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.modal-box .form-group input,
.modal-box .form-group select,
.modal-box .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

.modal-box .form-group input:focus,
.modal-box .form-group select:focus,
.modal-box .form-group textarea:focus {
    border-color: #667eea;
}

.modal-box .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-box .form-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* ===== 后台移动端菜单 ===== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

/* ============================================================
   响应式
   ============================================================ */

@media (max-width: 992px) {
    .sidebar {
        width: 240px;
    }
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .top-bar .container {
        flex-wrap: nowrap;
        justify-content: space-between;
    }
    .top-bar .logo {
        font-size: 18px;
    }
    .top-bar .stats {
        display: none;
    }
    .top-bar .nav-links {
        display: none;
    }
    .menu-toggle {
        display: block;
    }
    .float-cart .cart-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .float-cart .cart-btn .badge {
        font-size: 10px;
        min-width: 18px;
        height: 18px;
        line-height: 18px;
    }
    .float-cart {
        bottom: 80px;
        right: 16px;
    }
    .back-to-top {
        bottom: 30px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    .hero-section {
        padding: 16px 0;
    }
    .hero-section h1 {
        font-size: 22px;
    }
    .hero-section .search-box {
        flex-direction: column;
        max-width: 100%;
    }
    .hero-section .search-box button {
        width: 100%;
    }
    .sidebar {
        position: fixed;
        top: 0;
        left: -300px;
        width: 300px;
        height: 100%;
        max-height: 100%;
        z-index: 1000;
        border-radius: 0;
        padding-top: 50px;
        transition: left 0.3s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar .sidebar-title .close-sidebar {
        display: block;
    }
    .sidebar-overlay.active {
        display: block;
    }
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 12px;
    }
    .section-header h2 {
        font-size: 18px;
    }
    .footer .container {
        flex-direction: column;
        text-align: center;
    }
    .add-to-cart-btn {
        font-size: 13px;
        padding: 6px 0;
    }
    .toast {
        bottom: 90px;
        font-size: 13px;
        padding: 10px 20px;
    }

    /* 后台响应式 */
    .admin-sidebar {
        width: 180px;
    }
    .admin-content {
        padding: 16px;
    }
    .edit-form .form-row {
        grid-template-columns: 1fr;
    }
    .config-form .form-row {
        grid-template-columns: 1fr;
    }
    .batch-form .form-row {
        flex-direction: column;
    }
    .batch-form .form-group {
        min-width: 100%;
    }
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    table {
        font-size: 13px;
    }
    table th,
    table td {
        padding: 6px 10px;
    }
    .stats-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
    .modal-box {
        padding: 20px;
        margin: 12px;
    }
    .modal-box .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
    .top-bar .logo {
        font-size: 16px;
    }
    .hero-section h1 {
        font-size: 20px;
    }
    .float-cart .cart-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    .float-cart .cart-btn .badge {
        font-size: 9px;
        min-width: 16px;
        height: 16px;
        line-height: 16px;
    }
    .back-to-top {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* 后台移动端 */
    .admin-sidebar {
        display: none;
    }
    .admin-header {
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }
    .admin-header .logo {
        font-size: 18px;
    }
    .mobile-menu-toggle {
        display: block;
    }
    .admin-sidebar.mobile-open {
        display: block;
        position: fixed;
        top: 60px;
        left: 0;
        width: 220px;
        height: 100%;
        z-index: 99;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.15);
        background: #fff;
    }
    .edit-form {
        padding: 16px;
    }
}
/* ============================================================
   购物车页面样式 (cart.php)
   ============================================================ */

.cart-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.cart-header {
    background: #fff;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.cart-header h1 {
    font-size: 22px;
}

.cart-header .count {
    color: #888;
    font-size: 14px;
}

.cart-item {
    background: #fff;
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform 0.2s;
}

.cart-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.cart-item .thumb {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
}

.cart-item .thumb-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 12px;
    flex-shrink: 0;
}

.cart-item .info {
    flex: 1;
    min-width: 0;
}

.cart-item .info .name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item .info .category {
    font-size: 12px;
    color: #888;
    margin-top: 2px;
}

.cart-item .qty-control {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cart-item .qty-control button {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #dfe6e9;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cart-item .qty-control button:hover {
    background: #667eea;
    color: #fff;
    border-color: #667eea;
}

.cart-item .qty-control .qty {
    font-size: 15px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

.cart-item .remove-btn {
    background: none;
    border: none;
    color: #e17055;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 6px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.cart-item .remove-btn:hover {
    color: #d63031;
}

/* 订单备注表单 */
.order-remark {
    background: #fff;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.order-remark label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
}

.order-remark textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #dfe6e9;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.order-remark textarea:focus {
    border-color: #667eea;
}

.cart-footer {
    background: #fff;
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
    position: sticky;
    bottom: 0;
    z-index: 10;
}

.cart-footer .left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cart-footer .right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.cart-footer .total {
    font-size: 15px;
    font-weight: 600;
}

.cart-footer .total span {
    color: #667eea;
    font-size: 17px;
}

.empty-cart {
    text-align: center;
    padding: 60px 20px;
    color: #888;
}

.empty-cart .icon {
    font-size: 64px;
    display: block;
    margin-bottom: 16px;
}

/* 订单详情页 */
.order-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.order-detail {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.order-detail h2 {
    font-size: 22px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f0;
}

.order-detail .row {
    display: flex;
    padding: 6px 0;
    border-bottom: 1px solid #f5f5f5;
}

.order-detail .row .label {
    width: 100px;
    color: #888;
    flex-shrink: 0;
}

.order-detail .row .value {
    flex: 1;
    word-break: break-all;
}

.order-product {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.order-product:last-child {
    border-bottom: none;
}

.order-product .thumb {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    object-fit: cover;
    background: #f0f0f0;
}

.order-product .thumb-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 6px;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ccc;
    font-size: 12px;
}

.order-product .info {
    flex: 1;
}

.order-product .info .name {
    font-weight: 600;
    font-size: 14px;
}

.order-product .info .qty {
    color: #888;
    font-size: 13px;
}

.order-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.status-badge {
    display: inline-block;
    padding: 3px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

/* ===== 购物车响应式 ===== */
@media (max-width: 768px) {
    .cart-item {
        flex-wrap: wrap;
    }
    .cart-item .info {
        width: 100%;
    }
    .cart-item .qty-control {
        margin-left: auto;
    }
    .cart-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .cart-footer .left,
    .cart-footer .right {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .cart-item {
        padding: 10px 12px;
    }
    .cart-item .thumb {
        width: 44px;
        height: 44px;
    }
    .cart-item .info .name {
        font-size: 13px;
    }
    .order-detail {
        padding: 16px;
    }
    .order-detail .row .label {
        width: 70px;
        font-size: 13px;
    }
}
/* ============================================================
   订单状态徽标 (添加到文件末尾)
   ============================================================ */

.status-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-badge.status-processing {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.status-completed {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-cancelled {
    background: #f8d7da;
    color: #721c24;
}
