/**
 * Jiandan 模板 - 用户登陆状态显示样式
 */

/* ========== 用户登陆区域容器 ========== */
:root {
    --blue-login-primary: #0052cc;
    --blue-login-accent: #207df4;
    --blue-login-deep: #003f9e;
    --blue-login-soft-blue: #7fb4ff;
    --blue-login-pale-blue: #cfe3ff;
    --blue-login-title: #172b4c;
    --blue-login-muted: #7e8299;
    --blue-login-border: rgba(133, 153, 171, .2);
    --blue-login-panel: #ffffff;
    --blue-login-panel-strong: #f1f4f8;
    --blue-login-panel-soft: #f7f9fc;
    --blue-login-panel-deep: #eef4ff;
}

.user-login-section {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}

/* 头部内显示时避免撑满布局 */
.header .user-login-section {
    flex: 0 0 auto;
    min-width: auto;
    margin-left: 10px;
}

.header .user-login-section .login-link,
.header .user-login-section .register-link,
.header .user-login-section .user-name,
.header .user-login-section .dropdown-arrow,
.header .user-login-section .user-trigger {
    color: #fff;
}

.header .user-login-section .link-separator {
    color: rgba(255, 255, 255, 0.6);
}

.dahecms-blue-login .user-login-section {
    flex: 0 0 auto;
    min-width: auto;
    margin-left: 0;
    justify-content: flex-end;
}

.dahecms-blue-login .user-login-section .login-link,
.dahecms-blue-login .user-login-section .register-link,
.dahecms-blue-login .user-login-section .user-name,
.dahecms-blue-login .user-login-section .dropdown-arrow,
.dahecms-blue-login .user-login-section .user-trigger {
    color: #fff;
}

.dahecms-blue-login .user-login-section .link-separator {
    color: rgba(255, 255, 255, 0.55);
}

.dahecms-blue-login .user-login-section .loading-spinner {
    border-color: rgba(255, 255, 255, 0.26);
    border-top-color: #fff;
}

.dahecms-blue-login .user-login-links,
.dahecms-blue-login .user-trigger {
    min-height: 40px;
}

.dahecms-blue-login .user-dropdown-wrapper {
    z-index: 1200;
}

.dahecms-blue-login .user-dropdown-menu {
    top: calc(100% + 6px);
    z-index: 1300;
}

.user-login-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 10px;
}

.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== 未登陆状态 - 登陆/注册链接 ========== */
.user-login-links {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.login-link,
.register-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    color: #666;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.login-link:hover {
    color: var(--blue-login-primary);
    text-decoration: underline;
}

.register-link:hover {
    color: var(--blue-login-primary);
    text-decoration: underline;
}

.link-icon {
    font-size: 16px;
}

.link-separator {
    color: #ccc;
    margin: 0 4px;
}

/* ========== 已登陆状态 - 用户下拉菜单 ========== */
.user-dropdown-wrapper {
    position: relative;
    display: inline-block;
    white-space: normal;
    flex-shrink: 0;
}

/* 触发器（用户信息显示区） */
.user-trigger {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: auto;
    color: var(--blue-login-title);
}

.user-trigger:hover {
    opacity: 0.7;
}

/* 用户头像 */
.user-avatar {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--blue-login-primary) 0%, var(--blue-login-accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    flex: none;
}

.user-avatar svg {
    width: 16px;
    height: 16px;
    fill: #fff;
}

/* 用户信息文本 */
.user-info {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex: 0 1 auto;
    min-width: 0;
    gap: 6px;
    white-space: nowrap;
}

.user-name {
    font-size: 13px;
    color: var(--blue-login-title);
    font-weight: 600;
    white-space: nowrap;
}

/* VIP 徽章 */
.user-vip-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 普通会员 - 灰色 */
.user-vip-badge.vip-normal {
    background: #e7dccb;
    color: var(--blue-login-muted);
}

/* 月卡VIP - 浅红色 */
.user-vip-badge.vip-monthly {
    background: rgba(202, 163, 106, 0.22);
    color: var(--blue-login-primary);
}

/* 季卡VIP - 大红色 */
.user-vip-badge.vip-quarterly {
    background: linear-gradient(135deg, var(--blue-login-primary), var(--blue-login-accent));
    color: #fff;
}

/* 年卡VIP - 橙红色 */
.user-vip-badge.vip-yearly {
    background: linear-gradient(135deg, var(--blue-login-soft-blue), var(--blue-login-primary));
    color: #fff9f2;
}

