/* ============================================
   ThinNav Navigation Styles
   命名规范: BEM + tn-前缀 (ThinNav Block)
   ============================================ */

/* ============================================
   Block: tn-header (主导航头部)
   ============================================ */
.tn-header {
    background: #ffffff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05),
                0 2px 8px rgba(0, 0, 0, 0.04);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: 60px;
}

/* Element: 头部容器 */
.tn-header__container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
}

/* Element: 导航区域 */
.tn-header__nav {
    background: transparent;
    padding: 0;
    flex-shrink: 0;
}

/* Element: 导航菜单 */
.tn-header__menu {
    display: flex;
    list-style: none;
    gap: 2px;
    align-items: center;
    margin: 0;
    padding: 0;
}

/* Element: 导航链接 */
.tn-header__link {
    display: block;
    padding: 6px 10px;
    color: #4b5563;
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border-radius: 5px;
    white-space: nowrap;
}

.tn-header__link:hover {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.06);
}

/* Modifier: 激活状态 */
.tn-header__link--active {
    color: #2563eb;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(59, 130, 246, 0.08) 100%);
    position: relative;
}

.tn-header__link--active::after {
    content: '';
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 2.5px;
    background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
    border-radius: 2px;
}

.tn-header__link--active:hover {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.12) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: #1d4ed8;
}

/* Modifier: VIP链接 */
.tn-header__link--vip {
    color: #f59e0b;
}

.tn-header__link--vip:hover {
    color: #d97706;
    background: rgba(245, 158, 11, 0.08);
}

/* Element: 搜索区域 */
.tn-header__search {
    flex: 0 0 380px;
    margin: 0 10px 0 10px;
    display: flex;
    align-items: center;
    margin-left:320px;
}

/* Element: 用户区域 */
.tn-header__user {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Block: tn-user-avatar (用户头像) */
.tn-user-avatar {
    display: block;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    border: 1.5px solid #e5e7eb;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    background: #f3f4f6;
}

.tn-user-avatar:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    transform: scale(1.03);
}

.tn-user-avatar__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Block: tn-search (搜索组件) */
.tn-search {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* Element: 搜索输入框 */
.tn-search__input {
    width: 100%;
    height: 36px;
    padding: 0 44px 0 14px;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    font-size: 0.8125rem;
    color: #374151;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.02),
        0 1px 2px rgba(0, 0, 0, 0.02);
}

.tn-search__input::placeholder {
    color: #9ca3af;
    font-weight: 400;
    font-size: 0.8125rem;
}

/* ============================================
   Block: tn-modal (微信登录模态窗口)
   ============================================ */
.tn-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.tn-modal--active {
    opacity: 1;
    visibility: visible;
}

.tn-modal__overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.tn-modal__container {
    position: relative;
    z-index: 2001;
    width: 90%;
    max-width: 420px;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.tn-modal--active .tn-modal__container {
    transform: scale(1) translateY(0);
}

.tn-modal__content {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
}

.tn-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 14px;
    transition: all 0.2s ease;
    z-index: 10;
}

.tn-modal__close:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #374151;
    transform: rotate(90deg);
}

.tn-modal__header {
    text-align: center;
    padding: 32px 24px 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0f9ff 100%);
}

.tn-modal__icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #07c160 0%, #05a350 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 28px;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}

.tn-modal__title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px;
}

.tn-modal__subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.tn-modal__body {
    padding: 24px 32px;
}

.tn-qr-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.tn-qr-container {
    width: 300px;
    height: 320px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.tn-qr-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.tn-qr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    text-align: center;
    padding: 20px;
}

.tn-qr-placeholder i {
    font-size: 48px;
    margin-bottom: 12px;
    color: #07c160;
}

.tn-qr-placeholder span {
    font-size: 0.75rem;
}

/* 二维码加载动画 */
.tn-qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    padding: 30px;
}

.tn-qr-loading .tn-qr-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e5e7eb;
    border-top-color: #07c160;
    border-radius: 50%;
    animation: tnQrSpin 0.8s linear infinite;
    margin-bottom: 14px;
}

.tn-qr-loading span {
    font-size: 0.8125rem;
    white-space: nowrap;
}

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

/* 二维码有效期提示 */
.tn-qr-expire-tip {
    text-align: center;
    font-size: 0.75rem;
    color: #9ca3af;
    padding-top: 8px;
}

/* 二维码已过期状态 */
.tn-qr-expired {
    color: #ef4444 !important;
}

.tn-qr-expired i {
    color: #ef4444 !important;
}

