/* ======================================
   全局重置与兼容性基础（解决所有浏览器差异）
   ====================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f5f7fa;
    padding-bottom: 70px; /* 底部导航高度 */
    line-height: 1.5;
}

/* 禁止微信和浏览器自动调整字体大小 */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-size-adjust: 100% !important;
    -webkit-text-size-adjust: 100% !important;
}

.container {
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

/* ======================================
   卡片式设计（统一所有设备表现）
   ====================================== */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 15px;
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100% !important;
}

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

.card-img {
    width: 100%;
    aspect-ratio: 1/1 !important;
    object-fit: cover !important;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

/* 合成页面小卡片图片也统一1:1 */
.card .card .card-img {
    height: 100px !important;
    aspect-ratio: 1/1 !important;
    object-fit: cover !important;
    border-radius: 4px;
}

.card-body {
    padding: 15px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    height: 22px;
    line-height: 22px;
}

.card-text {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    height: 20px;
    line-height: 20px;
}

.card-price {
    font-size: 18px;
    font-weight: 700;
    color: #e63946;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #f5f5f5;
    margin-top: auto;
    flex-shrink: 0;
}

.status-tag {
    height: 32px;
    line-height: 32px;
    text-align: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
}

/* ======================================
   全局网格布局（强制两列，所有设备一致）
   ====================================== */
.grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 15px !important;
    width: 100%;
}

.grid .card {
    width: 100% !important;
    margin: 0 !important;
}

/* ======================================
   底部导航栏（固定底部，所有设备一致）
   ====================================== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: 60px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom); /* 适配iPhone底部安全区 */
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #999;
    font-size: 12px;
    flex: 1;
    height: 100%;
    justify-content: center;
}

.nav-item.active {
    color: #4361ee;
}

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

/* ======================================
   轮播图（自适应所有屏幕）
   ====================================== */
.banner {
    width: 100%;
    height: 180px;
    overflow: hidden;
    margin-bottom: 15px;
    border-radius: 12px;
    position: relative;
}

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

/* ======================================
   分类标签
   ====================================== */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.tag {
    padding: 6px 12px;
    background: white;
    border-radius: 20px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
}

.tag.active {
    background: #4361ee;
    color: white;
}

/* ======================================
   按钮样式（统一所有设备）
   ====================================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-primary {
    background: transparent;
    color: #4361ee;
    border: 1px solid #4361ee;
}

.btn-primary:hover {
    background: rgba(67, 97, 238, 0.1);
    color: #4361ee;
    border-color: #4361ee;
}

.btn-primary:active {
    background: rgba(67, 97, 238, 0.2);
    transform: scale(0.98);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

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

.btn-sm {
    padding: 6px 16px;
    font-size: 14px;
}

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

/* ======================================
   表单样式（统一所有设备）
   ====================================== */
.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    -webkit-appearance: none;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: #4361ee;
}

/* ======================================
   我的页面
   ====================================== */
.profile-header {
    background: linear-gradient(135deg, #4361ee, #7209b7);
    color: white;
    padding: 30px 15px;
    text-align: center;
    margin-bottom: 15px;
    padding-top: calc(30px + env(safe-area-inset-top)); /* 适配iPhone刘海 */
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid white;
    margin-bottom: 10px;
}

.menu-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.menu-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #f5f7fa;
    text-decoration: none;
    color: #333;
}

.menu-item:last-child {
    border-bottom: none;
}

/* ======================================
   弹窗样式
   ====================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

/* ======================================
   数量选择器
   ====================================== */
.quantity-selector {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.quantity-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f5f5f5;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

.quantity-input {
    flex: 1;
    height: 36px;
    border: none;
    text-align: center;
    font-size: 16px;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    padding: 0;
    -webkit-appearance: none;
    appearance: none;
}

/* ======================================
   工具类
   ====================================== */
.d-flex {
    display: flex !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

.text-center {
    text-align: center !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 5px !important;
}

.mb-2 {
    margin-bottom: 10px !important;
}

.mb-3 {
    margin-bottom: 15px !important;
}

/* ======================================
   强制覆盖所有浏览器默认样式（最高优先级）
   ====================================== */
img {
    max-width: 100% !important;
    height: auto !important;
    display: block;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

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

ul, ol {
    list-style: none;
}