/* ===== 字体声明 ===== */
@font-face {
    font-family: 'Bradley Hand';
    src: url('../fonts/Bradley Hand Bold.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* 重置和基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 移除所有元素的默认focus outline */
*:focus {
    outline: none;
}

/* 移除移动设备上的点击高亮 */
* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    overflow-x: hidden;
}

/* 响应式容器 */
.container {
    max-width: 480px;
    min-width: 320px;
    margin: 0 auto;
    padding: 0 10px;
}

/* ===== 导航栏样式 ===== */
.back-nav {
    background: #f5c1b5;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.back-nav .back-btn,
.back-nav .home-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.back-nav .back-btn:hover,
.back-nav .home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.back-nav .back-btn:active,
.back-nav .home-btn:active {
    transform: translateY(0);
}

/* ===== 精美搜索框区域 ===== */
.search-section {
    background: #f5c1b5;
    padding: 35px 12px 20px;
    position: relative;
    overflow: hidden;
}

.search-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255,255,255,0.1) 0%, transparent 100%);
    pointer-events: none;
}

.mobile-search-container {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.search-box {
    position: relative;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 25px;
    padding: 3px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.mobile-search-input {
    flex: 1;
    padding: 12px 60px 12px 18px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    background: transparent;
    color: #333;
    outline: none;
    font-weight: 400;
    line-height: 1.4;
}

.mobile-search-input::placeholder {
    color: #999;
    font-size: 15px;
    font-weight: 400;
}

.mobile-search-input:focus {
    background: rgba(255, 255, 255, 0.9);
}

.search-button {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e8e 100%);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    color: white;
}

.search-button:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(255, 107, 107, 0.4);
}

.search-button:active {
    transform: translateY(-50%) scale(0.95);
}

.search-button svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.5;
}

