/* 定制平台 - 公共样式 */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-focus-ring-color: transparent;
}

button, input, textarea, select, a {
    -webkit-tap-highlight-color: transparent;
    -webkit-focus-ring-color: transparent;
    outline: none;
}

button:active, input:active, textarea:active, select:active, a:active {
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background: #f5f5f5;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
}

a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

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

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 12px;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    padding: 10px 24px;
    background: #ff6b9d;
    color: #fff;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover {
    background: #ff4d8a;
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    display: inline-block;
    padding: 10px 24px;
    background: #fff;
    color: #ff6b9d;
    border: 1px solid #ff6b9d;
    border-radius: 25px;
    font-size: 14px;
    transition: all 0.3s;
    cursor: pointer;
    text-align: center;
    -webkit-tap-highlight-color: transparent;
}

.btn-secondary:hover {
    background: #fff0f5;
}

/* Header */
.header {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
    padding: 0 12px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: #ff6b9d;
    white-space: nowrap;
    display: flex;
    align-items: center;
}
.logo img {
    height: 32px;
    width: auto;
    max-width: 140px;
    object-fit: contain;
    display: block;
}

.nav {
    display: flex;
    gap: 20px;
}

.nav a {
    color: #666;
    font-size: 14px;
    transition: color 0.3s;
    white-space: nowrap;
}

.nav a:hover, .nav a.active {
    color: #ff6b9d;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 用户 hover 下拉菜单 */
.user-menu {
    position: relative;
}
.user-menu .user-info {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    /* button 重置 */
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    color: inherit;
}
/* 导航栏头像 */
.header-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #ff6b9d, #ff8a80);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(255, 107, 157, .6);
    transition: transform 0.2s, box-shadow 0.2s;
}
.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.header-avatar-text {
    line-height: 1;
}
.user-menu:hover .header-avatar {
    box-shadow: 0 0 0 2px rgba(255, 107, 157, .35);
}
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 168px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, .14);
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity .18s ease, transform .18s ease, visibility .18s;
    z-index: 1000;
}
.user-menu:hover .user-dropdown,
.user-menu:focus-within .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    color: #555;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.user-dropdown a:hover {
    background: #fff0f5;
    color: #ff6b9d;
}
.user-dropdown a.active {
    color: #ff6b9d;
    font-weight: 500;
    background: #fff0f5;
}
.user-dropdown .ud-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.user-dropdown .ud-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}
.user-dropdown-divider {
    height: 1px;
    background: #f0f0f0;
    margin: 4px 0;
}
.user-dropdown-logout {
    color: #999 !important;
}
.user-dropdown-logout:hover {
    color: #e74c3c !important;
    background: #fef0f0 !important;
}

/* 用户卡片（头像+用户名） */
.user-dropdown .ud-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f2f2f2;
    margin-bottom: 2px;
}
.user-dropdown .ud-user-card:hover {
    background: #fff0f5;
}
.user-dropdown .ud-user-card:hover .ud-user-name {
    color: #ff6b9d;
}
.user-dropdown .ud-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: linear-gradient(135deg, #ffd0e0, #ffe6ef);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.user-dropdown .ud-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.user-dropdown .ud-avatar-text {
    font-size: 16px;
    color: #ff6b9d;
    font-weight: 600;
}
.user-dropdown .ud-user-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}
.user-dropdown .ud-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .15s;
}
.user-dropdown .ud-user-desc {
    font-size: 11px;
    color: #999;
    margin-top: 2px;
}
.user-dropdown .ud-level-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #ff6b9d, #ff8a80);
    padding: 1px 6px;
    border-radius: 8px;
    margin-top: 3px;
    align-self: flex-start;
}
.user-dropdown .ud-level-progress {
    display: flex;
    flex-direction: column;
    margin-top: 4px;
    gap: 2px;
}
.user-dropdown .ud-level-exp {
    font-size: 11px;
    color: #999;
}
.user-dropdown .ud-level-track {
    height: 4px;
    background: #eee;
    border-radius: 2px;
    overflow: hidden;
}
.user-dropdown .ud-level-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ff8c00);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.login-btn, .register-btn {
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 13px;
    white-space: nowrap;
}

.login-btn {
    color: #666;
}

.register-btn {
    background: #ff6b9d;
    color: #fff;
}

.user-info {
    color: #ff6b9d;
    font-size: 13px;
}

.logout {
    color: #999;
    font-size: 12px;
}

.cart-btn {
    position: relative;
    padding: 6px 12px;
    background: #fff0f5;
    border-radius: 15px;
    color: #ff6b9d;
    font-size: 13px;
}

.orders-btn {
    padding: 6px 12px;
    background: #fff0f5;
    border-radius: 15px;
    color: #ff6b9d;
    font-size: 13px;
}

.orders-btn.active {
    background: #ff6b9d;
    color: #fff;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    background: #ff6b9d;
    color: #fff;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 顶部栏搜索按钮 */
.search-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #ff6b9d;
    line-height: 0;
}
.search-btn:hover {
    background: #fff0f5;
}
.search-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}

