/**
 * GESP考级题库系统 - 前台样式
 */

/* 基础 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans SC", sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f5f7fa;
}

main {
    flex: 1;
}

/* 试卷卡片（新版） */
.paper-premium-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12) !important;
    border-color: #0d6efd44 !important;
}
.paper-premium-card.completed:hover {
    border-color: #28a74544 !important;
}
/* 卡片交错入场动画 */
#paperGrid .col-md-6 { animation: fadeInCard 0.5s ease forwards; opacity: 0; }
#paperGrid .col-md-6:nth-child(1) { animation-delay: 0.05s; }
#paperGrid .col-md-6:nth-child(2) { animation-delay: 0.10s; }
#paperGrid .col-md-6:nth-child(3) { animation-delay: 0.15s; }
#paperGrid .col-md-6:nth-child(4) { animation-delay: 0.20s; }
#paperGrid .col-md-6:nth-child(5) { animation-delay: 0.25s; }
#paperGrid .col-md-6:nth-child(6) { animation-delay: 0.30s; }
@keyframes fadeInCard { to { opacity: 1; } }

/* 旧版兼容 */
.paper-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.paper-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

/* 动画 */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.card {
    animation: fadeInUp 0.3s ease-out forwards;
    opacity: 1; /* 回退值，确保动画未播放时卡片也可见 */
}

/* 回到顶部 */
#backToTop {
    transition: opacity 0.3s;
}

/* 响应式 */
@media (max-width: 768px) {
    .navbar-brand { font-size: 16px; }
    .score-circle { width: 100px !important; height: 100px !important; }
    .score-circle .fs-1 { font-size: 1.5rem !important; }
}

/* 分页 */
.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
}

/* ========== 个人中心增强样式 ========== */