/* ===== 顶部导航栏 ===== */
.header {
    background-color: #fff;
    padding: 10px 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.brand-logo {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    height: 50px; /* 进一步增加高度 */
    padding: 5px 0; /* 增加一些垂直间距 */
}

.logo-image {
    height: 155px;
    width: auto;
    max-width: 250px; /* 进一步增加最大宽度 */
    object-fit: contain;
    filter: brightness(1.05); /* 稍微提高亮度 */
    margin-top:25px;
    margin-left:-30px;
}

.language-switch {
    cursor: pointer;
    padding: 5px;
}

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

.search-bar {
    width: 100%;
}

.search-container {
    position: relative;
    display: flex;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 10px 85px 10px 15px;
    border: 1px solid #ddd;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    background-color: #f8f8f8;
}

.search-input:focus {
    border-color: #007bff;
    background-color: #fff;
}

.search-btn {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.search-btn:hover {
    background-color: #0056b3;
}

/* ===== 轮播图区域 ===== */
.banner-carousel {
    background-color: #fff;
    margin-bottom: 10px;
    overflow: hidden;
}

.carousel-container {
    position: relative;
    max-width: 480px;
    margin: 0 auto;
    background-color: #f8f8f8;
}

.carousel-slides {
    position: relative;
    width: 100%;
    height: 280px;
    overflow: hidden;
}

.slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.slide.active {
    opacity: 1;
}

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

.carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-indicators .indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.carousel-indicators .indicator.active {
    background-color: rgba(255, 255, 255, 0.9);
}

/* ===== 分类标题区 ===== */
.category-title-section {
    background-color: #fff;
    padding: 20px 0 15px;
    margin-bottom: 0;
}

.category-title-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    gap: 15px;
}

.category-title {
    font-family: 'Bradley Hand', cursive, sans-serif;
    font-size: 18px;
    font-weight: normal;
    color: #333;
    margin: 0;
    white-space: nowrap;
    text-transform: lowercase;
}

.title-line {
    flex: 1;
    height: 1px;
    background-color: #ddd;
    min-width: 20px;
}

.left-line {
    margin-right: 0;
}

.right-line {
    margin-left: 0;
}

/* ===== 分类导航区 ===== */
.category-navigation {
    background-color: #fff;
    padding: 15px 0;
    margin-bottom: 15px;
}

.category-container {
    padding: 0 15px;
}

.category-row {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 0;
}

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

.category-row-last {
    justify-content: flex-start;
}

.category-item {
    width: 25%;
    text-align: center;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.category-item:focus {
    outline: none;
}

.category-icon {
    width: 100%;
    height: 80px;
    background-color: transparent;
    border: none;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 8px 0;
    font-size: 32px;
    color: #333;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.category-name {
    font-family: 'Bradley Hand', cursive, sans-serif;
    font-size: 12px;
    color: #333;
    line-height: 1.2;
    text-align: center;
    display: block;
    font-weight: normal;
}

/* 每行第一个分类项的左侧圆角 */
.category-item:first-child .category-icon {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    overflow: hidden;
}

.category-item:first-child .category-icon img {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

/* 每行最后一个分类项的右侧圆角 */
.category-item:last-child .category-icon {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    overflow: hidden;
}

.category-item:last-child .category-icon img {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}



/* ===== 商品展示区 ===== */
.product-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 15px 20px;
}

.product-card {
    background-color: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
}

.product-image {
    width: 100%;
    height: 240px; /* 根据1440:2122比例优化，完整显示竖向长图 */
    background-color: #f8f8f8;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #999;
    border-radius: 12px 12px 0 0;
}

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

.product-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

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

.product-size {
    font-size: 12px;
    color: #666;
    margin: 0;
    background: #f8f9fa;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

/* ===== 响应式设计 ===== */
@media (max-width: 360px) {
    .search-section {
        padding: 30px 10px 16px;
    }

    .mobile-search-input {
        padding: 10px 55px 10px 15px;
        font-size: 15px;
    }

    .mobile-search-input::placeholder {
        font-size: 14px;
    }

    .search-button {
        width: 36px;
        height: 36px;
        right: 3px;
    }

    .search-button svg {
        width: 18px;
        height: 18px;
    }

    .header {
        padding: 8px 12px;
    }
    
    .brand-logo {
        font-size: 18px;
    }
    
    .search-input {
        padding: 8px 75px 8px 12px;
        font-size: 13px;
    }
    
    .search-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .category-icon {
        width: 100%;
        height: 65px;
        font-size: 28px;
    }
    
    .category-name {
        font-size: 10px;
    }

    .category-title {
        font-size: 16px;
    }

    .category-title-container {
        padding: 0 15px;
        gap: 12px;
    }
    
    .product-image {
        height: 220px; /* 根据1440:2122比例优化 */
    }
    
    .product-info {
        padding: 10px;
        gap: 6px;
    }

    .product-details {
        margin-top: 2px;
    }

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

    .product-size {
        font-size: 10px;
        padding: 1px 6px;
    }
}

@media (min-width: 400px) {
    .search-section {
        padding: 40px 15px 22px;
    }

    .mobile-search-input {
        padding: 14px 65px 14px 20px;
        font-size: 16px;
    }

    .search-button {
        width: 44px;
        height: 44px;
        right: 4px;
    }

    .search-button svg {
        width: 22px;
        height: 22px;
    }

    .category-icon {
        width: 100%;
        height: 90px;
        font-size: 36px;
    }
    
    .category-name {
        font-size: 12px;
    }

    .category-title {
        font-size: 20px;
    }

    .category-title-container {
        padding: 0 25px;
        gap: 18px;
    }
    
    .product-image {
        height: 260px; /* 根据1440:2122比例优化 */
    }
    
    .product-price {
        font-size: 17px;
    }
    
    .product-size {
        font-size: 13px;
    }
}

/* ===== 动画效果 ===== */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
    .category-item:hover,
    .product-card:hover {
        transform: none;
    }
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== 动态加载相关样式 ===== */
.loading-indicator {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    display: none;
    z-index: 1000;
    text-align: center;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

.no-products-message,
.error-message {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 20px;
}

.error-message button {
    margin-top: 15px;
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.error-message button:hover {
    background: #5a67d8;
}

.page-info {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 14px;
}

/* 商品卡片样式优化 */
.product-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

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

.product-image img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* 完整显示竖向长图，不裁剪 */
    transition: transform 0.3s ease;
}

.product-card:hover .product-image img {
    transform: scale(1.05);
}

.product-card .product-title {
    display: none; /* 隐藏商品卡片标题 */
}

.product-code {
    font-size: 10px;
    color: #999;
    margin: 4px 0 0 0;
    font-family: monospace;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .loading-indicator {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
    }
}

/* ===== 电脑端专用样式 ===== */
@media (min-width: 769px) {
    /* 轮播图区域背景色与搜索框保持一致 */
    .banner-carousel {
        background-color: #f5c1b5 !important;
    }
    
    /* 分类图标高度增加，让图片显示完整 */
    .category-icon {
        height: 150px !important;
    }
    
    /* 商品网格布局：一行4个，竖向布局 */
    .product-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 20px !important;
    }
    
    /* 商品卡片竖向布局，高度增加 */
    .product-card {
        display: flex !important;
        flex-direction: column !important;
    }
    
    /* 商品图片高度根据1440:2122比例优化 */
    .product-image {
        height: 350px !important;
        flex-shrink: 0;
    }
    
    .product-image img {
        object-fit: contain !important;  /* 完整显示竖向长图 */
    }
    
    /* 商品信息区域 */
    .product-info {
        padding: 12px !important;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .product-price {
        font-size: 18px !important;
    }
    
    .product-size {
        font-size: 14px !important;
    }
}