/* =============================================
   在线商城 - 全局样式（响应式/H5自适应）
   ============================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 14px;
    color: #333;
    background-color: #f8f9fa;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: #e4393c;
    text-decoration: none;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

a:hover {
    text-decoration: underline;
}

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

/* 移动端容器 */
@media (max-width: 768px) {
    .container {
        padding: 0 12px;
    }
}

/* =============================================
   顶部导航（响应式）
   ============================================= */
.site-header {
    background: linear-gradient(135deg, #e4393c 0%, #d32f2f 100%);
    color: #fff;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 15px;
}

.logo a {
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
}

/* 网址显示区域（支付宝审核要求） */
.site-url-display {
    flex: 1;
    background: rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: rgba(255,255,255,0.95);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-label {
    font-weight: 500;
}

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

.nav-link, .nav-user {
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
}

.nav-link:hover {
    text-decoration: underline;
}

.cart-link {
    position: relative;
    padding: 5px 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff5722;
    color: #fff;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* 移动端导航优化 */
@media (max-width: 768px) {
    .header-inner {
        padding: 0 12px;
        height: 50px;
        gap: 8px;
    }
    
    .logo a {
        font-size: 16px;
    }
    
    .site-url-display {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    .nav-links {
        gap: 8px;
    }
    
    .nav-link, .nav-user {
        font-size: 12px;
    }
    
    .nav-user {
        max-width: 60px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* =============================================
   主内容区域
   ============================================= */
.main-content {
    flex: 1;
    padding: 20px 0;
}

@media (max-width: 768px) {
    .main-content {
        padding: 12px 0;
    }
}

/* =============================================
   商品网格（响应式）
   ============================================= */
.category-nav {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.category-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.category-item {
    padding: 6px 15px;
    background: #f5f5f5;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.category-item:hover, .category-item.active {
    background: #e4393c;
    color: #fff;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

/* 平板 */
@media (max-width: 1024px) {
    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
}

/* 手机 */
@media (max-width: 768px) {
    .category-nav {
        padding: 10px;
        margin-bottom: 12px;
    }
    
    .category-list {
        gap: 6px;
    }
    
    .category-item {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* =============================================
   商品卡片（响应式）
   ============================================= */
.product-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.product-image {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #f8f8f8;
}

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

.product-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
    min-height: 40px;
}

.product-spec {
    font-size: 12px;
    color: #999;
    margin-bottom: 10px;
}

.product-price {
    font-size: 20px;
    font-weight: bold;
    color: #e4393c;
    margin-bottom: 10px;
}

.product-price small {
    font-size: 14px;
}

.btn-add-cart {
    width: 100%;
    padding: 8px;
    background: #e4393c;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-add-cart:hover {
    background: #c62828;
}

/* 移动端商品卡片优化 */
@media (max-width: 768px) {
    .product-info {
        padding: 8px;
    }
    
    .product-name {
        font-size: 13px;
        margin-bottom: 6px;
        min-height: 36px;
    }
    
    .product-spec {
        font-size: 11px;
        margin-bottom: 6px;
    }
    
    .product-price {
        font-size: 16px;
        margin-bottom: 8px;
    }
    
    .product-price small {
        font-size: 12px;
    }
    
    .btn-add-cart {
        padding: 6px;
        font-size: 12px;
    }
}

/* =============================================
   表单样式（响应式）
   ============================================= */
.form-container {
    max-width: 450px;
    margin: 40px auto;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-title {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

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

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #e4393c;
}

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

.form-checkbox {
    margin-right: 6px;
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: #e4393c;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #c62828;
}

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

.alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.alert-success {
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* 移动端表单优化 */
@media (max-width: 768px) {
    .form-container {
        margin: 20px auto;
        padding: 20px 15px;
    }
    
    .form-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-input, .form-select, .form-textarea {
        padding: 10px;
        font-size: 16px; /* 防止iOS自动缩放 */
    }
}

/* =============================================
   购物车/订单页面（响应式）
   ============================================= */
.cart-container, .checkout-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px 0;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #333;
    margin-bottom: 24px;
    padding: 0 0 16px 0;
    border-bottom: 2px solid #e4393c;
}

.cart-table {
    width: 100%;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.cart-table table {
    width: 100%;
    border-collapse: collapse;
}

.cart-table th {
    background: #f5f5f5;
    padding: 12px;
    text-align: left;
    font-weight: 500;
    border-bottom: 1px solid #e0e0e0;
}

.cart-table td {
    padding: 15px 12px;
    border-bottom: 1px solid #f0f0f0;
}

.cart-item-image {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.quantity-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quantity-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
}

.quantity-input {
    width: 50px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
}

/* 移动端购物车优化 */
@media (max-width: 768px) {
    .cart-table {
        overflow-x: auto;
    }
    
    .cart-table table {
        min-width: 600px;
    }
    
    .cart-table th, .cart-table td {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .cart-item-image {
        width: 60px;
        height: 60px;
    }
    
    .quantity-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .quantity-input {
        width: 40px;
        font-size: 13px;
    }
}

/* =============================================
   结算页面步骤指示（响应式）
   ============================================= */
.checkout-steps {
    background: #fff;
    padding: 20px;
    margin-bottom: 24px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.checkout-steps .container {
    padding: 0;
}

.steps {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: #999;
    transition: all 0.3s;
}

.step.done {
    color: #4caf50;
}

.step.active {
    color: #e4393c;
    font-weight: 600;
}

.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f0f0f0;
    color: #999;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
}

.step.done .step-num {
    background: #4caf50;
    color: #fff;
}

.step.active .step-num {
    background: #e4393c;
    color: #fff;
    box-shadow: 0 2px 8px rgba(228, 57, 60, 0.3);
}

.step-name {
    font-size: 13px;
    white-space: nowrap;
}

.step-arrow {
    color: #ddd;
    font-size: 24px;
    margin: 0 10px;
}

/* 移动端结算步骤优化 */
@media (max-width: 768px) {
    .checkout-steps {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .steps {
        gap: 12px;
        overflow-x: auto;
        padding: 0 8px;
    }
    
    .step {
        gap: 4px;
        min-width: fit-content;
    }
    
    .step-num {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
    
    .step-name {
        font-size: 11px;
    }
    
    .step-arrow {
        font-size: 18px;
        margin: 0 6px;
    }
}

/* =============================================
   结算页面区域（响应式）
   ============================================= */
.checkout-section {
    background: #fff;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.section-heading {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-icon {
    font-size: 18px;
}

/* 收货地址选择 */
.address-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.address-option {
    display: block;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    background: #fff;
}

.address-option:hover {
    border-color: #e4393c;
    background: #fff5f5;
}

.address-option.selected {
    border-color: #e4393c;
    background: #fff5f5;
    box-shadow: 0 2px 8px rgba(228, 57, 60, 0.15);
}

.address-option input[type="radio"] {
    margin-right: 8px;
}

.address-option-content {
    margin-left: 24px;
}

.address-receiver {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.address-phone {
    font-size: 13px;
    color: #666;
    font-weight: normal;
}

.default-tag {
    display: inline-block;
    background: #ff9800;
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 3px;
    font-weight: normal;
}

.address-full {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

.no-address {
    padding: 20px;
    text-align: center;
    color: #999;
}

.btn-link-small {
    display: inline-block;
    color: #e4393c;
    font-size: 13px;
    padding: 8px 0;
}

/* 商品清单表格 */
.order-items-table {
    width: 100%;
    border-collapse: collapse;
}

.order-items-table thead {
    background: #f5f5f5;
}

.order-items-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 13px;
}

.order-items-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.item-product {
    display: flex;
    align-items: center;
    gap: 12px;
}

.item-thumb {
    width: 60px;
    height: 60px;
    border-radius: 4px;
    object-fit: cover;
    background: #f5f5f5;
}

.item-name {
    color: #333;
    font-weight: 500;
}

.item-spec {
    color: #999;
    font-size: 12px;
}

.item-price {
    color: #e4393c;
    font-weight: 600;
}

.item-qty {
    color: #666;
}

.item-subtotal {
    color: #e4393c;
    font-weight: 600;
}

/* 买家留言 */
.remark-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.2s;
}

.remark-input:focus {
    outline: none;
    border-color: #e4393c;
}

.remark-count {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

/* 订单汇总布局 */
.order-summary-section {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
}

.order-summary-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.buyer-info-summary {
    padding-right: 20px;
    border-right: 1px solid #e0e0e0;
}

.buyer-info-detail {
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
}

.buyer-info-row {
    display: flex;
    margin-bottom: 10px;
    font-size: 13px;
}

.buyer-info-row:last-child {
    margin-bottom: 0;
}

.info-label {
    color: #999;
    min-width: 80px;
    font-weight: 500;
}

.info-value {
    color: #333;
    flex: 1;
    word-break: break-all;
}

.no-address-tip {
    color: #999;
    font-size: 13px;
    padding: 12px;
    background: #f5f5f5;
    border-radius: 6px;
}

/* 金额明细 */
.amount-summary {
    padding-left: 20px;
}

.amount-rows {
    background: #f5f5f5;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

.amount-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    color: #666;
}

.amount-row span:last-child {
    font-weight: 600;
    color: #333;
}

.free-shipping {
    color: #4caf50;
    font-weight: 600;
}

.discount-row span:last-child {
    color: #e4393c;
}

.discount-amount {
    color: #e4393c;
    font-weight: 600;
}

.amount-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 8px 0;
}

.amount-final {
    padding: 12px 0;
    font-size: 16px;
    border-top: 1px solid #e0e0e0;
}

.final-label {
    font-weight: 600;
    color: #333;
}

.final-price {
    font-size: 20px;
    font-weight: 700;
    color: #e4393c;
}

/* 提交订单区域 */
.submit-order-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.submit-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #fff5f5;
    border-radius: 6px;
    font-size: 13px;
    color: #333;
}

.submit-price {
    font-size: 18px;
    color: #e4393c;
}

.btn-submit-order {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #e4393c 0%, #d32f2f 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(228, 57, 60, 0.2);
}

.btn-submit-order:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(228, 57, 60, 0.3);
}

.btn-submit-order:active {
    transform: translateY(0);
}

.btn-alipay {
    background: linear-gradient(135deg, #e4393c 0%, #d32f2f 100%);
}

/* 移动端订单汇总优化 */
@media (max-width: 768px) {
    .checkout-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .section-heading {
        font-size: 15px;
        margin-bottom: 12px;
    }
    
    .address-selector {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .address-option {
        padding: 10px;
    }
    
    .order-summary-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .buyer-info-summary {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        padding-bottom: 16px;
    }
    
    .amount-summary {
        padding-left: 0;
    }
    
    .order-items-table th,
    .order-items-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .item-thumb {
        width: 50px;
        height: 50px;
    }
    
    .item-product {
        gap: 8px;
    }
    
    .remark-input {
        font-size: 14px;
    }
    
    .buyer-info-row {
        font-size: 12px;
    }
    
    .info-label {
        min-width: 70px;
    }
    
    .amount-row {
        font-size: 12px;
    }
    
    .amount-final {
        font-size: 14px;
    }
    
    .final-price {
        font-size: 18px;
    }
    
    .submit-info {
        font-size: 12px;
    }
    
    .submit-price {
        font-size: 16px;
    }
    
    .btn-submit-order {
        padding: 12px;
        font-size: 15px;
    }
}

/* =============================================
   地址管理（响应式）
   ============================================= */
.address-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.address-card {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.address-card:hover {
    border-color: #e4393c;
}

.address-card.selected {
    border-color: #e4393c;
    background: #fff5f5;
}

.default-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff9800;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
}

/* 移动端地址管理优化 */
@media (max-width: 768px) {
    .address-list {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .address-card {
        padding: 12px;
    }
}

/* =============================================
   按钮样式
   ============================================= */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    border: none;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #c62828;
}

/* =============================================
   底部
   ============================================= */
.site-footer {
    background: #333;
    color: #999;
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

@media (max-width: 768px) {
    .site-footer {
        padding: 15px;
        font-size: 12px;
    }
}

/* =============================================
   工具类
   ============================================= */
.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* 移动端隐藏 */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* PC端隐藏 */
@media (min-width: 769px) {
    .hide-desktop {
        display: none !important;
    }
}
