/* 统计页面样式 - 现代深色调舒适配色 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1a1f2e 0%, #2d3748 100%);
    min-height: 100vh;
    color: #e2e8f0;
    position: relative;
    overflow-x: hidden;
}

/* 精致的背景纹理 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.content-wrapper {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

/* Header - 简洁优雅 */
header {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: -0.5px;
    margin-bottom: 0.5rem;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
    font-weight: 500;
}

.back-link:hover {
    color: #cbd5e1;
}

/* 自动刷新控制 - 紧凑设计 */
.refresh-control {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: rgba(51, 65, 85, 0.5);
    border-radius: 8px;
    font-size: 0.8rem;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.refresh-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    color: #94a3b8;
}

.refresh-toggle input[type="checkbox"] {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.refresh-btn {
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: 6px;
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.refresh-btn:hover {
    background: rgba(99, 102, 241, 0.25);
    transform: scale(1.02);
}

.last-update {
    font-size: 0.75rem;
    color: #64748b;
}

/* 登录界面 - 简约优雅 */
#login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
}

.login-card {
    background: rgba(51, 65, 85, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 2rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 360px;
    width: 100%;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.lock-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    color: #94a3b8;
}

.login-card h2 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: #f1f5f9;
}

.password-input-wrapper {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.password-input-wrapper input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.5);
    color: #e2e8f0;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.password-input-wrapper input:focus {
    border-color: #6366f1;
}

.password-input-wrapper input::placeholder {
    color: #64748b;
}

.password-input-wrapper button {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    background: #6366f1;
    color: #fff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.password-input-wrapper button:hover {
    background: #4f46e5;
}

.error-message {
    color: #f87171;
    font-size: 0.85rem;
    min-height: 1.2rem;
}

/* 统计概览卡片 - 紧凑优雅 */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stats-card {
    background: rgba(51, 65, 85, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    gap: 0.9rem;
    transition: all 0.25s;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border-color: rgba(148, 163, 184, 0.2);
}

.stats-icon {
    font-size: 1.6rem;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* 柔和优雅的图标背景 */
.pv-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.pv-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite;
}

.uv-icon {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.15) 0%, rgba(244, 63, 94, 0.15) 100%);
    border: 1px solid rgba(236, 72, 153, 0.3);
    color: #f9a8d4;
}

.uv-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(236, 72, 153, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite 1s;
}

.total-icon {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: #7dd3fc;
}

.total-icon::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
    animation: pulse 3s ease-in-out infinite 2s;
}

/* 图标的 i 元素 */
.stats-icon i {
    position: relative;
    z-index: 1;
    font-size: 1.6rem;
}

/* 脉冲动画 */
@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.stats-content {
    flex: 1;
}

.stats-label {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.3rem;
    font-weight: 500;
}

.stats-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #f1f5f9;
}

/* 通用section容器 */
.hour-distribution-section,
.top-pages-section,
.device-browser-section,
.trends-section,
.recent-access-section {
    background: rgba(51, 65, 85, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    padding: 1.2rem;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    margin-bottom: 1.2rem;
    border: 1px solid rgba(148, 163, 184, 0.1);
}

.hour-distribution-section h2,
.top-pages-section h2,
.device-browser-section h2,
.trends-section h2,
.recent-access-section h2 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: #f1f5f9;
}

/* 24小时图表 */
.hour-chart-container,
.chart-container {
    background: rgba(30, 41, 59, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
}

/* 页面访问排行 - 紧凑列表 */
.top-pages-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.top-page-item {
    display: grid;
    grid-template-columns: 32px 1fr auto 55px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: rgba(30, 41, 59, 0.4);
    border-radius: 6px;
    transition: background 0.2s;
    font-size: 0.85rem;
}

.top-page-item:hover {
    background: rgba(30, 41, 59, 0.6);
}

.page-rank {
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    color: #64748b;
}

.page-name {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e2e8f0;
}

.page-name i {
    color: #94a3b8;
    flex-shrink: 0;
}

.page-bar {
    flex: 1;
    height: 4px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.page-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.page-count {
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    color: #cbd5e1;
}

/* 设备和浏览器统计 */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.stats-col h2 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #f1f5f9;
}

.stat-bars {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.stat-bar-item {
    display: grid;
    grid-template-columns: 70px 1fr 100px;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #cbd5e1;
}

.stat-bar {
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #06b6d4, #3b82f6);
    border-radius: 3px;
    transition: width 0.5s ease;
}

.stat-value {
    font-size: 0.8rem;
    text-align: right;
    color: #94a3b8;
}

/* 趋势表格 - 紧凑设计 */
.trends-table {
    overflow-x: auto;
    margin-top: 1rem;
}

.trends-table table {
    width: 100%;
    border-collapse: collapse;
}

.trends-table th,
.trends-table td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    font-size: 0.85rem;
}

.trends-table th {
    font-weight: 600;
    color: #cbd5e1;
    background: rgba(30, 41, 59, 0.3);
}

.trends-table td {
    color: #e2e8f0;
}

.trends-table tr:hover {
    background: rgba(30, 41, 59, 0.4);
}

/* 最近访问记录 - 紧凑卡片 */
.access-list {
    max-height: 450px;
    overflow-y: auto;
}

.access-item {
    background: rgba(30, 41, 59, 0.4);
    border-radius: 6px;
    padding: 0.7rem 0.9rem;
    margin-bottom: 0.5rem;
    transition: background 0.2s;
}

.access-item:hover {
    background: rgba(30, 41, 59, 0.6);
}

.access-time {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.4rem;
}

.access-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.access-ip,
.access-url {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    color: #e2e8f0;
}

.access-ip i,
.access-url i {
    color: #94a3b8;
}

.no-data {
    text-align: center;
    padding: 1.5rem;
    color: #64748b;
    font-size: 0.9rem;
}

/* 滚动条样式 - 精致设计 */
.access-list::-webkit-scrollbar {
    width: 6px;
}

.access-list::-webkit-scrollbar-track {
    background: rgba(30, 41, 59, 0.3);
    border-radius: 3px;
}

.access-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.access-list::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Footer */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: #64748b;
    font-size: 0.85rem;
}

/* 响应式设计 */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.5rem;
    }

    .stats-overview {
        grid-template-columns: 1fr;
    }

    .stats-value {
        font-size: 1.4rem;
    }

    .refresh-control {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }

    .top-page-item {
        grid-template-columns: 28px 1fr 45px;
        font-size: 0.8rem;
    }

    .stat-bar-item {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .stats-row {
        grid-template-columns: 1fr;
    }

    .access-details {
        flex-direction: column;
        gap: 0.4rem;
    }
}