/* 顶部栏消息通知铃铛 */
.notify-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #ff6b9d;
    line-height: 0;
}
.notify-btn:hover {
    background: #fff0f5;
}
.notify-btn svg {
    width: 22px;
    height: 22px;
    display: block;
}
.notify-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    box-sizing: border-box;
    background: #ff3b30;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 0 0 2px #fff;
}

/* Mobile Menu Button */
.menu-btn {
    display: none;
    width: 32px;
    height: 32px;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    background: none;
    border: none;
    color: #555;
}

/* 隐藏原来的三条横线 spans，改用 ::before 渲染网格图标 */
.menu-btn span {
    display: none;
}

.menu-btn::before {
    content: '';
    display: block;
    width: 22px;
    height: 22px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='8' height='8' rx='2'/%3E%3Crect x='13' y='3' width='8' height='8' rx='2'/%3E%3Crect x='3' y='13' width='8' height='8' rx='2'/%3E%3Crect x='13' y='13' width='8' height='8' rx='2'/%3E%3C/svg%3E") center/contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='3' width='8' height='8' rx='2'/%3E%3Crect x='13' y='3' width='8' height='8' rx='2'/%3E%3Crect x='3' y='13' width='8' height='8' rx='2'/%3E%3Crect x='13' y='13' width='8' height='8' rx='2'/%3E%3C/svg%3E") center/contain no-repeat;
    transition: color 0.2s;
}

.menu-btn:hover::before {
    color: #ff6b9d;
}

/* Footer */
.footer {
    background: #fff;
    padding: 24px 0;
    margin-top: 40px;
    text-align: center;
    color: #999;
    font-size: 12px;
}
.footer .footer-links {
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 18px;
}
.footer .footer-links a {
    color: #999;
    text-decoration: none;
    font-size: 12px;
}
.footer .footer-links a:hover { color: #ff6b9d; }
.footer .beian { margin-top: 4px; }
.footer .beian a { color: #999; text-decoration: none; }
.footer .beian a:hover { color: #ff6b9d; }
.footer .police-net { margin-top: 2px; }
.footer .police-net a { color: #999; text-decoration: none; display: inline-flex; align-items: center; gap: 3px; }
.footer .police-net a:hover { color: #ff6b9d; }
.footer .police-icon { vertical-align: middle; }

/* 信息页（关于我们 / 服务条款 等） */
.info-page { max-width: 820px; margin: 24px auto 0; padding: 28px 20px; }
.info-page h1 { font-size: 24px; color: #333; text-align: center; margin-bottom: 8px; }
.info-page .info-sub { text-align: center; color: #999; font-size: 13px; margin-bottom: 24px; }
.info-page h2 { font-size: 17px; color: #333; margin: 22px 0 10px; }
.info-page p { color: #555; line-height: 1.8; font-size: 14px; margin: 8px 0; }
.info-page ul { color: #555; line-height: 1.9; font-size: 14px; padding-left: 20px; }
.info-page a { color: #ff6b9d; }

/* Section Title */
.section-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
    background: #fff;
}

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

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-title {
    font-size: 17px;
    font-weight: bold;
}

.modal-close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 16px;
    border-top: 1px solid #eee;
    margin-top: 16px;
}

.modal-body {
    padding: 0;
}

/* Toast */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    z-index: 2000;
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 14px;
    max-width: 90%;
    text-align: center;
    pointer-events: auto;
}

.toast.success {
    background: #52c41a;
}

.toast.error {
    background: #ff4d4d;
}

.toast.reward-toast {
    pointer-events: auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Loading */
.loading {
    text-align: center;
    padding: 30px;
    color: #999;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state .icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.empty-state p {
    margin-bottom: 16px;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

/* Mobile Responsive */
@media screen and (max-width: 768px) {
    .container {
        padding: 0 10px;
    }
    
    .header-content {
        height: 50px;
        padding: 0 10px;
    }
    
    .logo {
        font-size: 18px;
    }
    .logo img {
        height: 28px;
        max-width: 110px;
    }

    .nav {
        display: none;
        position: absolute;
        top: 50px;
        left: 0;
        right: 0;
        background: #fff;
        flex-direction: column;
        gap: 0;
        padding: 10px 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    }
    
    .nav.show {
        display: flex;
    }
    
    .nav a {
        padding: 12px 16px;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .menu-btn {
        display: flex;
        order: -1;
        color: #ff6b9d;
    }

    .header-right {
        gap: 8px;
        order: 1;
        margin-left: auto;
    }
    
    .login-btn, .register-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .cart-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .orders-btn {
        padding: 5px 10px;
        font-size: 12px;
    }
    
    .user-info {
        font-size: 12px;
    }

    .header-avatar {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }

    .search-btn, .notify-btn {
        width: 30px;
        height: 30px;
    }

    .search-btn svg, .notify-btn svg {
        width: 20px;
        height: 20px;
    }
    
    .section-title {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .modal-content {
        padding: 16px;
        margin: 10px;
        border-radius: 8px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-control {
        padding: 10px;
        font-size: 14px;
    }
}

/* Small Mobile */
@media screen and (max-width: 375px) {
    html {
        font-size: 14px;
    }
    
    .logo {
        font-size: 16px;
    }
    .logo img {
        height: 24px;
        max-width: 90px;
    }

    .login-btn, .register-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}
