/**
 * ========================================
 * Orient Express - 主样式文件
 * Main CSS for Desktop & Tablet
 * ========================================
 * 
 * 文件结构:
 * 1. CSS变量定义
 * 2. 导航栏样式
 * 3. 用户菜单样式
 * 4. 商品卡片样式
 * 5. 响应式布局
 * 
 * 移动端样式请参见: mobile-redesign.css
 * ========================================
 */

/* ========================================
   🎨 Apple 设计系统 - 全局配色变量
   ======================================== */
:root {
    /* 主品牌色 */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8ff5;
    
    /* 强调色 */
    --accent-color: #FF6B6B;
    --accent-light: #FF8787;
    --accent-dark: #E85555;
    
    /* 成功/促销色 */
    --success-color: #FF9500;
    --success-light: #FFB340;
    
    /* 中性色 */
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --text-tertiary: #c7c7cc;
    --background: #ffffff;
    --background-secondary: #f5f5f7;
    --background-tertiary: #e8e8ed;
    --border-color: #e8e8ed;
    --border-light: #f0f0f0;
    
    /* 阴影 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.12);
    
    /* 品牌阴影 */
    --shadow-primary: 0 4px 16px rgba(102, 126, 234, 0.25);
    --shadow-accent: 0 4px 16px rgba(255, 107, 107, 0.25);
}

/* ========================================
   导航栏优化
   ======================================== */
.navbar {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    position: relative;
    z-index: 100000;  /* 确保navbar及其子元素在最上层 */
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 0;
}

