/* Main Styles for CNfans Spreadsheet Finds */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    background-color: #ffffff;
    color: #333;
    line-height: 1.6;
}

/* Header Styles */
header {
    background-color: white;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s ease;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px;
}

.header-bottom {
    padding: 0 25px 15px 25px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: #ff6347;
    text-decoration: none;
    transition: transform 0.2s ease, color 0.2s ease;
    display: flex;
    align-items: center;
}

.logo:hover {
    transform: scale(1.05);
    color: #ff4500;
}

.search-container {
    position: relative;
    flex: 0 1 450px;
    margin: 0 20px;
    display: flex;
    align-items: center;
}

.search-box {
    width: 100%;
    padding: 10px 18px;
    border: 1px solid #eee;
    border-radius: 20px;
    font-size: 14px;
    background-color: #f9f9f9;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    outline: none;
}

.search-box:focus {
    border-color: #ff6347;
    background-color: white;
    box-shadow: 0 1px 5px rgba(255,99,71,0.2);
}

.search-icon {
    position: absolute;
    right: 18px;
    color: #999;
    cursor: pointer;
    font-size: 15px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.search-icon:hover {
    color: #ff6347;
    transform: scale(1.1);
}

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

.nav-links a {
    margin-left: 20px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
}

.nav-links a i {
    margin-right: 6px;
}

.nav-links a:hover {
    color: #ff6347;
    background-color: rgba(255,99,71,0.08);
}

/* Navigation Bar Styles */
nav {
    display: flex;
    justify-content: flex-start;
    padding: 12px 20px;
    background-color: white;
    margin-bottom: 15px;
    overflow-x: auto;
    white-space: nowrap;
    box-shadow: 0 1px 5px rgba(0,0,0,0.05);
    scrollbar-width: thin;
    scrollbar-color: #ff6347 #f0f0f0;
}

/* Custom scrollbar for webkit browsers */
nav::-webkit-scrollbar {
    height: 4px;
}

nav::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 10px;
}

nav::-webkit-scrollbar-thumb {
    background-color: #ff6347;
    border-radius: 10px;
}

nav a {
    margin: 0 10px;
    text-decoration: none;
    color: #333;
    font-weight: normal;
    padding: 8px 12px;
    transition: all 0.2s ease;
    font-size: 14px;
    border-radius: 20px;
    display: flex;
    align-items: center;
}

nav a i {
    margin-right: 6px;
    font-size: 15px;
}

nav a:hover {
    color: #ff6347;
    background-color: rgba(255,99,71,0.08);
}

nav a.active {
    color: #ff6347;
    font-weight: 500;
}

/* Container and Grid Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 10px;
    margin-top: 20px; /* 添加顶部边距，避免产品被搜索框遮挡 */
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 30px;
}

/* Product Card Styles */
.product-card {
    background-color: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    animation: fadeIn 0.5s ease-in-out;
    position: relative;
    border: 1px solid #f0f0f0;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    border-color: #e0e0e0;
}

.product-card a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 25px;
    grid-column: 1 / -1;
    color: #666;
    font-size: 15px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    margin: 10px 0;
}

.loading-indicator i {
    margin-right: 12px;
    color: #ff6347;
    font-size: 18px;
    animation: spin 1s infinite linear;
}

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

/* Animation for product cards */
.fade-in {
    opacity: 0;
    animation: fadeIn 0.5s ease-in forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.product-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

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

.product-info {
    padding: 12px;
    border-top: 1px solid #f5f5f5;
}

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

.product-price {
    font-weight: bold;
    color: #ff6347;
    font-size: 16px;
    margin: 0;
    display: flex;
    align-items: center;
}

.us-price, .eur-price {
    display: inline-block;
    position: relative;
}

/* 移除了货币符号伪元素，因为数据中已包含符号 */

.us-price {
    font-weight: bold;
    font-size: 15px;
    color: #ff6347;
}

.eur-price {
    color: #666;
    font-size: 13px;
    margin-left: 8px;
}

.no-products, .error-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: #666;
    font-size: 16px;
}

.error-message {
    color: #ff4500;
}

.loading-indicator, .loading-more-indicator {
    text-align: center;
    padding: 20px;
    font-size: 16px;
    color: #666;
    width: 100%;
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    grid-column: 1 / -1;
}

