/* ============================================
   商城全局公共样式 common.css
   所有页面共用，包含重置、布局、按钮、表单、卡片等
   ============================================ */

/* ---------- 全局重置 ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f5f5f5;
    line-height: 1.6;
}

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

a:hover {
    color: #204080;
}

img {
    max-width: 100%;
    display: block;
}

ul, ol {
    list-style: none;
}

input, button, textarea, select {
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* ---------- 通用容器 ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* ---------- 顶部通栏 ---------- */
.top-bar {
    background: linear-gradient(90deg, #1a2a4a 0%, #204080 100%);
    color: #dbe4f5;
    font-size: 12px;
    height: 36px;
    line-height: 36px;
}

.top-bar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar a {
    color: #ccc;
    margin: 0 8px;
}

.top-bar a:hover {
    color: #fff;
}

/* ---------- 主导航头部 ---------- */
.main-header {
    background: #fff;
    border-bottom: 2px solid #204080;
}

.main-header .container {
    display: flex;
    align-items: center;
    height: 80px;
}

.logo {
    font-size: 26px;
    font-weight: bold;
    color: #204080;
    margin-right: 50px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-img {
    height: 46px;
    width: auto;
    border-radius: 6px;
}

.logo-text {
    font-size: 24px;
    font-weight: bold;
    color: #204080;
    letter-spacing: 2px;
}

.main-nav {
    display: flex;
    gap: 30px;
}

.main-nav a {
    font-size: 16px;
    color: #333;
    padding: 8px 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.main-nav a:hover,
.main-nav a.active {
    color: #204080;
    border-bottom-color: #204080;
}

.header-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 15px;
}

/* ---------- 搜索框 ---------- */
.search-box {
    display: flex;
    border: 2px solid #204080;
    border-radius: 4px;
    overflow: hidden;
    width: 380px;
}

.search-box input {
    flex: 1;
    border: none;
    padding: 8px 12px;
    font-size: 14px;
}

.search-box button {
    background: #204080;
    color: #fff;
    border: none;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 14px;
}

.search-box button:hover {
    background: #1a3566;
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #333;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    transition: all 0.2s;
}

.btn:hover {
    border-color: #204080;
    color: #204080;
}

.btn-primary {
    background: #204080;
    color: #fff;
    border-color: #204080;
}

.btn-primary:hover {
    background: #1a3566;
    color: #fff;
    border-color: #1a3566;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 16px;
}

/* ---------- 表单 ---------- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: #204080;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ---------- 商品卡片网格 ---------- */
.goods-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.goods-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    overflow: hidden;
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

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

.goods-card .goods-img {
    width: 100%;
    height: 200px;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #bbb;
    font-size: 14px;
}

.goods-card .goods-info {
    padding: 12px;
}

.goods-card .goods-name {
    font-size: 14px;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.goods-card .goods-price {
    color: #204080;
    font-size: 18px;
    font-weight: bold;
}

/* ---------- 区块标题 ---------- */
.section-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    border-left: 4px solid #204080;
    padding-left: 12px;
    margin-bottom: 16px;
}

/* ---------- 页面主体内容区 ---------- */
.page-body {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

.content-box {
    background: #fff;
    border-radius: 6px;
    padding: 24px;
    margin-bottom: 20px;
}

/* ---------- 表格 ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: #fafafa;
    font-weight: bold;
    color: #555;
}

.table tr:hover {
    background: #f9f9f9;
}

/* ---------- 提示消息 ---------- */
.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.alert-success {
    background: #f0f9eb;
    color: #67c23a;
    border: 1px solid #e1f3d8;
}

.alert-error {
    background: #fef0f0;
    color: #f56c6c;
    border: 1px solid #fde2e2;
}

.alert-info {
    background: #ecf5ff;
    color: #409eff;
    border: 1px solid #d9ecff;
}

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    color: #333;
}

.pagination .active {
    background: #204080;
    color: #fff;
    border-color: #204080;
}

/* ---------- 页脚 ---------- */
.footer {
    background: linear-gradient(90deg, #1a2a4a 0%, #204080 100%);
    color: #b8c6e0;
    text-align: center;
    padding: 30px 0;
    margin-top: 40px;
    font-size: 13px;
}

.footer a {
    color: #999;
    margin: 0 10px;
}

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

/* ---------- 登录/注册 居中卡片 ---------- */
.auth-wrapper {
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.auth-card {
    background: #fff;
    border-radius: 8px;
    padding: 36px 40px;
    width: 420px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 28px;
    color: #333;
}

.auth-card .auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: #999;
}

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* ---------- 工具类 ---------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-red { color: #204080; }
.text-gray { color: #999; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }
