/**
 * 访客信息检测 - 样式表
 * @author Albert Zhao
 * @version 2.0 (优化版)
 */

/* ===================================
   CSS 变量 - 集中管理主题配置
   =================================== */
:root {
    /* 玻璃态背景 */
    --glass-bg: rgba(255, 255, 255, 0.12);
    --glass-bg-light: rgba(255, 255, 255, 0.08);
    --glass-bg-hover: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.15);
    --glass-border-hover: rgba(255, 255, 255, 0.25);
    
    /* 文字颜色 */
    --text-primary: rgba(255, 255, 255, 0.98);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.85);
    
    /* 状态颜色 */
    --success-color: rgba(52, 199, 89, 0.9);
    --warning-color: rgba(255, 149, 0, 0.9);
    --error-color: rgba(255, 59, 48, 0.9);
    
    /* 模糊效果 */
    --blur-amount: 30px;
    --blur-light: 10px;
    
    /* 过渡动画 */
    --transition-fast: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 圆角 */
    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    
    /* 渐变背景 */
    --gradient-primary: linear-gradient(135deg, #4A5FDC 0%, #5B47D8 25%, #7B4FD6 50%, #9F5DD4 75%, #C169D1 100%);
    --gradient-overlay: linear-gradient(135deg, rgba(74, 95, 220, 0.85), rgba(123, 79, 214, 0.88), rgba(159, 93, 212, 0.90), rgba(193, 105, 209, 0.85));
}

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

/* ===================================
   页面主体
   =================================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gradient-primary);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* 背景动画 - 使用 GPU 加速 */
body::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: moveBackground 20s linear infinite;
    will-change: transform;
}

@keyframes moveBackground {
    from { transform: translate3d(0, 0, 0); }
    to { transform: translate3d(50px, 50px, 0); }
}

/* ===================================
   主容器
   =================================== */
.container {
    position: relative;
    max-width: 1400px;
    width: 95%;
    height: 95vh;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount)) saturate(150%);
    -webkit-backdrop-filter: blur(var(--blur-amount)) saturate(150%);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: 
        0 16px 48px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.25) inset,
        0 8px 16px rgba(0, 0, 0, 0.1);
    /* 移除 fadeIn 动画，防止闪烁 */
}

/* ===================================
   动画关键帧
   =================================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInContent {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes clockTick {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    75% { transform: rotate(-5deg); }
}

@keyframes overlayShow {
    0%, 100% { opacity: 0; }
    10%, 85% { opacity: 1; }
}

@keyframes textFadeIn {
    0% { opacity: 0; transform: scale(0.95); }
    15%, 85% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.98); }
}

/* ===================================
   头部区域
   =================================== */
.header-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    position: relative;
}

h1 {
    color: white;
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin: 0;
}

/* ===================================
   实时时钟
   =================================== */
.realtime-clock,
.refresh-btn {
    position: absolute;
    top: 40px;
    z-index: 1000;
    animation: fadeIn 0.8s var(--transition-fast) 0.2s backwards;
}

.realtime-clock {
    left: 40px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.clock-icon {
    font-size: 16px;
    opacity: 0.85;
    animation: clockTick 2s ease-in-out infinite;
}

.clock-time {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
}

/* ===================================
   刷新按钮
   =================================== */
.refresh-btn {
    right: 40px;
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.1) inset;
    overflow: hidden;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.25));
    transform: scale(1.1);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2), 0 0 0 1.5px rgba(255, 255, 255, 0.2) inset;
}

.refresh-btn:active {
    transform: scale(0.95);
}

.refresh-btn .icon {
    display: inline-block;
    transition: transform 0.6s ease;
    font-size: 18px;
}

.refresh-btn:hover .icon {
    transform: rotate(360deg);
}

/* ===================================
   加载状态
   =================================== */