/* 终身VIP - 粉红色 */
.user-vip-badge.vip-lifetime {
    background: linear-gradient(135deg, #0052cc, #003f9e);
    color: #fff;
}

/* 兼容旧的样式 */
.user-vip-badge.user-vip-active {
    background: linear-gradient(135deg, #E6B800, #D4A500);
    color: #fff;
}

/* 下拉箭头 */
.dropdown-arrow {
    color: #7e8299;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.user-dropdown-wrapper.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* ========== 下拉菜单 ========== */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 34%),
        linear-gradient(180deg, #fff 0%, var(--blue-login-panel) 48%, #f7f9fc 100%);
    border-radius: 6px;
    border: 1px solid var(--blue-login-border);
    box-shadow: 0 18px 38px rgba(23, 43, 76, 0.12), inset 0 1px 0 rgba(255,255,255,0.7);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s ease;
    z-index: 999;
    overflow: hidden;
    color-scheme: light;
}

.user-dropdown-wrapper.active .user-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 下拉菜单头部 */
.dropdown-header {
    padding: 12px 16px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 100%),
        linear-gradient(180deg, #f7f9fc 0%, var(--blue-login-panel-deep) 100%);
    border-bottom: 1px solid var(--blue-login-border);
    box-shadow: inset 0 -1px 0 rgba(255,255,255,0.35);
}

.dropdown-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.dropdown-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--blue-login-accent) 0%, var(--blue-login-primary) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.dropdown-avatar svg {
    width: 20px;
    height: 20px;
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.dropdown-username {
    font-size: 14px;
    font-weight: 600;
    color: var(--blue-login-title);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-email {
    font-size: 12px;
    color: var(--blue-login-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-right {
    flex-shrink: 0;
}

.dropdown-right .user-vip-badge {
    padding: 4px 10px;
    font-size: 12px;
}

/* 下拉菜单主体 */
.dropdown-body {
    padding: 12px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 22%),
        linear-gradient(180deg, #fff 0%, var(--blue-login-panel) 100%);
}

.user-checkin-btn,
.user-checkin-btn-disabled {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 6px;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 12px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.user-checkin-btn {
    background: linear-gradient(135deg, var(--blue-login-primary), var(--blue-login-accent));
    box-shadow: 0 8px 18px rgba(0, 82, 204, 0.18);
}

.user-checkin-btn:hover {
    background: linear-gradient(135deg, #207df4, var(--blue-login-deep));
    box-shadow: 0 10px 20px rgba(0, 82, 204, 0.24);
    transform: translateY(-1px);
}

.user-checkin-btn-disabled {
    background: #eef1f6;
    color: #8a94a6;
    cursor: not-allowed;
    box-shadow: none;
}

.user-checkin-btn i,
.user-checkin-btn-disabled i {
    font-size: 14px;
}

/* 统计行 */
.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.stat-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, #f7f9fc 100%);
    border: 1px solid rgba(133, 153, 171, .22);
    border-radius: 5px;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.65);
}

.stat-item:hover {
    background: linear-gradient(180deg, #fff 0%, #eef4ff 100%);
    border-color: var(--blue-login-soft-blue);
    box-shadow: 0 8px 18px rgba(0, 82, 204, 0.08);
}

.stat-label {
    font-size: 12px;
    color: var(--blue-login-muted);
    flex-shrink: 0;
}

.stat-icon {
    font-size: 20px;
    flex-shrink: 0;
    margin-left: auto;
}

.stat-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--blue-login-title);
    text-decoration: none;
    flex-shrink: 0;
}

/* 统计网格 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.stat-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 5px 6px;
    border-radius: 5px;
    border: 1px solid rgba(133, 153, 171, .2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.55);
}

.dahe-card-icon {
    font-size: 14px;
}

.stat-card-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--blue-login-title);
}

.stat-card-label {
    display: none;
}

/* 淡色统计卡片 */
.stat-card-blue {
    background: linear-gradient(180deg, #eef4ff 0%, #e7f8f1 100%);
}

.stat-card-green {
    background: linear-gradient(180deg, #f1f4f8 0%, #eef4ff 100%);
}

.stat-card-pink {
    background: linear-gradient(180deg, #fff4f1 0%, #eef4ff 100%);
}

.stat-card-red {
    background: linear-gradient(180deg, #f7f9fc 0%, #eef1f6 100%);
}

/* 下拉菜单底部 */
.dropdown-footer {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 28%),
        linear-gradient(180deg, #f7f9fc 0%, #eef4ff 100%);
    border-top: 1px solid var(--blue-login-border);
}

.footer-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 6px;
    color: var(--blue-login-muted);
    text-decoration: none;
    font-size: 11px;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(133, 153, 171, .2);
    text-align: center;
    cursor: pointer;
}

.footer-link:last-child {
    border-right: none;
}

.footer-link:hover {
    background: rgba(0, 82, 204, 0.08);
    color: var(--blue-login-accent);
}

.footer-link:active,
.stat-item:active,
.user-checkin-btn:active {
    transform: translateY(0);
}

.footer-icon {
    font-size: 18px;
}

.footer-text {
    display: none;
}

/* ========== 搜索右侧区域容器 ========== */
.search-right-section {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 0 1 auto;
}

.quick-links {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 200px;
}

.quick-title {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    flex-shrink: 0;
}

.quick-links a {
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    padding: 4px 8px;
    transition: all 0.3s ease;
    display: inline-block;
    white-space: nowrap;
}

.quick-links a:hover {
    color: #FFD700;
    text-decoration: underline;
}

/* ========== 响应式设计 ========== */

/* 平板设备 */
@media (max-width: 1024px) {
    .user-dropdown-menu {
        width: 260px;
    }

    .user-trigger {
        min-width: auto;
        padding: 4px 8px;
    }

    .user-name {
        font-size: 13px;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .user-avatar svg {
        width: 16px;
        height: 16px;
    }
}

/* 手机设备 */
@media (max-width: 768px) {
    .search-right-section {
        flex-direction: column;
        gap: 12px;
        align-items: flex-end;
        width: 100%;
    }

    .quick-links {
        width: 100%;
        font-size: 12px;
    }

    .quick-title {
        font-size: 12px;
    }

    .quick-links a {
        font-size: 12px;
        padding: 3px 6px;
    }

    .user-login-section {
        width: 100%;
        min-width: auto;
    }

    .user-login-links {
        width: 100%;
        justify-content: flex-end;
    }

    .user-trigger {
        width: 100%;
        justify-content: flex-end;
        min-width: auto;
        padding: 4px 8px;
    }

    .user-dropdown-menu {
        width: 280px;
        right: 0;
    }

    .user-info {
        display: none;
    }

    .user-avatar {
        width: 28px;
        height: 28px;
    }

    .dropdown-footer {
        grid-template-columns: repeat(3, 1fr);
    }

    .footer-link:nth-child(4) {
        grid-column: 3;
    }

    .footer-link {
        font-size: 10px;
        padding: 8px 4px;
    }

    .footer-icon {
        font-size: 16px;
    }

    .dropdown-header {
        padding: 10px 12px;
    }

    .dropdown-body {
        padding: 10px;
    }

    .stat-item {
        padding: 6px 8px;
        font-size: 11px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 13px;
    }
}

/* 超小屏幕 */
@media (max-width: 480px) {
    .quick-links {
        font-size: 11px;
        min-width: auto;
    }

    .quick-title {
        font-size: 11px;
    }

    .quick-links a {
        font-size: 11px;
        padding: 2px 4px;
    }

    .user-login-links {
        gap: 4px;
    }

    .login-link,
    .register-link {
        padding: 4px 8px;
        font-size: 12px;
    }

    .link-separator {
        margin: 0 2px;
    }

    .dropdown-header {
        padding: 8px 10px;
    }

    .dropdown-user-info {
        display: none;
    }

    .user-dropdown-menu {
        width: 240px;
    }
}

/* ========== 暗色主题优化 ========== */
@media (prefers-color-scheme: dark) {
    .user-dropdown-menu {
        background:
            radial-gradient(circle at top left, rgba(255, 255, 255, 0.8), transparent 34%),
            linear-gradient(180deg, #fff 0%, var(--blue-login-panel) 48%, #f7f9fc 100%);
        box-shadow: 0 18px 38px rgba(68, 44, 24, 0.18);
    }

    .dropdown-header,
    .dropdown-body {
        background: transparent !important;
    }

    .dropdown-header {
        background:
            linear-gradient(180deg, rgba(255,255,255,0.45) 0%, rgba(255,255,255,0) 100%),
            linear-gradient(180deg, #f7f9fc 0%, var(--blue-login-panel-deep) 100%);
        border-bottom-color: var(--blue-login-border);
    }

    .dropdown-footer {
        background:
            linear-gradient(180deg, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0) 28%),
            linear-gradient(180deg, #f7f9fc 0%, #eef4ff 100%);
        border-top-color: var(--blue-login-border);
    }

    .dropdown-username {
        color: var(--blue-login-title);
    }

    .dropdown-email {
        color: var(--blue-login-muted);
    }

    .stat-item {
        background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, #f7f9fc 100%);
    }

    .stat-label {
        color: var(--blue-login-muted);
    }

    .stat-value {
        color: var(--blue-login-title);
    }

    .footer-link {
        color: var(--blue-login-muted);
        border-right-color: rgba(133, 153, 171, .2);
    }

    .footer-link:hover {
        background: rgba(0, 82, 204, 0.08);
        color: var(--blue-login-accent);
    }
}
