/* ============================================
   portal.css — 门户主页样式
   ============================================ */
:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --bg: #f8f9fa;
    --bg-card: #ffffff;
    --text: #2d3436;
    --text-secondary: #636e72;
    --border: #dfe6e9;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 8px 30px rgba(108,92,231,0.15);
    --radius: 12px;
    --nav-height: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ========== 导航栏 ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-brand .logo {
    font-size: 1.5rem;
}

.nav-login-btn {
    padding: 8px 20px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

.nav-login-btn:hover {
    background: var(--primary-light);
}

/* ========== 用户菜单 ========== */
.user-menu {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
    transition: border-color 0.2s;
}

.user-menu-btn:hover {
    border-color: var(--primary);
}

.user-avatar-small {
    font-size: 1.2rem;
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.user-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
    min-width: 150px;
    overflow: hidden;
    z-index: 101;
}

.user-dropdown.show { display: block; }

.dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 0.9rem;
    color: var(--text);
    transition: background 0.15s;
}

.dropdown-item:hover {
    background: var(--bg);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
}

/* ========== 主内容区 ========== */
.main-content {
    max-width: 960px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 40px) 20px 60px;
}

/* ========== 欢迎语 ========== */
.welcome {
    text-align: center;
    margin-bottom: 48px;
}

.welcome h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary), #e17055);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome p {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* ========== 应用卡片网格 ========== */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px 24px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    text-align: center;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.app-card.coming-soon {
    opacity: 0.6;
    cursor: default;
}

.app-card.coming-soon:hover {
    transform: none;
    box-shadow: var(--shadow);
}

.app-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.app-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.app-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.app-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--text-secondary);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ========== 底部 ========== */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .app-card {
        padding: 24px 12px 20px;
    }
    .app-icon {
        font-size: 2.2rem;
    }
    .welcome h1 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .apps-grid {
        grid-template-columns: 1fr;
    }
    .navbar {
        padding: 0 16px;
    }
}

/* ========== 通用表单样式（登录/注册共用） ========== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
}

.auth-box {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-box .logo-section {
    text-align: center;
    margin-bottom: 32px;
}

.auth-box .logo-section h1 {
    font-size: 1.5rem;
    color: var(--primary);
    margin-top: 8px;
}

.auth-box .logo-section .logo-emoji {
    font-size: 2.5rem;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color 0.2s, border-color 0.2s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary);
}

.form-error {
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 4px;
    display: none;
}

.form-error.show {
    display: block;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.btn-submit:hover {
    background: var(--primary-light);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--primary);
}

/* ========== 个人中心 ========== */
.profile-container {
    max-width: 640px;
    margin: 0 auto;
    padding: calc(var(--nav-height) + 40px) 20px 60px;
}

.profile-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 32px;
    margin-bottom: 24px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.profile-avatar {
    font-size: 3rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 50%;
}

.profile-info h2 {
    font-size: 1.3rem;
    margin-bottom: 4px;
}

.profile-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.avatar-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.avatar-option {
    font-size: 1.8rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}

.avatar-option:hover {
    transform: scale(1.1);
}

.avatar-option.selected {
    border-color: var(--primary);
    background: rgba(108,92,231,0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 16px;
    background: var(--bg);
    border-radius: 8px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.btn-save {
    padding: 10px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-save:hover {
    background: var(--primary-light);
}

/* ========== 消息提示 ========== */
.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #2d3436;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 200;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background: #e74c3c;
}

.toast.success {
    background: #00b894;
}