.loading {
    text-align: center;
    color: white;
    font-size: 16px;
    margin: 20px 0;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top: 3px solid rgba(255, 255, 255, 0.9);
    border-right: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 15px;
    will-change: transform;
}

/* ===================================
   标签导航
   =================================== */
.tabs-container {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.05);
    padding: 4px;
    backdrop-filter: blur(var(--blur-light));
    -webkit-backdrop-filter: blur(var(--blur-light));
    border: 1.5px solid var(--glass-border);
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    color: var(--text-muted);
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    flex: 1;
    min-width: fit-content;
}

.tab-btn:hover {
    background: var(--glass-bg-hover);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
    font-weight: 600;
}

/* ===================================
   内容区域
   =================================== */
.content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tab-content {
    display: none;
    animation: fadeInContent 0.4s ease-out;
    max-height: calc(95vh - 220px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px;
}

.tab-content.active {
    display: block;
}

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

.tab-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

.tab-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ===================================
   信息区块
   =================================== */
.info-section {
    background: var(--glass-bg-light);
    backdrop-filter: blur(var(--blur-light));
    -webkit-backdrop-filter: blur(var(--blur-light));
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1.5px solid var(--glass-border);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.section-title {
    color: white;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 4px;
    height: 20px;
    background: linear-gradient(180deg, #fff, rgba(255,255,255,0.5));
    border-radius: 2px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

/* ===================================
   信息项
   =================================== */
.info-item {
    background: rgba(255, 255, 255, 0.04);
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: var(--transition-fast);
    cursor: pointer;
    position: relative;
    contain: layout style;
}

.info-item:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.info-item:active {
    transform: scale(0.98);
}

.info-label {
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    font-weight: 500;
}

.info-value {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    word-break: break-word;
    line-height: 1.5;
}

/* ===================================
   代理检测状态
   =================================== */
.proxy-detected {
    background: linear-gradient(135deg, rgba(255, 149, 0, 0.08), rgba(255, 107, 0, 0.12)) !important;
    border: 1.5px solid rgba(255, 149, 0, 0.3) !important;
    box-shadow: 0 4px 16px rgba(255, 149, 0, 0.08), 0 0 0 1px rgba(255, 149, 0, 0.1) inset !important;
}

.proxy-detected::before {
    content: '⚠️';
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 18px;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

.proxy-clean {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.06), rgba(48, 209, 88, 0.1)) !important;
    border: 1.5px solid rgba(52, 199, 89, 0.25) !important;
    box-shadow: 0 4px 16px rgba(52, 199, 89, 0.06), 0 0 0 1px rgba(52, 199, 89, 0.08) inset !important;
}

.proxy-clean::before {
    content: '✓';
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 20px;
    color: var(--success-color);
    font-weight: bold;
    opacity: 0.8;
}

/* ===================================
   复制反馈
   =================================== */
.info-item.copied {
    background: rgba(52, 199, 89, 0.25) !important;
    border-color: rgba(52, 199, 89, 0.5) !important;
}

.copy-overlay {
    position: absolute;
    inset: 0;
    background: var(--gradient-overlay);
    backdrop-filter: blur(15px) saturate(180%);
    -webkit-backdrop-filter: blur(15px) saturate(180%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    animation: overlayShow 1.5s var(--transition-fast);
    z-index: 10;
}

.copy-overlay-text {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    opacity: 0;
    animation: textFadeIn 1.5s var(--transition-fast);
}

.copy-overlay.error {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.85), rgba(255, 99, 71, 0.88), rgba(255, 69, 58, 0.85));
}

/* ===================================
   返回顶部按钮
   =================================== */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    color: white;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transition: var(--transition-fast);
    z-index: 1000;
}

.back-to-top.show {
    display: flex;
}

.back-to-top:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.3));
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.2);
}

/* ===================================
   页脚
   =================================== */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 20px;
    background: var(--glass-bg-light);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border-top: 1px solid var(--glass-border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.3px;
    z-index: 999;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.1);
}

