/* ========================================
   醉美家乡 - 移动端样式（全面重写）
   适配：手机竖屏 / 平板竖屏
   ======================================== */

/* === 基础重置 === */
@media screen and (max-width: 850px) {
    html, body {
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
        margin: 0;
        padding: 0;
    }

    .container {
        width: 100%;
        max-width: 100%;
        padding: 0 12px;
        margin: 0 auto;
        box-sizing: border-box;
    }

    /* === 顶部工具栏 - 移动端隐藏 === */
    .top-toolbar {
        display: none;
    }

    /* === 主导航头 - 紧凑红色条 === */
    .main-header {
        position: sticky;
        top: 0;
        z-index: 100;
        padding: 6px 10px;
        background: var(--primary);
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    .main-header-inner {
        gap: 6px;
        padding: 0;
        height: auto;
        min-height: 40px;
    }
    .main-logo {
        display: none; /* 移动端隐藏logo，搜索框占满 */
    }
    .main-search {
        flex: 1;
        min-width: 0;
        order: 1;
    }
    .search-box {
        height: 34px;
        border-radius: 17px;
        background: #fff;
        box-shadow: none;
    }
    .search-box input {
        padding: 0 14px;
        font-size: 13px;
        height: 34px;
        color: #333;
    }
    .search-box input::placeholder {
        color: #999;
    }
    .search-btn {
        height: 28px;
        margin-right: 4px;
        background: var(--primary);
        color: #fff;
        border-radius: 14px;
        padding: 0 12px;
        font-size: 12px;
        align-self: center;
    }
    .search-btn span,
    .search-btn .btn-text {
        display: none;
    }
    .hot-keywords {
        display: none;
    }
    .main-actions {
        order: 3;
        gap: 4px;
        flex-shrink: 0;
    }
    .action-btn {
        width: 34px;
        height: 34px;
        padding: 0;
        border-radius: 50%;
        background: rgba(255,255,255,0.15);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0;
        min-height: 34px;
        min-width: 34px;
    }
    .action-btn i {
        font-size: 16px;
        color: #fff;
    }
    .action-text {
        display: none;
    }

    /* === 分类导航条 - 移动端隐藏 === */
    .category-nav {
        display: none;
    }

    /* === 功能入口按钮区 === */
    .mobile-shortcuts {
        display: block;
        margin: 10px 12px 0;
    }
    .mobile-shortcuts-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 10px 4px;
        padding: 12px 8px;
        background: #fff;
        border-radius: 12px;
        box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    }
    .mobile-shortcut {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 5px;
        text-decoration: none;
        color: #333;
        padding: 2px 0;
        transition: transform 0.15s;
    }
    .mobile-shortcut:active {
        transform: scale(0.92);
    }
    .shortcut-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        color: #fff;
    }
    .shortcut-meat { background: linear-gradient(135deg, #ff6b6b, #c8161d); }
    .shortcut-mushroom { background: linear-gradient(135deg, #f5a623, #e67e22); }
    .shortcut-grain { background: linear-gradient(135deg, #2ecc71, #16a085); }
    .shortcut-dry { background: linear-gradient(135deg, #9b59b6, #6c3483); }
    .shortcut-weave { background: linear-gradient(135deg, #e67e22, #d35400); }
    .shortcut-farm { background: linear-gradient(135deg, #27ae60, #1e8449); }
    .shortcut-promo { background: linear-gradient(135deg, #ff6348, #ee5a24); }
    .shortcut-cart { background: linear-gradient(135deg, #3498db, #2980b9); }
    .shortcut-user { background: linear-gradient(135deg, #e74c3c, #c0392b); }
    .shortcut-service { background: linear-gradient(135deg, #1abc9c, #16a085); }
    .mobile-shortcut span {
        font-size: 11px;
        color: #555;
        white-space: nowrap;
    }

    /* === Hero区 - 移动端简化 === */
    .hero-layout {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px 12px;
    }
    .hero-menu {
        display: none;
    }
    .hero-side {
        flex-direction: row;
        gap: 10px;
    }
    .side-card {
        flex: 1;
        min-width: 0;
        padding: 10px;
    }
    .side-title {
        margin-bottom: 6px;
        padding-bottom: 6px;
    }
    .side-title span {
        font-size: 13px;
    }
    .side-list li {
        padding: 5px 0;
    }
    .side-list a {
        font-size: 11px;
        -webkit-line-clamp: 1;
    }
    .side-user-card {
        display: none;
    }
    .carousel-container {
        height: 160px;
        min-height: 160px;
        border-radius: 10px;
    }
    .hero-carousel {
        min-height: auto;
    }

    /* === 分类区 - 移动端隐藏（已有功能入口代替） === */
    .categories-section {
        display: none;
    }

    /* === 热门商品区 - 分类标签横向滚动 === */
    .products-section {
        margin: 12px;
    }
    .section-header {
        padding: 10px 0 6px;
    }
    .section-header h2 {
        font-size: 17px;
    }
    .section-header p {
        font-size: 12px;
    }
    .tab-nav {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding: 4px 0;
        scrollbar-width: none;
        justify-content: flex-start;
    }
    .tab-nav::-webkit-scrollbar {
        display: none;
    }
    .tab-btn {
        flex-shrink: 0;
        padding: 6px 14px;
        font-size: 12px;
        border-radius: 16px;
        white-space: nowrap;
        min-height: 32px;
        min-width: auto;
    }
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .product-image {
        height: 140px;
    }
    .product-info {
        padding: 8px;
    }
    .product-info h4 {
        font-size: 13px;
    }
    .price-current {
        font-size: 16px;
    }

    /* === 限时促销区 - 移动端竖向排列 === */
    .promo-card-unified {
        border-radius: 12px;
    }
    .pc-header {
        padding: 12px 14px 10px;
    }
    .pc-header h3 {
        font-size: 16px !important;
        letter-spacing: 1px;
    }
    .pc-header h3 i {
        font-size: 14px !important;
    }
    .pc-tag {
        font-size: 10px;
        margin-top: 4px;
    }
    .pc-body {
        flex-direction: column;
        min-height: auto;
    }
    .pc-left {
        width: 100%;
        min-width: 0;
    }
    .pc-img-wrap {
        height: 140px;
    }
    .pc-info {
        padding: 10px 14px;
    }
    .pc-info strong {
        font-size: 14px;
    }
    .pc-btn {
        padding: 8px;
        font-size: 13px;
    }
    .pc-divider {
        width: 100%;
        height: 1px;
    }
    .pc-right {
        padding: 10px 14px;
    }
    .pc-coupon-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .pc-coupon {
        padding: 8px 10px;
        gap: 6px;
    }
    .pc-coupon-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    .pc-coupon-detail em b {
        font-size: 18px;
    }
    .pc-coupon-detail span {
        font-size: 10px;
    }
    .pc-coupon-detail small {
        font-size: 8px;
    }
    .pc-coupon-btn {
        font-size: 10px;
        padding: 4px 8px;
    }
    .pc-sub-list {
        flex-direction: column;
    }
    .pc-sub-item {
        border-right: none;
        border-bottom: 1px solid #f5f5f5;
        padding: 8px 14px;
        font-size: 12px;
    }
    .pc-sub-item:last-child {
        border-bottom: none;
    }

    /* === 底部导航栏 === */
    .mobile-bottom-nav {
        display: grid;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 54px;
        background: #fff;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
        z-index: 200;
        grid-template-columns: repeat(5, 1fr);
        align-items: center;
        padding-bottom: env(safe-area-inset-bottom);
    }
    .mb-nav-item {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: #888;
        text-decoration: none;
        font-size: 10px;
        transition: color 0.2s;
        height: 100%;
    }
    .mb-nav-item i {
        font-size: 19px;
    }
    .mb-nav-item.active,
    .mb-nav-item:active {
        color: var(--primary);
    }
    .mb-nav-cart {
        position: relative;
    }
    .mb-badge {
        position: absolute;
        top: -4px;
        right: calc(50% - 18px);
        min-width: 16px;
        height: 16px;
        padding: 0 4px;
        background: var(--primary);
        color: #fff;
        border-radius: 8px;
        font-size: 10px;
        line-height: 16px;
        text-align: center;
        font-style: normal;
    }

    /* body底部留出导航栏空间 */
    body {
        padding-bottom: 60px;
    }
    .footer {
        padding-bottom: 70px;
    }
    .back-to-top,
    .floating-actions,
    .floating-action-btn {
        bottom: 70px !important;
    }

    /* === 关于我们 === */
    .about-section {
        padding: 20px 12px;
    }
    .about-content {
        flex-direction: column;
        gap: 15px;
    }
    .about-text {
        order: 2;
        width: 100%;
    }
    .about-image {
        order: 1;
        width: 100%;
        max-width: 280px;
        margin: 0 auto;
    }
    .about-features {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    /* === 页脚 === */
    .footer {
        padding: 20px 12px 10px;
    }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        text-align: center;
    }
    .footer-col h4 {
        font-size: 14px;
        margin-bottom: 8px;
    }
    .footer-col a, .footer-col p {
        font-size: 12px;
        text-align: center;
    }
    .footer-logo {
        justify-content: center;
    }
    .social-links {
        justify-content: center;
    }
    .footer-bottom {
        padding: 15px 0;
        font-size: 11px;
        text-align: center;
    }

    /* === 九宫格优势 === */
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .benefit-card {
        padding: 10px;
        gap: 8px;
    }
    .benefit-icon {
        width: 42px;
        height: 42px;
        font-size: 18px;
        flex-shrink: 0;
    }
    .benefit-text h4 {
        font-size: 13px;
    }
    .benefit-text p {
        font-size: 11px;
    }

    /* === 浮动按钮 === */
    .floating-actions {
        right: 10px;
        bottom: 70px;
        flex-direction: column;
        gap: 6px;
    }
    .floating-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* === 服务承诺区 === */
    .service-item {
        border-right: none;
        border-bottom: 1px solid #eee;
        padding: 10px;
        gap: 6px;
    }
    .service-item:last-child {
        border-bottom: none;
    }

    /* === 夏日专区 === */
    .summer-banner-left h2 {
        font-size: 18px;
    }
    .summer-products-grid {
        grid-template-columns: 1fr;
    }

    /* === 隐藏PC端专属 === */
    .desktop-only {
        display: none !important;
    }
}

/* === 小屏手机适配 (≤640px) === */
@media screen and (max-width: 640px) {
    .mobile-shortcuts-grid {
        gap: 8px 4px;
        padding: 10px 6px;
    }
    .shortcut-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
        border-radius: 10px;
    }
    .mobile-shortcut span {
        font-size: 10px;
    }
    .hero-section {
        display: none;
    }
    .product-image {
        height: 120px;
    }
    .product-info h4 {
        font-size: 12px;
    }
    .price-current {
        font-size: 15px;
    }
    .benefits-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .benefit-card {
        padding: 8px;
        gap: 6px;
        border-radius: 12px;
    }
    .benefit-icon {
        width: 38px;
        height: 38px;
        font-size: 16px;
        flex-shrink: 0;
    }
    .benefit-text h4 {
        font-size: 12px;
    }
    .benefit-text p {
        font-size: 10px;
    }
    .pc-header h3 {
        font-size: 14px !important;
    }
    .pc-img-wrap {
        height: 120px;
    }
    .pc-info strong {
        font-size: 13px;
    }
}

/* === 超小屏 (≤480px) === */
@media screen and (max-width: 480px) {
    .main-header {
        padding: 5px 8px;
    }
    .main-header-inner {
        min-height: 36px;
    }
    .search-box {
        height: 30px;
        border-radius: 15px;
    }
    .search-box input {
        height: 30px;
        font-size: 12px;
        padding: 0 10px;
    }
    .search-btn {
        height: 24px;
        padding: 0 8px;
        font-size: 11px;
    }
    .action-btn {
        width: 30px;
        height: 30px;
        min-height: 30px;
        min-width: 30px;
    }
    .action-btn i {
        font-size: 14px;
    }

    .mobile-shortcuts {
        margin: 8px 8px 0;
    }
    .mobile-shortcuts-grid {
        gap: 6px 2px;
        padding: 8px 4px;
    }
    .shortcut-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
        border-radius: 8px;
    }
    .mobile-shortcut span {
        font-size: 9px;
    }

    .carousel-container {
        height: 130px;
        min-height: 130px;
    }

    .tab-btn {
        padding: 5px 10px;
        font-size: 11px;
        min-height: 28px;
    }

    .products-grid {
        gap: 6px;
    }
    .product-image {
        height: 100px;
    }
    .product-info {
        padding: 6px;
    }
    .product-info h4 {
        font-size: 11px;
    }
    .price-current {
        font-size: 14px;
    }

    .mobile-bottom-nav {
        height: 50px;
    }
    .mb-nav-item i {
        font-size: 17px;
    }
    .mb-nav-item span {
        font-size: 9px;
    }
}

/* === 极小屏 (≤375px) === */
@media screen and (max-width: 375px) {
    .mobile-shortcuts-grid {
        gap: 4px 2px;
        padding: 6px 4px;
    }
    .shortcut-icon {
        width: 34px;
        height: 34px;
        font-size: 15px;
        border-radius: 8px;
    }
    .mobile-shortcut span {
        font-size: 9px;
    }

    .carousel-container {
        height: 110px;
        min-height: 110px;
    }

    .product-image {
        height: 90px;
    }
    .product-info h4 {
        font-size: 10px;
    }
    .price-current {
        font-size: 13px;
    }

    .tab-btn {
        padding: 4px 8px;
        font-size: 10px;
    }

    .pc-header h3 {
        font-size: 13px !important;
    }
    .pc-img-wrap {
        height: 100px;
    }
}

/* === PC端隐藏移动专属元素 === */
@media (min-width: 851px) {
    .mobile-bottom-nav {
        display: none !important;
    }
    .mobile-shortcuts {
        display: none;
    }
}

/* === 横屏适配 === */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .main-header-inner {
        flex-direction: row;
    }
    .hero-layout {
        grid-template-columns: 2fr 1fr;
    }
    .featured-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .benefits-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
