/*
 * Chelonian - 公共样式
 * 包含全局样式、公共顶部和底部样式
 */

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

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    background-color: #f5f5f5;
}

a {
    text-decoration: none;
    color: #333;
}

ul, li {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
}

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

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Logo样式 */
.logo {
    flex: 0 0 180px;
}

.logo img {
    height: 50px;
}

/* 导航菜单样式 */
.main-nav {
    flex: 1;
    margin: 0 20px;
}

.main-nav ul {
    display: flex;
    justify-content: center;
}

.main-nav li {
    margin: 0 15px;
    position: relative;
}

.main-nav li a {
    display: block;
    padding: 10px 0;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.3s;
}

.main-nav li a:hover {
    color: #ff6700;
}

.main-nav li.active a {
    color: #ff6700;
}

.main-nav li.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #ff6700;
}

/* 右侧功能区样式 */
.header-right {
    display: flex;
    align-items: center;
}

/* 搜索框样式 */
.search-box {
    position: relative;
    margin-right: 15px;
}

.search-box input {
    width: 200px;
    height: 36px;
    padding: 0 40px 0 15px;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
    transition: all 0.3s;
}

.search-box input:focus {
    width: 250px;
    border-color: #ff6700;
    outline: none;
}

.search-box button {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: transparent;
}

.search-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    background: url('https://cdn-icons-png.flaticon.com/512/149/149852.png') no-repeat center;
    background-size: contain;
}

/* 购物车图标样式 */
.cart-icon {
    position: relative;
    margin: 0 15px;
}

.cart-icon i {
    display: inline-block;
    width: 24px;
    height: 24px;
    background: url('https://cdn-icons-png.flaticon.com/512/263/263142.png') no-repeat center;
    background-size: contain;
}

.cart-count {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    background-color: #ff6700;
    color: #fff;
    border-radius: 8px;
    font-size: 12px;
    padding: 0 4px;
}

/* 用户头像样式 */
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

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

.default-avatar {
    display: block;
    width: 100%;
    height: 100%;
    background: url('https://cdn-icons-png.flaticon.com/512/149/149071.png') no-repeat center;
    background-size: cover;
}

/*
 * 公共底部样式
 */
.footer {
    background-color: #2f2f2f;
    color: #999;
    padding: 40px 0 20px;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* 固定底部样式 */
.footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 100;
}

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

/* 底部信息样式 */
.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid #3a3a3a;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-contact {
    flex: 1;
    min-width: 300px;
    margin-bottom: 15px;
}

.footer-contact p {
    margin-bottom: 8px;
    color: #bbb;
    font-size: 14px;
}

.footer-contact p:first-child {
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 15px;
}

/* 社交媒体样式 */
.footer-social {
    margin-bottom: 15px;
    text-align: center;
}

.footer-social p {
    margin-bottom: 10px;
    color: #bbb;
    font-size: 14px;
}

.social-icons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-icon {
    display: block;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #444;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 20px;
    transition: all 0.3s;
}

.social-icon:hover {
    background-color: #ff6700;
    transform: translateY(-3px);
}

.social-icon.facebook {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z"/></svg>');
}

.social-icon.instagram {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z"/></svg>');
}

.social-icon.twitter {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M23.953 4.57a10 10 0 01-2.825.775 4.958 4.958 0 002.163-2.723 10.054 10.054 0 01-3.127 1.184 4.92 4.92 0 00-8.384 4.482C7.69 8.095 4.067 6.13 1.64 3.162a4.822 4.822 0 00-.666 2.475c0 1.71.87 3.213 2.188 4.096a4.904 4.904 0 01-2.228-.616v.06a4.923 4.923 0 003.946 4.827 4.996 4.996 0 01-2.212.085 4.936 4.936 0 004.604 3.417 9.867 9.867 0 01-6.102 2.105c-.39 0-.779-.023-1.17-.067a13.995 13.995 0 007.557 2.209c9.053 0 13.998-7.496 13.998-13.985 0-.21 0-.42-.015-.63A9.935 9.935 0 0024 4.59z"/></svg>');
}

.social-icon.youtube {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814zM9.545 15.568V8.432L15.818 12l-6.273 3.568z"/></svg>');
}

