/* ========================================
   订货系统 - 扁平化统一样式
   设计规范：统一色彩、间距、圆角
   ======================================== */

/* 统一变量定义 */
:root {
    /* 主色调 */
    --primary: #1890FF;
    --primary-hover: #40A9FF;
    --primary-active: #096DD9;
    --primary-light: #E6F7FF;

    /* 辅助色 */
    --success: #52C41A;
    --warning: #FAAD14;
    --error: #FF4D4F;

    /* 中性色 */
    --bg-page: #F5F7FA;
    --bg-card: #FFFFFF;
    --text-primary: #303133;
    --text-regular: #606266;
    --text-secondary: #909399;
    --text-placeholder: #C0C4CC;
    --border-base: #DCDFE6;
    --border-light: #EBEEF5;
    --divider: #EBEEF5;

    /* 尺寸 */
    --max-width: 1200px;
    --header-height: 64px;

    /* 圆角 */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;

    /* 阴影 */
    --shadow-card: 0 2px 6px rgba(0, 0, 0, 0.04);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-popup: 0 8px 32px rgba(0, 0, 0, 0.12);

    /* 过渡 */
    --transition: all 0.3s ease;
}

/* 重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

ul, ol {
    list-style: none;
}

/* ========================================
   顶部导航栏
   ======================================== */
.shop-header {
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
}

.logo {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo:hover {
    color: var(--primary-hover);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 搜索框 */
.search-box {
    position: relative;
}

.search-box input {
    width: 280px;
    height: 38px;
    padding: 0 40px 0 14px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-page);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.search-box button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.search-box button:hover {
    background: var(--primary-hover);
}

/* 语言选择 */
.lang-select {
    position: relative;
}

.lang-select select {
    padding: 8px 28px 8px 12px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    color: var(--text-regular);
    transition: var(--transition);
}

.lang-select select:hover {
    border-color: var(--primary);
}

.lang-select::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    border: 4px solid transparent;
    border-top-color: var(--text-secondary);
    pointer-events: none;
}

/* 导航链接 */
.nav-link,
.cart-icon {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--text-regular);
    font-size: 14px;
    padding: 8px 14px;
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.nav-link:hover,
.cart-icon:hover {
    background: var(--bg-page);
    color: var(--primary);
}

.cart-badge {
    background: var(--error);
    color: #fff;
    font-size: 12px;
    padding: 1px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* 用户菜单 */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
}

.user-menu:hover {
    background: var(--bg-page);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
}

.user-name {
    font-size: 14px;
    color: var(--text-regular);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   主体容器
   ======================================== */
.main-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 20px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

/* ========================================
   卡片通用样式
   ======================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* ========================================
   按钮样式
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-hover);
}

.btn-primary:active {
    background: var(--primary-active);
}

.btn-default {
    background: var(--bg-card);
    color: var(--text-regular);
    border: 1px solid var(--border-base);
}

.btn-default:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.btn-danger {
    background: var(--error);
    color: #fff;
}

.btn-danger:hover {
    background: #FF7875;
}

.btn-block {
    width: 100%;
}

/* ========================================
   表单样式
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--text-regular);
    font-weight: 500;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg-card);
    color: var(--text-primary);
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.form-input::placeholder {
    color: var(--text-placeholder);
}

/* ========================================
   表格样式
   ======================================== */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--bg-page);
}

.table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-regular);
    font-size: 14px;
    border-bottom: 1px solid var(--border-light);
}

.table td {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
}

.table tbody tr:hover {
    background: var(--bg-page);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   商品网格
   ======================================== */
.goods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.goods-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: var(--transition);
    cursor: pointer;
}

.goods-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.goods-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-page);
}

.goods-info {
    padding: 14px;
}

.goods-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.goods-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--error);
    margin-bottom: 8px;
}

.goods-price span {
    font-size: 14px;
    font-weight: 400;
}

.goods-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ========================================
   分类侧边栏
   ======================================== */
.category-sidebar {
    width: 200px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    position: sticky;
    top: 80px;
}

.category-sidebar-title {
    padding: 14px 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-page);
}

.category-nav {
    display: flex;
    flex-direction: column;
}

.category-item {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-regular);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
}

.category-item:hover {
    background: var(--bg-page);
    color: var(--primary);
}

.category-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}

/* ========================================
   登录页样式
   ======================================== */
.login-container {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popup);
    overflow: hidden;
}

.login-header {
    padding: 32px 32px 20px 32px;
    text-align: center;
    background: var(--bg-page);
    border-bottom: 1px solid var(--border-light);
}

.login-logo {
    width: auto;
    margin: 0 auto 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.login-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
}

.login-body {
    padding: 32px;
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
}

.login-btn:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-hover);
}

.login-btn:active {
    background: var(--primary-active);
}

.captcha-group {
    display: flex;
    gap: 12px;
}

.captcha-input {
    flex: 1;
}

.captcha-img {
    width: 120px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-base);
    cursor: pointer;
    object-fit: cover;
}

.captcha-img:hover {
    border-color: var(--primary);
}

/* ========================================
   空状态
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-text {
    font-size: 15px;
}

/* ========================================
   分页样式
   ======================================== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination-item {
    min-width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-base);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-regular);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pagination-item.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ========================================
   徽章/标签
   ======================================== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 12px;
    border-radius: 4px;
    font-weight: 500;
}

.badge-success {
    background: #F6FFED;
    color: var(--success);
    border: 1px solid #B7EB8F;
}

.badge-warning {
    background: #FFFBE6;
    color: var(--warning);
    border: 1px solid #FFE58F;
}

.badge-error {
    background: #FFF2F0;
    color: var(--error);
    border: 1px solid #FFCCC7;
}

/* ========================================
   工具类
   ======================================== */
.text-primary { color: var(--text-primary); }
.text-regular { color: var(--text-regular); }
.text-secondary { color: var(--text-secondary); }
.text-placeholder { color: var(--text-placeholder); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

.font-bold { font-weight: 600; }
.font-medium { font-weight: 500; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { align-items: center; justify-content: space-between; }
.flex-1 { flex: 1; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }

/* ========================================
   响应式
   ======================================== */
@media (max-width: 768px) {
    .header-container {
        padding: 0 16px;
    }

    .search-box input {
        width: 200px;
    }

    .category-sidebar {
        display: none;
    }

    .goods-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }

    .goods-image {
        height: 140px;
    }

    .main-container {
        padding: 16px;
    }
}