/* 头像预览 */
.avatar-circle {
    transition: transform 0.2s ease, background-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* 头像选择器 */
.color-option {
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.color-option:hover {
    transform: scale(1.15);
}

.emoji-option {
    transition: all 0.2s ease;
}

.emoji-option:hover {
    transform: scale(1.2);
}

/* 考试详情Modal中选项样式 */
.exam-detail-option {
    font-size: 13px;
}

/* 会员计划卡片 */
.member-plan-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.member-plan-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* 统计数据卡片 */
.stat-card {
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

/* 学习日历 */
.calendar-box {
    aspect-ratio: 1;
    border-radius: 4px;
    transition: transform 0.15s;
}

.calendar-box:hover {
    transform: scale(1.2);
    z-index: 2;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 分数趋势图 */
.score-trend-chart svg {
    max-height: 240px;
}

/* ========== 错题集增强样式 ========== */

/* 错题项 */
.error-item {
    transition: background-color 0.2s;
}

.error-item:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

/* 重做模式 */
#redoModeContainer {
    scroll-margin-top: 80px;
}

.answer-btn {
    transition: all 0.2s ease;
    font-weight: 500;
}

.answer-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

.answer-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* 重做进度条 */
.redo-progress-bar {
    height: 4px;
    background: linear-gradient(to right, #ffc107, #0d6efd);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* 解析面板动画 */
.error-item .collapse {
    transition: all 0.3s ease;
}

/* 随机抽题modal */
#randomPickerModal .modal-body {
    padding: 1.5rem;
}

/* 批量选择指示 */
.selected-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: 12px;
}

/* ========== 逐题解析相关样式 ========== */

/* 解析文字框 */
.analysis-text {
    white-space: pre-wrap;
    line-height: 1.7;
    color: #1a7a2e;
}

.analysis-box {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
}

.analysis-box .analysis-label {
    font-weight: 600;
    color: #16a34a;
    margin-bottom: 4px;
}

/* 后台解析textarea */
.analysis-textarea {
    resize: vertical;
    font-size: 12px;
    min-height: 44px;
    border-radius: 4px;
}

.analysis-textarea:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 0.15rem rgba(34, 197, 94, 0.25);
}

/* 解析卡片过渡 */
#analysisCardBody {
    transition: all 0.3s ease;
}

/* 解析计数器badge */
.analysis-count-badge {
    font-size: 12px;
    transition: all 0.2s;
}

/* Markdown渲染区 */
.analysis-rendered p {
    margin-bottom: 4px;
}
.analysis-rendered pre {
    margin: 6px 0;
}
.analysis-rendered img {
    max-width: 100%;
    height: auto;
}
.analysis-rendered code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

/* 解析编辑器卡片 */
.analysis-editor-card .analysis-toolbar {
    gap: 2px;
}
.analysis-editor-card .analysis-toolbar .btn {
    font-size: 11px;
    padding: 2px 7px;
}

/* ========== 头像增强 ========== */

/* Emoji头像放大布满圆圈 */
.avatar-circle {
    transition: transform 0.2s ease, background-color 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1;
}

/* 导航栏头像 */
.nav-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    margin-right: 4px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ========== VIP页面 ========== */
.vip-hero {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 50%, #ffd452 100%);
    color: #fff;
    border-radius: 12px;
    padding: 40px;
    text-align: center;
}

.vip-plan-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.vip-plan-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.vip-plan-card.popular {
    border: 2px solid #ffc107;
}

.vip-plan-card.popular::before {
    content: '推荐';
    position: absolute;
    top: 12px;
    right: -30px;
    background: #ffc107;
    color: #000;
    font-size: 12px;
    padding: 2px 40px;
    transform: rotate(45deg);
}

.vip-qrcode {
    width: 200px;
    height: 200px;
    object-fit: contain;
    border: 3px solid #f0f0f0;
    border-radius: 12px;
}

/* ========== 试卷卡片完成状态 ========== */
.paper-card.done-card {
    border-left: 3px solid #198754;
    background: linear-gradient(135deg, #f1faf4 0%, #ffffff 50%);
    position: relative;
}
.paper-card.done-card::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 48px; height: 48px;
    background: linear-gradient(135deg, transparent 50%, rgba(25,135,84,0.08) 50%);
    border-radius: 0 4px 0 0;
}
.paper-card.done-card:hover {
    box-shadow: 0 6px 20px rgba(25, 135, 84, 0.12) !important;
}

/* ========== 暗色模式 ========== */
html.dark-mode {
    filter: invert(0.9) hue-rotate(180deg);
}
html.dark-mode img,
html.dark-mode video,
html.dark-mode canvas,
html.dark-mode .pdf-viewer canvas,
html.dark-mode .chartjs-render-monitor,
html.dark-mode [style*="background-image"] {
    filter: invert(1) hue-rotate(180deg) !important;
}
html.dark-mode .paper-premium-card {
    background: #1e1e2e !important;
    border-color: #2d2d3f !important;
}
html.dark-mode .paper-premium-card:hover {
    box-shadow: 0 12px 40px rgba(100,100,255,0.15) !important;
}
html.dark-mode .navbar {
    filter: invert(0.95) hue-rotate(180deg);
}
html.dark-mode .admin-sidebar {
    filter: invert(0.9) hue-rotate(180deg);
}

/* ========== 导航头像 ========== */
.nav-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 50%;
    font-size: 0.85rem;
    font-weight: 600;
    flex-shrink: 0;
}

