/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #8b5cf6;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;
    --bg: #f8fafc;
    --card: #ffffff;
    --text: #1e293b;
    --text-2: #64748b;
    --text-3: #94a3b8;
    --border: #e2e8f0;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --gradient-2: linear-gradient(135deg, #ec4899, #8b5cf6);
    --gradient-3: linear-gradient(135deg, #06b6d4, #6366f1);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);
}
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
}
a { color: var(--primary); text-decoration: none; transition: color .2s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

/* ========== 布局容器 ========== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ========== 头部 ========== */
.header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.logo span {
    font-size: 20px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.nav { display: flex; gap: 8px; }
.nav a {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    font-size: 14px;
    transition: all .2s;
}
.nav a:hover { background: #f1f5f9; color: var(--primary); }

/* ========== 卡片 ========== */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}
.card-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
    padding-bottom: 14px;
    border-bottom: 2px solid var(--border);
}
.empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-3);
    font-size: 14px;
}

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .25s cubic-bezier(.4,0,.2,1);
    text-decoration: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99,102,241,.35);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(99,102,241,.45); color: #fff; }
.btn-success {
    background: var(--gradient-success);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16,185,129,.35);
}
.btn-success:hover { box-shadow: 0 6px 20px rgba(16,185,129,.45); color: #fff; }
.btn-danger {
    background: var(--gradient-danger);
    color: #fff;
    box-shadow: 0 4px 14px rgba(239,68,68,.35);
}
.btn-danger:hover { box-shadow: 0 6px 20px rgba(239,68,68,.45); color: #fff; }
.btn-default {
    background: #f1f5f9;
    color: var(--text-2);
    border: 1px solid var(--border);
}
.btn-default:hover { background: #e2e8f0; color: var(--text); }
.btn-block { width: 100%; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* ========== 表单 ========== */
.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 600;
    color: var(--text);
    font-size: 13.5px;
}
.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    outline: none;
    transition: all .2s;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.1);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

/* ========== 分类导航 ========== */
.category-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 20px 0;
}
.category-bar .btn { padding: 8px 18px; font-size: 13px; }

/* ========== 商品网格 ========== */
.goods-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    padding-bottom: 20px;
}
.goods-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all .3s cubic-bezier(.4,0,.2,1);
}
.goods-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.goods-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #f0f4ff, #fdf2f8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    overflow: hidden;
    position: relative;
}
.goods-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    padding: 4px;
    background: #fff;
}
.goods-info { padding: 14px; }
.goods-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 40px;
}
.goods-price-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.goods-price {
    font-size: 20px;
    font-weight: 800;
    color: var(--danger);
}
.goods-price small { font-size: 13px; font-weight: 600; }
.goods-original-price {
    font-size: 13px;
    color: var(--text-3);
    text-decoration: line-through;
}

/* ========== 商品详情 ========== */
.goods-detail {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}
.goods-detail-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #f0f4ff, #fdf2f8);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
    overflow: hidden;
}
.goods-detail-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    padding: 16px;
}
.goods-detail-info h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text);
}
.goods-detail-price {
    background: linear-gradient(135deg, #fef2f2, #fff7ed);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.goods-detail-price .price {
    font-size: 30px;
    font-weight: 800;
    color: var(--danger);
}
.goods-detail-price .price small { font-size: 16px; }
.goods-detail-price .original {
    font-size: 15px;
    color: var(--text-3);
    text-decoration: line-through;
}
.goods-detail-price .stock {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-2);
    background: #fff;
    padding: 4px 12px;
    border-radius: 20px;
}
.goods-detail-desc {
    color: var(--text-2);
    font-size: 14px;
    line-height: 1.8;
    margin-bottom: 20px;
    padding: 14px 16px;
    background: #f8fafc;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--primary);
}

