/* common-styles.css - 公共样式文件（苹果设计系统适配版） */

/* ========== 苹果风格设计系统 ========== */
:root {
    /* 色彩系统 */
    --apple-bg: #f5f5f7;
    --apple-card-bg: #ffffff;
    --apple-primary: #007aff;
    --apple-primary-light: rgba(0, 122, 255, 0.1);
    --apple-primary-dark: #0066cc;
    --apple-secondary: #5856d6;
    --apple-success: #34c759;
    --apple-warning: #ff9500;
    --apple-danger: #ff3b30;
    --apple-gray-1: #8e8e93;
    --apple-gray-2: #c7c7cc;
    --apple-gray-3: #e5e5ea;
    --apple-gray-4: #f2f2f7;
    
    /* 文本颜色 */
    --text-primary: #1d1d1f;
    --text-secondary: #424245;
    --text-tertiary: #8e8e93;
    --text-on-dark: #ffffff;

    --header-bg-dark: linear-gradient(135deg, #0056b3 0%, #003d82 100%);
    --header-bg-gradient: linear-gradient(135deg, 
        color-mix(in srgb, var(--apple-primary) 80%, black 20%) 0%,
        color-mix(in srgb, var(--apple-primary) 60%, black 40%) 100%);
    
    /* 阴影系统 */
    --apple-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --apple-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --apple-shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    
    /* 过渡动画 */
    --apple-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --apple-transition-fast: all 0.15s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--apple-bg);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* ========== 合并的顶部导航栏（单行） ========== */
.main-header {
    background: var(--apple-card-bg);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--apple-shadow-md);
    border-bottom: 1px solid var(--apple-gray-3);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: all 0.3s ease;
}

.main-header.scrolled {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--apple-shadow-sm);
}

.main-header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: relative;
    z-index: 1;
}

/* Logo区域 */
.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
    transition: var(--apple-transition-fast);
}

.logo-link:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.logo-image {
    height: 36px;
    width: auto;
    border-radius: 8px;
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Comic Neue', 'Inter', sans-serif;
    letter-spacing: -0.5px;
}

/* 主导航菜单 */
.header-nav {
    display: flex;
    gap: 32px;
    margin: 0 40px;
    flex: 1;
    justify-content: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 16px;
    padding: 8px 0;
    position: relative;
    transition: var(--apple-transition-fast);
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--apple-primary);
    transform: translateY(-1px);
}

.nav-link.active {
    color: var(--apple-primary);
    font-weight: 700;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--apple-primary);
    border-radius: 2px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { width: 0; }
    to { width: 100%; }
}

/* ========== 用户区域 ========== */
.user-topbar-content {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
    margin-left: auto;
}

.user-welcome {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.user-welcome-icon {
    font-size: 18px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

/* 登录按钮 */
.user-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    background: var(--apple-primary);
    color: var(--text-on-dark);
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--apple-transition-fast);
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.user-login-btn:hover {
    background: var(--apple-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3);
}

.user-login-icon {
    font-size: 16px;
}

/* ========== 已登录状态样式 ========== */
.user-logged-in {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--apple-primary), var(--apple-secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    color: var(--text-on-dark);
    cursor: pointer;
    transition: var(--apple-transition);
    border: 2px solid var(--apple-primary-light);
    box-shadow: var(--apple-shadow-sm);
}

.user-avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--apple-shadow-md);
    border-color: var(--apple-primary);
}

/* ========== 下拉菜单样式 ========== */
.user-dropdown {
    position: fixed !important;
    top: 74px !important;
    right: 20px !important;
    background: var(--apple-card-bg);
    border-radius: 18px;
    box-shadow: var(--apple-shadow-lg);
    min-width: 300px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--apple-transition);
    border: 1px solid var(--apple-gray-3);
    overflow: hidden;
    display: none;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    display: block;
}

.user-dropdown-header {
    padding: 24px;
    background: linear-gradient(135deg, var(--apple-primary), var(--apple-secondary));
    color: var(--text-on-dark);
}

.user-dropdown-name {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 6px;
    font-family: 'Comic Neue', 'Inter', sans-serif;
}

.user-dropdown-email {
    font-size: 14px;
    opacity: 0.9;
}

.user-dropdown-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 20px;
    border-bottom: 1px solid var(--apple-gray-3);
    background: var(--apple-gray-4);
}