/* ========== 学习日历热力图 ========== */
.heatmap-cell {
    width: 14px; height: 14px;
    border-radius: 2px;
    background: #ebedf0;
    margin: 2px;
    transition: transform 0.15s;
}
.heatmap-cell:hover {
    transform: scale(1.3);
    z-index: 1;
}
.heatmap-cell.lv1 { background: #9be9a8; }
.heatmap-cell.lv2 { background: #40c463; }
.heatmap-cell.lv3 { background: #30a14e; }
.heatmap-cell.lv4 { background: #216e39; }

/* ========== Toast动画 ========== */
@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(40px) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

/* ========== 分享卡片 ========== */
.share-card-preview {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
    width: 400px;
    max-width: 100%;
}

/* ========== Hero 横幅（首页未登录） ========== */
.hero-banner {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 30%, #0f3460 60%, #533483 100%);
    box-shadow: 0 12px 40px rgba(15, 52, 96, 0.3);
}
.hero-bg {
    position: absolute;
    inset: 0;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(83, 52, 131, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(15, 52, 96, 0.5) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(230, 57, 70, 0.15) 0%, transparent 40%);
    z-index: 0;
}
.hero-content {
    position: relative;
    z-index: 1;
    padding: 48px 20px 44px;
}
.hero-title {
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 0%, #c4b5fd 50%, #93c5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.3;
}
.hero-subtitle {
    color: rgba(255,255,255,0.7);
    font-size: 1.05rem;
    margin-top: 8px;
    font-weight: 400;
    letter-spacing: 0.5px;
}
.hero-stats { gap: 0; }
.hero-stat-item { text-align: center; min-width: 80px; }
.hero-stat-num {
    font-size: 1.7rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}
.hero-stat-label {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.55);
    margin-top: 2px;
}
.hero-stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255,255,255,0.15);
    align-self: center;
}
.hero-actions .btn {
    transition: all 0.3s ease;
}
.hero-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}
.hero-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}
.hero-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    animation: heroFloat 4s ease-in-out infinite;
}
@keyframes heroFloat {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.3; }
    50% { transform: translateY(-12px) scale(1.5); opacity: 0.7; }
}
@media (max-width: 768px) {
    .hero-content { padding: 32px 16px 28px; }
    .hero-title { font-size: 1.5rem; }
    .hero-subtitle { font-size: 0.9rem; }
    .hero-stat-num { font-size: 1.3rem; }
    .hero-stat-divider { height: 32px; }
}

/* ========== 导航增强 ========== */
.navbar .nav-link {
    transition: all 0.2s ease;
    border-radius: 8px;
    padding: 6px 10px !important;
    margin: 0 1px;
}
.navbar .nav-link:hover {
    background: rgba(255,255,255,0.12);
}
.navbar .nav-link.active {
    background: rgba(255,255,255,0.18);
    font-weight: 600;
}
.nav-highlight { position: relative; }
.nav-highlight::after {
    content: '';
    position: absolute;
    top: 4px;
    right: 4px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ffc107;
    animation: navDotPulse 2s infinite;
}
@keyframes navDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.6); }
}
.navbar .dropdown-menu {
    border: none;
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    border-radius: 12px;
    padding: 8px;
    margin-top: 8px;
}
.navbar .dropdown-item {
    border-radius: 8px;
    padding: 8px 14px;
    transition: all 0.15s;
}
.navbar .dropdown-item:hover {
    background: rgba(13, 110, 253, 0.08);
}
.navbar .dropdown-item i {
    width: 20px;
    text-align: center;
    margin-right: 6px;
    opacity: 0.7;
}
@media (max-width: 991.98px) {
    .navbar .nav-link {
        padding: 8px 14px !important;
        margin: 2px 0;
    }
}