/* 错误信息文字（显示后端返回的具体错误原因） */
.tn-qr-error-msg {
    display: block;
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-top: 6px;
    word-break: break-all;
}

/* WxLogin SDK 渲染容器 */
.tn-wxlogin-wrapper {
    width: 280px !important;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* 约束 WxLogin SDK 生成的 iframe，防止文字溢出 */
.tn-wxlogin-wrapper iframe,
.tn-wxlogin-wrapper > div {
    max-width: 100% !important;
    max-height: 100% !important;
    overflow: hidden !important;
}

/* 降级方案：SDK 加载失败时显示的可点击链接 */
.tn-qr-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.tn-qr-fallback__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 24px 20px;
    text-decoration: none;
    color: #4b5563;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 50%, #f0f9ff 100%);
    border: 1.5px dashed #07c160;
    transition: all 0.25s ease;
    min-width: 180px;
}

.tn-qr-fallback__link:hover {
    background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
    border-color: #05a350;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(7, 193, 96, 0.15);
}

.tn-qr-fallback__icon {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, #07c160 0%, #05a350 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(7, 193, 96, 0.3);
}

.tn-qr-fallback__text {
    font-size: 0.875rem;
    font-weight: 600;
    color: #111827;
}

.tn-qr-fallback__sub {
    font-size: 0.75rem;
    color: #6b7280;
}

.tn-qr-tips {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
}

.tn-qr-tip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: #f9fafb;
    border-radius: 10px;
    color: #4b5563;
    font-size: 0.75rem;
}

.tn-qr-tip i {
    font-size: 18px;
    color: #07c160;
}

.tn-qr-arrow {
    color: #d1d5db;
    font-size: 14px;
}

.tn-modal__footer {
    padding: 16px 24px 24px;
    text-align: center;
    border-top: 1px solid #f3f4f6;
}

.tn-modal__agreement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #9ca3af;
    margin: 0;
}

.tn-modal__agreement i {
    color: #10b981;
}

.tn-modal__agreement a {
    color: #2563eb;
    text-decoration: none;
}

.tn-modal__agreement a:hover {
    text-decoration: underline;
}

.tn-search__input:hover {
    border-color: #c9cdd4;
    background: #ffffff;
    box-shadow: 
        inset 0 1px 2px rgba(0, 0, 0, 0.02),
        0 2px 8px rgba(0, 0, 0, 0.04);
}

.tn-search__input:focus {
    border-color: #3b82f6;
    background: #ffffff;
    box-shadow: 
        0 0 0 4px rgba(59, 130, 246, 0.12),
        0 4px 12px rgba(59, 130, 246, 0.15);
}

/* Element: 搜索按钮 */
.tn-search__btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    color: #ffffff;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 
        0 2px 8px rgba(37, 99, 235, 0.35),
        0 1px 2px rgba(37, 99, 235, 0.2);
}

.tn-search__btn:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 50%, #1e40af 100%);
    transform: translateY(-50%) scale(1.08);
    box-shadow: 
        0 4px 14px rgba(37, 99, 235, 0.45),
        0 2px 4px rgba(37, 99, 235, 0.3);
}

.tn-search__btn:active {
    transform: translateY(-50%) scale(0.96);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Element: 操作区域 */
.tn-header__actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    align-items: center;
}

/* ============================================
   Block: tn-auth (登录/注册区域)
   ============================================ */
.tn-auth {
    position: relative;
    display: flex;
    gap: 8px;
}

/* Element: 登录按钮 */
.tn-auth__login {
    padding: 7px 18px;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    border: 1px solid #2563eb;
    background: transparent;
}

.tn-auth__login:hover,
.tn-auth__login--active {
    color: #1d4ed8;
    border-color: #1d4ed8;
    background: rgba(37, 99, 235, 0.05);
}

/* Element: 注册按钮 */
.tn-auth__register {
    padding: 7px 18px;
    border-radius: 4px;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2563eb;
    color: #fff;
    border: 1px solid #2563eb;
}

.tn-auth__register:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* Hover时按钮联动效果 */
.tn-auth:hover .tn-auth__login {
    color: #1d4ed8;
    border-color: #1d4ed8;
    background: rgba(37, 99, 235, 0.08);
}

.tn-auth:hover .tn-auth__register {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

/* ============================================
   Block: tn-tooltip (悬浮提示框)
   ============================================ */
.tn-tooltip {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    transition-delay: 0.1s;
    z-index: 1001;
}

/* Hover触发显示 */
.tn-auth:hover .tn-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
}