.social-icon.wechat {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M8.691 2.188C3.891 2.188 0 5.476 0 9.53c0 2.212 1.17 4.203 3.002 5.55a.59.59 0 01.213.665l-.39 1.48c-.019.07-.048.141-.048.213 0 .163.13.295.29.295a.328.328 0 00.197-.066l2.256-1.3a.594.594 0 01.492-.056c.908.237 1.878.374 2.879.374.387 0 .77-.027 1.147-.074-.43-.578-.7-1.238-.77-1.928-.648-6.347 7.25-10.055 13.012-6.901-.838-4.93-5.292-8.592-10.59-8.592zm-1.188 3.67c.684 0 1.242.558 1.242 1.242 0 .684-.558 1.242-1.242 1.242-.683 0-1.242-.558-1.242-1.242 0-.684.559-1.242 1.242-1.242zm6.001 0c.684 0 1.242.558 1.242 1.242 0 .684-.558 1.242-1.242 1.242-.683 0-1.242-.558-1.242-1.242 0-.684.559-1.242 1.242-1.242zM19.711 8.82c-4.093 0-7.402 2.822-7.402 6.286 0 3.465 3.309 6.287 7.402 6.287.775 0 1.52-.105 2.225-.29a.473.473 0 01.382.047l1.762 1.014a.277.277 0 00.152.051.226.226 0 00.228-.228c0-.056-.023-.11-.038-.165l-.308-1.153a.463.463 0 01.168-.52C25.654 19.018 27 17.389 27 15.108c0-3.465-3.31-6.287-7.402-6.287h.113zm-2.503 2.81c.531 0 .963.432.963.964 0 .531-.432.963-.963.963-.53 0-.963-.432-.963-.963 0-.532.432-.963.963-.963zm5.402 0c.531 0 .963.432.963.964 0 .531-.432.963-.963.963-.53 0-.963-.432-.963-.963 0-.532.432-.963.963-.963z"/></svg>');
}

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

.footer-links a {
    color: #bbb;
    font-size: 14px;
    transition: color 0.3s;
    margin: 0 10px;
    text-decoration: none;
}

.footer-links a:hover {
    color: #ff6700;
}

.footer-links .divider {
    color: #555;
    margin: 0 5px;
}

/* 版权信息样式 */
.copyright {
    text-align: center;
    padding-top: 15px;
    color: #777;
    font-size: 13px;
}

/* 加载状态样式 */
.loading-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ff6700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

.loading-text {
    font-size: 16px;
    color: #666;
    margin-top: 10px;
}

/* 网络错误提示样式 */
.network-error {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #ff4d4f;
    color: white;
    padding: 10px;
    text-align: center;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.network-error.show {
    transform: translateY(0);
}

/* 页面加载状态 */
.page-loading {
    min-height: 400px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f5f5f5;
}

/* 骨架屏样式 */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-product {
    width: 100%;
    height: 300px;
    margin-bottom: 20px;
}

.skeleton-title {
    width: 80%;
    height: 20px;
    margin: 10px 0;
}

.skeleton-price {
    width: 50%;
    height: 16px;
    margin: 5px 0;
}

/* 离线提示样式 */
.offline-notice {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.offline-notice.show {
    opacity: 1;
}

.offline-icon {
    width: 20px;
    height: 20px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white"><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"/></svg>') no-repeat center;
    background-size: contain;
}

/* 响应式样式 */
/* 小屏PC (768px-1024px) */
@media screen and (min-width: 768px) and (max-width: 1024px) {
    .header-container {
        height: 70px;
    }

    .logo {
        flex: 0 0 150px;
    }

    .logo img {
        height: 40px;
    }

    .main-nav li {
        margin: 0 10px;
    }

    .search-box input {
        width: 150px;
    }

    .search-box input:focus {
        width: 200px;
    }

    .footer-nav {
        flex-wrap: wrap;
    }

    .footer-nav-column {
        flex: 0 0 50%;
        margin-bottom: 20px;
    }
}

/* 移动端样式 */
@media screen and (max-width: 767px) {
    /* #ifdef H5 */
    .header-container {
        height: 50px;
    }

    .logo {
        flex: 0 0 120px;
    }

    .logo img {
        height: 30px;
    }

    .main-nav {
        display: none;
    }

    .search-box {
        display: none;
    }

    .footer-info {
        flex-direction: column;
        text-align: center;
    }

    .footer-contact {
        margin-bottom: 15px;
        text-align: center;
    }

    .footer-social {
        margin: 15px 0;
    }

    .social-icons {
        gap: 10px;
    }

    .social-icon {
        width: 32px;
        height: 32px;
        background-size: 18px;
    }

    .footer-links {
        justify-content: center;
        margin: 10px 0;
    }
    /* #endif */
}