.user-stat-item {
    text-align: center;
}

.user-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
}

.user-stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.user-dropdown-menu {
    padding: 12px 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--apple-transition-fast);
    font-size: 15px;
}

.user-menu-item:hover {
    background: var(--apple-gray-4);
    color: var(--apple-primary);
}

.user-menu-item-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: var(--text-tertiary);
}

.user-menu-item:hover .user-menu-item-icon {
    color: var(--apple-primary);
}

.user-menu-divider {
    height: 1px;
    background: var(--apple-gray-3);
    margin: 8px 0;
}

.user-logout-btn {
    color: var(--apple-danger);
}

.user-logout-btn:hover {
    background: rgba(255, 59, 48, 0.1);
}

/* ========== 通知样式 ========== */
.user-notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 16px 24px;
    border-radius: 14px;
    color: var(--text-on-dark);
    font-weight: 600;
    z-index: 9999;
    transform: translateX(100%);
    transition: var(--apple-transition);
    max-width: 320px;
    box-shadow: var(--apple-shadow-lg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.user-notification.show {
    transform: translateX(0);
}

.notification-success {
    background: linear-gradient(135deg, var(--apple-success), #30b453);
    border-left: 4px solid #2f855a;
}

.notification-error {
    background: linear-gradient(135deg, var(--apple-danger), #fc8181);
    border-left: 4px solid #c53030;
}

.notification-info {
    background: linear-gradient(135deg, var(--apple-primary), #63b3ed);
    border-left: 4px solid #2c5282;
}

/* ========== 首页头部样式 ========== */
.home-header {
    padding: 80px 20px 60px;
    text-align: center;
    background: linear-gradient(135deg, 
        color-mix(in srgb, var(--apple-primary) 90%, white 10%) 0%, 
        color-mix(in srgb, var(--apple-secondary) 90%, white 10%) 100%);
    color: var(--text-on-dark);
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
}

.home-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
    opacity: 0.3;
}

.home-header-content {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.home-header h1 {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    font-family: 'Comic Neue', 'Inter', sans-serif;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.5px;
}

.home-header p {
    font-size: 1.2rem;
    max-width: 600px;
    margin: 0 auto 30px;
    opacity: 0.9;
    line-height: 1.6;
}

.page-container {
    max-width: 1200px;
    margin: 0 auto;
}
        
.page-header {
    text-align: center;
    padding: 20px 20px 40px;
    margin-bottom: 12px;
}

.page-title {
    font-size: 48px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
    font-family: 'Comic Neue', 'Inter', sans-serif;
}

.page-subtitle {
    font-size: 18px;
    color: var(--text-tertiary);
    max-width: 600px;
    margin: 0 auto 32px;
    line-height: 1.6;
}

.header-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}

.header-btn {
    display: inline-flex;
    align-items: center;
    text-align: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 14px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: var(--apple-transition-fast);
    border: none;
    cursor: pointer;
}

.header-btn.primary {
    background: var(--apple-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.header-btn.primary:hover {
    background: #0066cc;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3);
}

.header-btn.secondary {
    background: transparent;
    color: var(--apple-primary);
    border: 1.5px solid var(--apple-primary);
}

.header-btn.secondary:hover {
    background: var(--apple-primary-light);
    transform: translateY(-2px);
}

/* ========== 移动端适配 ========== */
@media (max-width: 1024px) {
    .header-nav {
        gap: 24px;
        margin: 0 20px;
    }
    
    .user-welcome {
        display: none;
    }
    
    .home-header h1 {
        font-size: 2.8rem;
    }
}

@media (max-width: 768px) {
    .page-container {
        padding: 16px;
    }

    .main-header {
        padding: 0;
    }
    
    .main-header-content {
        padding: 0 16px;
        height: 60px;
        gap: 16px;
    }

    .header-btn {
        width: 100%;
        justify-content: center;
    }
            
    .logo-image {
        height: 32px;
    }
    
    .logo-text {
        font-size: 20px;
    }
    
    .header-nav {
        display: none;
    }
    
    .user-topbar-content {
        gap: 16px;
    }
    
    .user-login-btn {
        padding: 10px 20px;
        font-size: 15px;
    }
    
    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 15px;
    }
    
    /* 移动端下拉菜单 */
    .user-dropdown {
        top: 70px !important;
        left: 16px !important;
        right: 16px !important;
        min-width: auto !important;
    }
    
    .user-notification {
        top: 75px;
        left: 16px;
        right: 16px;
        max-width: none;
    }
    
    .home-header {
        padding: 20px 16px 30px;
    }
    
    .home-header h1 {
        font-size: 2.4rem;
    }
    
    .home-header p {
        font-size: 1.1rem;
    }

    .page-title {
        font-size: 32px;
    }
    
    .page-subtitle {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none;
    }
    
    .logo-link {
        gap: 8px;
    }
    
    .user-login-btn {
        padding: 8px 16px;
        font-size: 14px;
    }
    
    .user-login-btn span:last-child {
        display: none;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .home-header h1 {
        font-size: 2rem;
    }
    
    .home-header p {
        font-size: 1rem;
    }

    .page-title {
        font-size: 28px;
    }
            
}

/* ========== 移动端汉堡菜单 ========== */
.mobile-menu-toggle {
    display: none;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        flex-direction: column;
        gap: 4px;
        width: 32px;
        height: 24px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px;
        margin-left: 12px;
    }
    
    .mobile-menu-toggle span {
        display: block;
        width: 100%;
        height: 3px;
        background: var(--text-primary);
        border-radius: 2px;
        transition: var(--apple-transition-fast);
    }
    
    .mobile-menu-toggle:hover span {
        background: var(--apple-primary);
    }
    
    .mobile-menu {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: var(--apple-card-bg);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        padding: 16px;
        display: none;
        flex-direction: column;
        gap: 8px;
        z-index: 999;
        border-top: 1px solid var(--apple-gray-3);
        box-shadow: var(--apple-shadow-lg);
    }
    
    .mobile-menu.show {
        display: flex;
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .mobile-nav-link {
        display: block;
        padding: 16px 20px;
        text-decoration: none;
        color: var(--text-secondary);
        font-weight: 600;
        font-size: 16px;
        border-radius: 12px;
        transition: var(--apple-transition-fast);
        text-align: center;
    }
    
    .mobile-nav-link:hover {
        background: var(--apple-gray-4);
        color: var(--apple-primary);
    }
    
    .mobile-nav-link.active {
        background: var(--apple-primary);
        color: var(--text-on-dark);
        font-weight: 700;
    }
}

/* ========== 工具类 ========== */
.hidden {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--apple-gray-3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--apple-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--apple-primary-dark);
}

/* ========== 保持兼容性的额外样式 ========== */
/* 注意：这些样式为兼容旧代码保留，新代码应使用上面的样式 */

.user-topbar {
    background: linear-gradient(135deg, var(--text-primary) 0%, #4a5568 100%);
    color: var(--text-on-dark);
    padding: 12px 20px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 14px;
    border-bottom: 1px solid var(--apple-gray-3);
    position: relative;
    z-index: 1001;
}

/* ========== 全局卡片样式 ========== */
.card {
    background: var(--apple-card-bg);
    border-radius: 18px;
    border: 1px solid var(--apple-gray-3);
    box-shadow: var(--apple-shadow-sm);
    transition: var(--apple-transition);
    padding: 24px;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--apple-shadow-md);
    border-color: var(--apple-primary);
}

/* ========== 全局按钮样式 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    transition: var(--apple-transition-fast);
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--apple-primary);
    color: var(--text-on-dark);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.2);
}

.btn-primary:hover {
    background: var(--apple-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--apple-primary);
    border: 1.5px solid var(--apple-primary);
}

.btn-secondary:hover {
    background: var(--apple-primary-light);
    transform: translateY(-2px);
}

/* ========== 表单元素样式 ========== */
input, select, textarea {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    padding: 12px 16px;
    border: 1.5px solid var(--apple-gray-3);
    border-radius: 12px;
    background: var(--apple-card-bg);
    color: var(--text-primary);
    transition: var(--apple-transition-fast);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--apple-primary);
    box-shadow: 0 0 0 3px var(--apple-primary-light);
}

/* ========== 链接样式 ========== */
a {
    color: var(--apple-primary);
    text-decoration: none;
    transition: var(--apple-transition-fast);
}

a:hover {
    color: var(--apple-primary-dark);
    text-decoration: underline;
}