/* ========== 移动端底部导航栏 ========== */
.mobile-tab-bar { display: none; }
@media (max-width: 767.98px) {
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1040;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        padding: 6px 0 env(safe-area-inset-bottom, 8px);
        box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
        justify-content: space-around;
        align-items: center;
    }
    .mobile-tab-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #9ca3af;
        font-size: 0.65rem;
        padding: 4px 0;
        transition: all 0.2s;
        min-width: 56px;
        position: relative;
    }
    .mobile-tab-item i { font-size: 1.25rem; margin-bottom: 2px; transition: all 0.2s; }
    .mobile-tab-item.active { color: #0d6efd; }
    .mobile-tab-item.active i { transform: translateY(-2px); }
    .mobile-tab-item.active::before {
        content: '';
        position: absolute;
        top: -7px;
        width: 24px;
        height: 3px;
        border-radius: 3px;
        background: #0d6efd;
    }
    body.has-mobile-tab { padding-bottom: 64px; }
    body.has-mobile-tab #backToTop { bottom: 72px !important; }
    body.has-mobile-tab footer { margin-bottom: 60px; }
    html.dark-mode .mobile-tab-bar { background: #1a1a2e; border-color: #2d2d3f; }
}

/* ========== 骨架屏 ========== */
.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-card {
    border-radius: 16px;
    overflow: hidden;
    background: #fff;
    border: 1px solid #e8e8ec;
    padding: 0;
}
.skeleton-card .skeleton-strip { height: 4px; margin-bottom: 16px; }
.skeleton-card .skeleton-body { padding: 16px 20px; }
.skeleton-line { height: 14px; margin-bottom: 10px; border-radius: 6px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.long { width: 95%; }
.skeleton-tag {
    display: inline-block;
    width: 56px;
    height: 22px;
    margin-right: 6px;
    margin-bottom: 6px;
    border-radius: 12px;
}
.skeleton-stat {
    display: flex;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1px solid #f0f0f5;
    margin-top: 10px;
}
.skeleton-stat .skeleton-line { width: 30%; height: 10px; margin: 0; }
html.dark-mode .skeleton {
    background: linear-gradient(90deg, #2d2d3f 25%, #3d3d55 50%, #2d2d3f 75%);
    background-size: 200% 100%;
}
html.dark-mode .skeleton-card { background: #1e1e2e; border-color: #2d2d3f; }
html.dark-mode .skeleton-stat { border-color: #2d2d3f; }

/* ========== 数据看板卡片增强 ========== */
.stat-card-enhanced {
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
    cursor: default;
}
.stat-card-enhanced:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.08) !important;
}
.stat-card-enhanced .stat-icon { transition: transform 0.3s; }
.stat-card-enhanced:hover .stat-icon { transform: scale(1.1); }

/* ========== 意见反馈页面 ========== */

/* 反馈类型按钮增强 */
#feedbackForm .btn-check + .btn-outline-danger:hover,
#feedbackForm .btn-check + .btn-outline-primary:hover,
#feedbackForm .btn-check + .btn-outline-success:hover {
    transform: translateY(-1px);
    transition: transform 0.15s ease;
}
#feedbackForm .btn-check:checked + .btn-outline-danger {
    color: #fff;
    background-color: var(--bs-danger);
    border-color: var(--bs-danger);
}
#feedbackForm .btn-check:checked + .btn-outline-primary {
    color: #fff;
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}
#feedbackForm .btn-check:checked + .btn-outline-success {
    color: #fff;
    background-color: var(--bs-success);
    border-color: var(--bs-success);
}

/* 反馈历史列表项hover */
.feedback-list-item {
    transition: background-color 0.15s ease;
}
.feedback-list-item:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.03);
}

/* 管理员回复框 */
.admin-reply-box {
    position: relative;
}
.admin-reply-box::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--bs-info);
    border-radius: 2px;
}

/* 反馈状态徽章微动画 */
.feedback-status-badge {
    transition: all 0.2s ease;
}

/* 空状态 */
.feedback-empty {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--bs-secondary);
}
.feedback-empty i {
    font-size: 3rem;
    opacity: 0.3;
}

/* 后台反馈列表 - 待处理行高亮 */
.table tr.table-warning {
    --bs-table-bg-opacity: 0.1;
}

/* 模态框反馈内容区 */
#modalContent {
    max-height: 200px;
    overflow-y: auto;
}

/* 暗色模式下管理员回复框 */
html.dark-mode .admin-reply-box {
    background-color: rgba(var(--bs-info-rgb), 0.08) !important;
    border-color: rgba(var(--bs-info-rgb), 0.3) !important;
}

/* ========== 站点公告弹窗 ========== */
#announcementModal .modal-dialog { max-width: 560px; }
#announcementModal .modal-content { border-radius: 12px; overflow: hidden; }
#announcementModal .modal-header { border-radius: 10px 10px 0 0; }
#announcementModal .modal-body { max-height: 60vh; overflow-y: auto; }

/* 公告类型颜色微调 */
#announcementModal .modal-header.bg-warning { color: #212529 !important; }

/* 入场动画 */
#announcementModal.show .modal-dialog {
    animation: announceBounceIn 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}
@keyframes announceBounceIn {
    from { opacity: 0; transform: scale(0.92) translateY(-20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* 暗色模式适配 */
html.dark-mode #announcementModal .modal-content {
    background: #1e1e2e;
    border: 1px solid #2d2d3f;
}
html.dark-mode #announcementModal .modal-footer {
    background: #1e1e2e;
}
