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

/* 根字号与防缩放：保持 1rem≈16px，与历史 px/rem 混用兼容；勿随意改 html 为 62.5% */
html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* 媒体不撑破容器（移动适配基线） */
img,
picture,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.4;
    background-color: #f5f5f5;
    color: #333;
    padding-bottom: 60px; /* 为底部导航留出空间 */
}

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

/* 头部样式 */
.header {
    background: #fff;
    padding: 10px 15px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 微信环境隐藏页面自带头部 */
body.is-wechat .header {
    display: none;
}

/* 微信环境消除顶部留白 */
body.is-wechat {
    padding-top: 0;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.location {
    display: flex;
    align-items: center;
    white-space: nowrap;
    padding: 5px 10px;
    background: #f5f5f5;
    border-radius: 15px;
    cursor: pointer;
}

.location i {
    color: #1890ff;
    margin-right: 3px;
    font-size: 14px;
}

.location span {
    color: #333;
    font-size: 14px;
    margin-right: 3px;
}

.location .fa-chevron-down {
    color: #999;
    font-size: 12px;
}

.search-bar {
    flex: 1;
    position: relative;
    background: #f5f5f5;
    border-radius: 15px;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    min-width: 0; /* 防止搜索框溢出 */
}

.search-bar i {
    color: #999;
    margin-right: 8px;
    font-size: 14px;
}

.search-bar input {
    border: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
    outline: none;
}

.search-bar input::placeholder {
    color: #999;
}

/* 轮播图样式 */
.banner-slider {
    position: relative;
    overflow: hidden;
    height: 160px;
    background: #f5f5f5;
}

.slider-container {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%;
}

.slide {
    flex: 0 0 100%;
    position: relative;
    height: 100%;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide-text {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    z-index: 1;
}

.slide-text h2 {
    font-size: 20px;
    margin-bottom: 5px;
}

.slide-text p {
    font-size: 14px;
}

/* 轮播控制按钮 */
.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: background-color 0.3s;
}

.slider-btn:hover {
    background: rgba(0, 0, 0, 0.5);
}

.slider-btn.prev {
    left: 10px;
}

.slider-btn.next {
    right: 10px;
}

/* 轮播指示器 */
.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 2;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: all 0.3s;
}

.dot.active {
    background: #fff;
    transform: scale(1.2);
}

/* 服务分类样式 */
.service-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    padding: 15px;
    background: #fff;
    margin-top: 10px;
}

.service-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 10px 0;
}

.service-item img {
    width: 44px;
    height: 44px;
    margin-bottom: 8px;
}

.service-item span {
    font-size: 12px;
    color: #333;
}

/* 精品商城样式 */
.mall-section {
    margin-top: 10px;
    background: #fff;
    padding: 15px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 0 5px;
}

.section-header h2 {
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

.more {
    color: #999;
    font-size: 12px;
    text-decoration: none;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.product-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.product-img {
    position: relative;
    padding-top: 100%; /* 1:1 宽高比 */
}

.product-img img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-info {
    padding: 8px 10px;
}

.product-info h3 {
    font-size: 14px;
    color: #333;
    margin: 0 0 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

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

.price {
    color: #ff4d4f;
    font-size: 16px;
    font-weight: bold;
    margin: 4px 0;
}

.price::before {
    /* 兼容多端：价格文案通常已包含“¥”，避免重复显示 */
    content: '';
    font-size: 12px;
    margin-right: 0;
}

.sales {
    color: #999;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 底部导航栏样式 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 0;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.1);
    z-index: 1000;
}

.nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999;
    font-size: 12px;
    padding: 4px 0;
}

.nav-item i {
    font-size: 20px;
    margin-bottom: 3px;
}

.nav-item span {
    font-size: 11px;
    line-height: 1.2;
}

.nav-item.active {
    color: #1890ff;
}

.nav-item .badge {
    position: absolute;
    top: -2px;
    right: 50%;
    transform: translateX(8px);
    background: #ff4d4f;
    color: #fff;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 8px;
    min-width: 16px;
    height: 16px;
    line-height: 12px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(255,77,79,0.2);
}

/* 适配iPhone X 等带有底部安全区域的设备 */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
}

/* 响应式调整 */
@media (max-width: 320px) {
    .nav-item i {
        font-size: 18px;
    }
    
    .nav-item span {
        font-size: 10px;
    }
    
    .nav-item .badge {
        font-size: 9px;
        min-width: 14px;
        height: 14px;
        line-height: 10px;
        padding: 2px 4px;
    }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .service-grid {
        grid-template-columns: repeat(4, 1fr); /* 保持4列布局 */
        gap: 10px;
        padding: 10px;
    }

    .service-item img {
        width: 36px;
        height: 36px;
        margin-bottom: 6px;
    }

    .service-item span {
        font-size: 11px;
    }
    
    .nav {
        display: none;
    }
    
    .header .container {
        flex-direction: column;
    }
    
    .user-actions {
        margin-top: 15px;
    }

    .product-grid {
        gap: 8px;
    }

    .product-info {
        padding: 6px 8px;
    }

    .product-info h3 {
        font-size: 13px;
    }

    .product-spec {
        font-size: 11px;
    }
    
    .price {
        font-size: 15px;
    }
    
    .sales {
        font-size: 11px;
    }
}

/* ===== 合并自 public/css/style.css 的通用布局和组件样式 ===== */
/* 页面整体最小高度和底部自适应 */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.footer {
    margin-top: auto;
}

/* 导航栏通用阴影和标题加粗 */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    font-weight: bold;
}

/* 卡片阴影与边框 */
.card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    border: none;
    margin-bottom: 1rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.card-title {
    color: #333;
    font-weight: 600;
}

/* 表格基础样式 */
.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: #495057;
}

.table td {
    vertical-align: middle;
}

/* 徽章、按钮、表单、警告框、加载动画等公共样式 */
.badge {
    padding: 0.5em 0.75em;
    font-weight: 500;
}

.btn {
    font-weight: 500;
    padding: 0.5rem 1rem;
}

.btn-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

.btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.form-control {
    border: 1px solid #ced4da;
    padding: 0.5rem 0.75rem;
}

.form-control:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13,110,253,0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
}

.alert {
    border: none;
    border-radius: 0.25rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.loading {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(0,0,0,0.1);
    border-radius: 50%;
    border-top-color: #0d6efd;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .display-4 {
        font-size: 2.5rem;
    }
}