.navbar-brand a {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-brand img {
    height: 65px;
    border-radius: 50%;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-brand img:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* ========================================
   ✨ 统一用户菜单 - 世界顶级设计
   ======================================== */
.unified-user-menu {
    position: relative;
}

/* 头像按钮 - 精致圆形 */
.unified-menu-btn {
    position: relative;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.unified-menu-btn:hover {
    transform: scale(1.05);
}

.unified-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 2px solid white;
    transition: all 0.3s ease;
}

.unified-menu-btn:hover .unified-avatar {
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.3);
    border-color: var(--primary-color);
}

/* 管理员小星星标识 */
.admin-indicator {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

.admin-indicator svg {
    width: 8px;
    height: 8px;
    color: white;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 下拉菜单 - 毛玻璃效果 */
.unified-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 360px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99999;  /* 提高z-index确保覆盖所有内容 */
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.unified-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* 📱 移动端下拉菜单 - 使用fixed定位确保覆盖所有内容 */
@media (max-width: 768px) {
    .unified-dropdown {
        position: fixed !important;
        top: 70px !important;
        left: 12px !important;
        right: 12px !important;
        bottom: auto !important;
        width: auto !important;
        max-height: calc(100vh - 90px) !important;
        overflow-y: auto !important;
        z-index: 999999 !important;
        transform: none !important;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease !important;
    }
    
    .unified-dropdown.show {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }
    
    /* 确保父容器不会裁剪下拉菜单 */
    .unified-user-menu {
        position: static !important;
    }
    
    .navbar-actions {
        overflow: visible !important;
    }
}

/* 用户信息卡片 - 渐变背景 */
.unified-header {
    background: var(--primary-gradient);
    padding: 28px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.unified-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(180deg); }
}

.user-avatar-large {
    position: relative;
    width: 64px;
    height: 64px;
    flex-shrink: 0;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border-radius: 50%;
    border: 3px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.5);
}

.avatar-badge svg {
    width: 12px;
    height: 12px;
    color: white;
}

.user-info-card {
    flex: 1;
    color: white;
    position: relative;
    z-index: 1;
}

.user-display-name {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.user-phone-number {
    font-size: 14px;
    margin: 0 0 8px 0;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.user-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.user-role-badge.admin {
    background: rgba(255, 215, 0, 0.2);
    color: #FFD700;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.user-role-badge.member {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* 菜单分区 */
.menu-section {
    padding: 12px;
}

.menu-section + .menu-section {
    border-top: 1px solid var(--border-light);
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    padding: 8px 12px 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-title.admin {
    color: var(--primary-color);
}

/* 管理功能区背景 */
.admin-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.03) 0%, rgba(118, 75, 162, 0.03) 100%);
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

/* 菜单项 - 卡片式设计 */
.unified-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 12px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.unified-menu-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.unified-menu-item:hover::before {
    opacity: 0.08;
}

.unified-menu-item:hover {
    transform: translateX(4px);
}

/* 图标区 */
.menu-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.menu-item-icon.personal {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.menu-item-icon.favorites {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8787 100%);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.menu-item-icon.admin-promo {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.menu-item-icon.admin-users {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.menu-item-icon.admin-stats {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.menu-item-icon.logout {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.menu-item-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.unified-menu-item:hover .menu-item-icon {
    transform: scale(1.1) rotate(5deg);
}

/* 内容区 */
.menu-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    z-index: 1;
}

.menu-item-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.menu-item-title.logout {
    color: var(--accent-color);
}

.menu-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* 箭头 */
.menu-item-arrow {
    flex-shrink: 0;
    color: var(--text-tertiary);
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.unified-menu-item:hover .menu-item-arrow {
    color: var(--primary-color);
    transform: translateX(4px);
}

/* 退出按钮特殊样式 */
.unified-menu-item.logout:hover {
    background: linear-gradient(135deg, #FEE2E2 0%, #FEF2F2 100%);
}

.unified-menu-item.logout:hover .menu-item-title {
    color: var(--accent-dark);
}

/* 登录按钮优化 */
.btn-login.elegant {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-gradient);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-login.elegant:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.btn-login.elegant svg {
    width: 20px;
    height: 20px;
}

/* ========================================
   语言切换器优化
   ======================================== */
.language-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--background-secondary);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.lang-btn {
    padding: 0.375rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.lang-btn:hover {
    color: var(--text-primary);
    background: rgba(102, 126, 234, 0.08);
}

.lang-btn.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.lang-divider {
    color: var(--text-tertiary);
    font-weight: 300;
}

/* ========================================
   搜索框优化
   ======================================== */
.navbar-search {
    flex: 1;
    max-width: 600px;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.9375rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--background-secondary);
    color: var(--text-primary);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--background);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: var(--text-tertiary);
}

/* ========================================
   响应式优化 - 移至 mobile-redesign.css
   ======================================== */

/* ========================================
   🚨 关键移动端样式（内联确保优先级）
   ======================================== */
@media (max-width: 768px) {
    /* 🔧 防止页面横向溢出 */
    html, body {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    .main-content,
    .container,
    .index-container {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    /* 浮动购物车按钮 - 必须显示 */
    button.floating-cart-btn,
    .floating-cart-btn,
    #floatingCart {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: fixed !important;
        bottom: 24px !important;
        right: 16px !important;
        width: 60px !important;
        height: 60px !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(135deg, #2C2520 0%, #1a1512 100%) !important;
        border: none !important;
        border-radius: 50% !important;
        box-shadow: 0 4px 20px rgba(44, 37, 32, 0.4) !important;
        cursor: pointer !important;
        z-index: 99999 !important;
        pointer-events: auto !important;
    }
    
    button.floating-cart-btn svg,
    .floating-cart-btn svg,
    #floatingCart svg {
        width: 26px !important;
        height: 26px !important;
        color: white !important;
        display: block !important;
    }
    
    .floating-cart-btn .cart-badge,
    #floatingCart .cart-badge,
    #cartBadge {
        position: absolute !important;
        top: -4px !important;
        right: -4px !important;
        min-width: 22px !important;
        height: 22px !important;
        background: #C45C3E !important;
        color: white !important;
        border-radius: 11px !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        z-index: 100000 !important;
    }
    
    /* 促销标签栏 - 必须显示 */
    .mobile-promo-tabs,
    #mobilePromoTabs {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        margin: 0 !important;  /* 🔧 移除负margin防止溢出 */
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    .promo-tabs-scroll {
        display: flex !important;
        overflow-x: auto !important;
    }
    
    .promo-tab {
        display: flex !important;
        flex-shrink: 0 !important;
    }
    
    #promoTabsList {
        display: contents !important;
    }
}

/* ========================================
   通用动画
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