.end-message {
    text-align: center;
    padding: 25px;
    font-size: 15px;
    color: #666;
    width: 100%;
    margin: 10px auto;
    grid-column: 1 / -1;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    font-weight: 500;
    border: 1px dashed #ddd;
}

/* Floating Buttons */
.floating-buttons {
    position: fixed;
    bottom: 25px;
    left: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
}

.float-btn {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s;
    font-size: 18px;
}

.help-btn {
    background-color: #0088cc;
}

.telegram-icon, .whatsapp-icon {
    width: 60px;
    height: 60px;
    object-fit: contain;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    margin-bottom: 0px;
}

.telegram-icon:hover {
    transform: scale(1.1);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background-color: #ff6347;
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
    font-size: 18px;
}

.back-to-top:hover {
    background-color: #ff4500;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.back-to-top.visible {
    opacity: 1;
}

.telegram-icon:hover, .whatsapp-icon:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .products-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        margin-top: 30px; /* 在平板设备上增加顶部边距 */
    }
    
    .products-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    /* Header adjustments for mobile */
    .header-top {
        padding: 12px 15px;
    }
    
    .header-bottom {
        padding: 0 15px 12px 15px;
    }
    
    .logo {
        font-size: 16px;
    }
    
    .search-container {
        flex: 1;
        margin: 0;
        width: 100%;
    }
    
    .search-box {
        width: 100%;
        padding: 8px 12px;
        font-size: 13px;
        border-radius: 16px;
    }
    
    .nav-links a {
        display: none;
    }
    
    .nav-links a:first-child {
        display: inline;
        margin-left: 0;
        padding: 5px 8px;
    }

    /* Mobile Navigation */
    .mobile-menu-btn {
        display: block;
        cursor: pointer;
        font-size: 20px;
        color: #333;
        transition: transform 0.2s ease;
        padding: 5px;
        border-radius: 4px;
    }
    
    .mobile-menu-btn:hover {
        transform: scale(1.1);
        background-color: rgba(255,99,71,0.08);
    }
    
    /* Mobile Navigation styles */
    nav {
        flex-direction: column;
        align-items: flex-start;
        background-color: white;
        position: fixed;
        top: 100px; /* Adjusted to account for both header-top and header-bottom */
        left: 0;
        width: 100%;
        height: 0;
        overflow: hidden;
        transition: all 0.3s ease;
        z-index: 99;
        box-shadow: 0 5px 15px rgba(0,0,0,0.1);
        border-top: 1px solid #f0f0f0;
    }

    nav.active {
        height: auto;
        padding: 10px 0;
        overflow-y: auto;
        max-height: 80vh;
    }

    nav a {
        display: flex;
        align-items: center;
        padding: 14px 20px;
        margin: 0;
        width: 100%;
        border-bottom: 1px solid #f5f5f5;
        border-radius: 0;
        font-size: 15px;
        font-weight: 500;
    }

    nav a i {
        margin-right: 12px;
        width: 20px;
        text-align: center;
        font-size: 16px;
        color: #ff6347;
    }

    nav a:last-child {
        border-bottom: none;
    }
    
    nav a.active {
        background-color: rgba(255,99,71,0.08);
        border-left: 3px solid #ff6347;
    }
}

@media (max-width: 480px) {
    .container {
        margin-top: 40px; /* 在手机设备上增加更大的顶部边距 */
    }
    
    .products-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    
    /* Header adjustments for very small screens */
    .header-top {
        padding: 10px 12px;
    }
    
    .header-bottom {
        padding: 0 12px 10px 12px;
    }
    
    .logo {
        font-size: 15px;
    }
    
    .search-container {
        margin: 0;
    }
    
    .search-box {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .search-icon {
        right: 10px;
        font-size: 12px;
    }
    
    .nav-links a:first-child {
        padding: 4px 6px;
        font-size: 13px;
    }
    
    .mobile-menu-btn {
        font-size: 18px;
        padding: 4px;
    }
    
    /* Adjust nav position for smaller screens */
    nav {
        top: 90px; /* Smaller top value for smaller screens */
    }
    
    /* Product adjustments for very small screens */
    .product-image {
        height: 140px;
    }
    
    .product-title {
        font-size: 11px;
        height: 30px;
    }
    
    .product-price {
        font-size: 13px;
    }
    
    /* Navigation adjustments for very small screens */
    nav a {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    nav a i {
        margin-right: 10px;
        font-size: 15px;
    }
}