.footer-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.footer-text::before {
    content: '⚡';
    font-size: 14px;
    animation: pulse 2s ease-in-out infinite;
}

.footer-author {
    color: var(--text-muted);
    font-weight: 600;
    background: linear-gradient(135deg, #fff, rgba(255, 255, 255, 0.8));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===================================
   错误提示
   =================================== */
.error {
    background: rgba(255, 59, 48, 0.2);
    color: white;
    padding: 15px;
    border-radius: var(--radius-sm);
    margin: 10px 0;
    border: 1px solid rgba(255, 59, 48, 0.3);
}

/* ===================================
   移动端手风琴
   =================================== */
.mobile-accordion {
    display: none;
}

.accordion-item {
    margin-bottom: 12px;
}

.accordion-header {
    background: var(--glass-bg-hover);
    backdrop-filter: blur(var(--blur-light));
    -webkit-backdrop-filter: blur(var(--blur-light));
    color: white;
    border: 1.5px solid var(--glass-border-hover);
    padding: 16px 20px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition-fast);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.accordion-header:active {
    transform: scale(0.98);
}

.accordion-header.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.4);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.accordion-icon {
    font-size: 14px;
    transition: transform var(--transition-fast);
}

.accordion-header.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-fast);
}

.accordion-content.active {
    max-height: 3000px;
}

.accordion-body {
    background: var(--glass-bg-light);
    border: 1.5px solid var(--glass-border);
    border-top: none;
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
    padding: 20px;
}

/* ===================================
   响应式设计 - 平板
   =================================== */
@media (max-width: 768px) {
    body {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }

    .container {
        padding: 20px;
        margin: 10px 0 80px 0;
        height: auto;
        max-height: none;
        border-radius: var(--radius-lg);
    }

    .header-container {
        flex-direction: row;
        gap: 10px;
        margin-bottom: 8px;
    }

    h1 {
        font-size: 22px;
        text-align: left;
    }

    .realtime-clock {
        padding: 10px 18px;
        margin-bottom: 20px;
        border-radius: var(--radius-md);
    }

    .tabs-container,
    .tab-content {
        display: none !important;
    }

    .mobile-accordion {
        display: block;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .info-section {
        padding: 20px;
        border-radius: var(--radius-md);
    }

    .section-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .info-item {
        padding: 14px;
        min-height: 68px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .info-label {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .info-value {
        font-size: 15px;
        line-height: 1.4;
    }

    .refresh-btn {
        width: 42px;
        height: 42px;
    }

    .refresh-btn .icon {
        font-size: 20px;
    }

    .back-to-top {
        bottom: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
        font-size: 22px;
    }

    .footer {
        padding: 10px 16px;
        font-size: 12px;
    }

    .footer-text::before {
        font-size: 12px;
    }

    .content-wrapper {
        width: 100%;
    }

    .loading {
        font-size: 15px;
    }

    .spinner {
        width: 36px;
        height: 36px;
    }
}

/* ===================================
   响应式设计 - 手机
   =================================== */
@media (max-width: 480px) {
    .container {
        padding: 16px;
        border-radius: 20px;
    }

    h1 {
        font-size: 20px;
    }

    .info-section {
        padding: 16px;
    }

    .section-title {
        font-size: 16px;
    }

    .info-item {
        padding: 12px;
        min-height: 64px;
    }

    .info-label {
        font-size: 10px;
    }

    .info-value {
        font-size: 14px;
    }

    .accordion-header {
        padding: 14px 16px;
        font-size: 15px;
    }

    .back-to-top {
        bottom: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}

/* ===================================
   防止 FOUC 闪烁
   =================================== */
.content-hidden {
    opacity: 0;
    visibility: hidden;
}

.content-visible {
    opacity: 1;
    visibility: visible;
    animation: fadeInPage 0.4s ease-out;
}

@keyframes fadeInPage {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