/* ========== 数量选择 ========== */
.quantity-box {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.quantity-box label { font-weight: 600; color: var(--text); font-size: 14px; }
.quantity-box input {
    width: 100px;
    padding: 9px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    text-align: center;
    outline: none;
}
.quantity-box input:focus { border-color: var(--primary); }

/* ========== 合计框 ========== */
.total-box {
    background: var(--gradient);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #fff;
}
.total-box .label { font-size: 14px; opacity: .9; }
.total-box .value { font-size: 24px; font-weight: 800; }

/* ========== 消息提示 ========== */
.msg {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid transparent;
}
.msg-success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.msg-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.msg-warning { background: #fffbeb; border-color: #fde68a; color: #b45309; }

/* ========== 表格 ========== */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.table th {
    background: #f8fafc;
    font-weight: 700;
    color: var(--text-2);
    font-size: 13px;
    white-space: nowrap;
}
.table tr:hover { background: #f8fafc; }
.op-links { display: flex; gap: 10px; flex-wrap: wrap; }
.op-links a { font-size: 13px; }
.op-links a.danger { color: var(--danger); }

/* ========== 状态标签 ========== */
.status-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

/* ========== 图片缩略图 ========== */
.img-thumb {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border);
}
.img-preview {
    max-width: 150px;
    max-height: 150px;
    border-radius: var(--radius-sm);
    margin-top: 10px;
    border: 1px solid var(--border);
    object-fit: contain;
}

/* ========== 工具栏 ========== */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}
.toolbar .title { font-size: 16px; font-weight: 700; color: var(--text); }

/* ========== 后台布局 ========== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}
.admin-sidebar {
    width: 220px;
    background: linear-gradient(180deg, #1e1b4b, #312e81);
    color: #fff;
    padding: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 50;
}
.admin-sidebar .logo {
    padding: 22px 20px;
    font-size: 17px;
    font-weight: 800;
    border-bottom: 1px solid rgba(255,255,255,.1);
    background: rgba(255,255,255,.05);
}
.admin-sidebar .logo span {
    background: linear-gradient(135deg, #a5b4fc, #f0abfc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 20px;
    color: rgba(255,255,255,.7);
    font-size: 14px;
    font-weight: 500;
    transition: all .2s;
    border-left: 3px solid transparent;
}
.admin-sidebar a:hover {
    background: rgba(255,255,255,.08);
    color: #fff;
}
.admin-sidebar a.active {
    background: rgba(99,102,241,.3);
    color: #fff;
    border-left-color: #818cf8;
}
.admin-main {
    flex: 1;
    margin-left: 220px;
    padding: 24px;
    min-height: 100vh;
}
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 10px;
}
.admin-header h2 {
    font-size: 22px;
    font-weight: 700;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.user-info { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--text-2); }
.user-info a { font-weight: 600; }
.menu-toggle {
    display: none;
    background: var(--gradient);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    margin-right: 10px;
}

/* ========== 统计卡片 ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: all .3s;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
}
.stat-card:nth-child(1)::before { background: var(--gradient); }
.stat-card:nth-child(2)::before { background: var(--gradient-success); }
.stat-card:nth-child(3)::before { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.stat-card:nth-child(4)::before { background: var(--gradient-2); }
.stat-card .label { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-card:nth-child(2) .value { background: var(--gradient-success); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card:nth-child(3) .value { background: linear-gradient(135deg, #f59e0b, #fbbf24); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.stat-card:nth-child(4) .value { background: var(--gradient-2); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* ========== 后台登录 ========== */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b, #312e81, #4c1d95);
    padding: 20px;
    position: relative;
    overflow: hidden;
}
.login-wrap::before {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(99,102,241,.3), transparent);
    border-radius: 50%;
    top: -100px; left: -100px;
    animation: float 6s ease-in-out infinite;
}
.login-wrap::after {
    content: '';
    position: absolute;
    width: 300px; height: 300px;
    background: radial-gradient(circle, rgba(236,72,153,.25), transparent);
    border-radius: 50%;
    bottom: -80px; right: -80px;
    animation: float 8s ease-in-out infinite reverse;
}
@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(30px, -30px); }
}
.login-box {
    background: #fff;
    border-radius: 16px;
    padding: 36px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 30px 80px rgba(0,0,0,.3);
    position: relative;
    z-index: 1;
}
.login-box h1 {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 6px;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-box .sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 28px; }

/* ========== 页脚 ========== */
.footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-3);
    font-size: 13px;
    border-top: 1px solid var(--border);
    margin-top: 30px;
    background: #fff;
}

/* ========== 订单查询 ========== */
.query-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.query-form input { flex: 1; min-width: 200px; }
.order-detail-table { width: 100%; }
.order-detail-table th {
    width: 100px;
    background: #f8fafc;
    font-weight: 600;
    color: var(--text-2);
    padding: 10px 14px;
    text-align: left;
    font-size: 13px;
}
.order-detail-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); }

/* ========== 响应式 H5 ========== */
@media (max-width: 768px) {
    .container { padding: 0 12px; }
    .header-inner { height: 52px; }
    .logo span { font-size: 17px; }
    .nav a { padding: 6px 10px; font-size: 13px; }
    .card { padding: 16px; border-radius: 10px; }
    .goods-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .goods-name { font-size: 13px; min-height: 36px; }
    .goods-price { font-size: 17px; }
    .goods-detail { grid-template-columns: 1fr; gap: 18px; }
    .goods-detail-info h1 { font-size: 18px; }
    .goods-detail-price .price { font-size: 24px; }
    .goods-detail-price .stock { margin-left: 0; width: 100%; text-align: center; }
    .total-box .value { font-size: 20px; }
    .btn-lg { padding: 12px 20px; font-size: 14px; }

    /* 后台H5适配 */
    .menu-toggle { display: inline-block; }
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 220px;
        transform: translateX(-100%);
        transition: transform .3s;
        z-index: 200;
        display: block;
        overflow-y: auto;
    }
    .admin-sidebar.show { transform: translateX(0); }
    .admin-sidebar .logo { display: block; }
    .admin-sidebar a {
        display: flex;
        padding: 14px 20px;
        border-left: 3px solid transparent;
        border-bottom: none;
        font-size: 14px;
    }
    .admin-sidebar a.active {
        border-left-color: #818cf8;
        border-bottom: none;
    }
    .admin-layout { flex-direction: row; }
    .admin-main {
        margin-left: 0;
        padding: 14px;
    }
    .admin-header h2 { font-size: 18px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-card .value { font-size: 22px; }
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 10px; }
    .toolbar { flex-direction: column; align-items: flex-start; }
    .op-links { gap: 8px; }
}

@media (max-width: 480px) {
    .goods-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .query-form { flex-direction: column; }
    .query-form input { min-width: 100%; }
}