/* Modifier: 强制显示 */
.tn-tooltip--visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 扩展悬停区域 - 按钮与提示框之间的隐形桥梁 */
.tn-tooltip::before {
    content: '';
    position: absolute;
    top: -12px;
    left: 0;
    right: 0;
    height: 12px;
}

/* Element: 箭头 */
.tn-tooltip__arrow {
    position: absolute;
    top: -6px;
    right: 40px;
    width: 12px;
    height: 12px;
    background: #ffffff;
    transform: rotate(45deg);
    box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.03);
}

/* Element: 内容区域 */
.tn-tooltip__content {
    padding: 20px;
    position: relative;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
}

/* Element: 头部 */
.tn-tooltip__header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
}

.tn-tooltip__line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, #e5e7eb, transparent);
    max-width: 40px;
}

.tn-tooltip__title {
    font-size: 15px;
    font-weight: 600;
    color: #d4a574;
    white-space: nowrap;
    margin: 0;
}

/* ============================================
   Block: tn-features (功能网格)
   ============================================ */
.tn-features {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

/* Element: 功能项 */
.tn-features__item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.tn-features__item:hover {
    background: #f9fafb;
}

/* Element: 功能图标 */
.tn-features__icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    transition: transform 0.2s;
}

.tn-features__item:hover .tn-features__icon {
    transform: scale(1.1);
}

/* Modifier: 不同功能的颜色 */
.tn-features__icon--upload {
    background: #fef3c7;
    color: #f59e0b;
}

.tn-features__icon--search {
    background: #dbeafe;
    color: #3b82f6;
}

.tn-features__icon--exam {
    background: #fce7f3;
    color: #ec4899;
}

.tn-features__icon--practice {
    background: #d1fae5;
    color: #10b981;
}

.tn-features__icon--analysis {
    background: #e0e7ff;
    color: #6366f1;
}

.tn-features__icon--prepare {
    background: #fed7aa;
    color: #f97316;
}

/* Element: 功能文字 */
.tn-features__text {
    font-size: 13px;
    color: #4b5563;
    font-weight: 500;
}

/* ============================================
   Block: tn-login-btn (登录按钮)
   ============================================ */
.tn-login-btn {
    display: block;
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    text-align: center;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.tn-login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
    color: #ffffff;
}

/* ============================================
   Block: tn-footer (底部区域)
   ============================================ */
.tn-footer {
    text-align: center;
    font-size: 13px;
    color: #6b7280;
}

.tn-footer__link {
    color: #3b82f6;
    font-weight: 600;
    text-decoration: none;
    margin-left: 4px;
    transition: color 0.2s;
}

.tn-footer__link:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* ============================================
   Block: tn-spacer (占位元素)
   ============================================ */
.tn-spacer {
    height: 60px;
}


/* ============================================
   Responsive Design
   ============================================ */

@media (max-width: 1200px) {
    .tn-header__container {
        padding: 0 16px;
        gap: 10px;
        justify-content: center;
    }
    
    .tn-header__link {
        padding: 6px 8px;
        font-size: 0.8125rem;
    }
    
    .tn-header__search {
        flex: 0 0 320px;
        margin: 0 10px 0 8px;
    }
    
    .tn-user-avatar {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 1100px) {
    .tn-header__search {
        max-width: 340px;
    }
}

@media (max-width: 992px) {
    .tn-header__nav {
        display: none;
    }
    
    .tn-header__search {
        flex: 0 0 400px;
        margin: 0 10px;
    }
}

@media (max-width: 768px) {
    .tn-header__container {
        padding: 0 12px;
        gap: 8px;
        justify-content: center;
    }
    
    .tn-header__search {
        flex: 0 0 260px;
        margin: 0 10px 0 6px;
    }
    
    .tn-search__input {
        height: 34px;
        padding: 0 40px 0 12px;
        font-size: 0.8125rem;
    }
    
    .tn-search__btn {
        width: 26px;
        height: 26px;
        font-size: 11px;
        right: 3px;
    }
    
    .tn-user-avatar {
        width: 30px;
        height: 30px;
        border-width: 1.5px;
    }
}

@media (max-width: 640px) {
    .tn-header__container {
        padding: 0 10px;
        gap: 6px;
        justify-content: center;
    }
    
    .tn-header__search {
        flex: 0 0 220px;
        margin: 0 8px 0 4px;
    }
    
    .tn-auth__login,
    .tn-auth__register {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    .tn-tooltip {
        width: 280px;
        right: -20px;
    }
}
