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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

/* ===== 顶部导航 ===== */
.navbar {
    background: #fff;
    border-bottom: 1px solid #e8e8e8;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.navbar h1 {
    font-size: 24px;
    font-weight: 700;
    color: #222;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-links a {
    text-decoration: none;
    color: #666;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: #ff5f15;
}

.nav-links .username {
    color: #ff5f15;
    font-weight: 500;
}

/* ===== 主体内容 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
}

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

.goods-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
}

.goods-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.goods-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #fafafa;
}

.goods-card-body {
    padding: 16px;
}

.goods-card-body h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #222;
}

.goods-card-body p {
    font-size: 13px;
    color: #999;
    margin-bottom: 12px;
    line-height: 1.4;
}

.goods-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.price {
    font-size: 22px;
    font-weight: 700;
    color: #ff5f15;
}

.price::before {
    content: "¥";
    font-size: 14px;
}

.btn-link {
    display: inline-block;
    background: #ff5f15;
    color: #fff;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-link:hover {
    background: #e55010;
}

/* ===== 表单 ===== */
.form-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.form-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px;
    width: 400px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.form-card h2 {
    text-align: center;
    font-size: 24px;
    margin-bottom: 28px;
    color: #222;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #ff5f15;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: #ff5f15;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-submit:hover {
    background: #e55010;
}

.form-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 14px;
    color: #999;
}

.form-footer a {
    color: #ff5f15;
    text-decoration: none;
}

.error-msg {
    background: #fff2f0;
    color: #ff4d4f;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid #ffccc7;
}

/* ===== 商品详情页 ===== */
.goods-detail {
    display: flex;
    gap: 40px;
    background: #fff;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.goods-detail img {
    width: 400px;
    height: 400px;
    object-fit: contain;
    background: #fafafa;
    border-radius: 12px;
    flex-shrink: 0;
}

.goods-detail-info {
    flex: 1;
}

.goods-detail-info h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
}

.goods-detail-info .desc {
    font-size: 14px;
    color: #999;
    line-height: 1.6;
    margin-bottom: 20px;
}

.goods-detail-info .price-big {
    font-size: 32px;
    font-weight: 700;
    color: #ff5f15;
    margin-bottom: 8px;
}

.goods-detail-info .stock {
    font-size: 14px;
    color: #999;
    margin-bottom: 24px;
}

.order-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.order-form input[type="number"] {
    width: 80px;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    text-align: center;
}

/* ===== 订单列表 ===== */
.page-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
}

.order-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.order-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.order-card-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.order-card-left img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
}

.order-info h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.order-info p {
    font-size: 13px;
    color: #999;
}

.order-status {
    font-size: 14px;
    color: #52c41a;
    font-weight: 500;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #ccc;
    font-size: 16px;
}

/* ===== 提示消息 ===== */
.success-msg {
    background: #f6ffed;
    color: #52c41a;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    border: 1px solid #b7eb8f;
    text-align: center;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .navbar {
        padding: 0 12px;
    }

    /* 首页商品网格：一列两个 */
    .goods-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .goods-card img {
        aspect-ratio: 1 / 1;
        height: auto;
    }

    .goods-card-body {
        padding: 10px;
    }

    .goods-card-body h3 {
        font-size: 13px;
    }

    .goods-card-body p {
        display: none;
    }

    .price {
        font-size: 18px;
    }

    .btn-link {
        padding: 6px 14px;
        font-size: 12px;
    }

    /* 商品详情页：竖排 */
    .goods-detail {
        flex-direction: column;
        padding: 16px;
        gap: 16px;
    }

    .goods-detail img {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        object-fit: contain;
        background: #fafafa;
    }

    .goods-detail-info h2 {
        font-size: 20px;
    }

    .goods-detail-info .price-big {
        font-size: 26px;
    }

    /* 订单卡片：紧凑 */
    .order-card {
        padding: 14px 16px;
    }

    .order-card-left img {
        width: 60px;
        height: 60px;
    }

    .order-card-left {
        gap: 10px;
    }

    /* 表单卡片：满宽 */
    .form-card {
        width: 100%;
        padding: 24px 20px;
    }

    /* 管理后台侧边栏：折叠到顶部 */
    .admin-layout {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        min-height: auto;
        display: flex;
        padding: 0;
        overflow-x: auto;
    }

    .admin-sidebar a {
        white-space: nowrap;
        padding: 12px 16px;
        font-size: 13px;
    }

    .admin-main {
        padding: 16px 12px;
    }

    /* 表格：横向滚动 */
    .admin-table {
        font-size: 13px;
    }

    .admin-table th,
    .admin-table td {
        padding: 10px 12px;
    }
}
