@charset "utf-8";
/* style.css - 主页专用样式（index.php / login.php）
   与 template/style-stats.css 不重复
   注意：后台页面请同时引入 style-stats.css
*/

@font-face {
    font-family: 'RadioLand';
    src: url('../fonts/LCD.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', Roboto, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 16px;
    color: #334155;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* =============== 头部（主页独有渐变背景） =============== */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.header h1 {
    font-size: 1.9rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    background-clip: text;
    display: inline-block;
    letter-spacing: -0.5px;
}

.header p {
    margin: 0;
    color: #64748b;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    font-size: 0.95rem;
    margin-top: 10px;
}

.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 20px;
}

.nav-links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.nav-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.25s;
    padding: 8px 16px;
    border-radius: 24px;
    background: #f8fafc;
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px dashed #667eea;
}

.nav-links a:hover {
    background: #667eea;
    color: white;
    border-color: #fff;
    transform: translateY(-1px);
}

.admin-badge {
    background: #f0f7ff;
    padding: 8px 20px;
    border-radius: 24px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px dashed #667eea;
}

.logout-btn {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 16px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #b91c1c;
}

/* =============== 统计卡片（主页卡片样式） =============== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: 28px;
    padding: 26px 18px;
    text-align: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.12);
    position: relative;
    overflow: hidden;
    border-left: 4px solid #FFC107;
    border-right: 4px solid #FFC107;
}

.stat-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.08) 0%, transparent 70%);
    z-index: 0;
    opacity: 0;
    transition: opacity 0.4s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
    border-color: rgba(102, 126, 234, 0.25);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-number {
    font-size: 2.8rem;
    background: linear-gradient(135deg, #1e293b, #334155);
    -webkit-background-clip: text;
    background-clip: text;
    color: #9C27B0;
    line-height: 1.2;
    font-family: 'RadioLand', fantasy;
    letter-spacing: 5px;
}

.stat-label {
    color: #64748b;
    font-size: 0.88rem;
    margin-top: 0px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* =============== 区域容器 =============== */
.trend-section,
.details-section,
.day-details-section {
    background: white;
    border-radius: 28px;
    padding: 26px;
    margin-bottom: 24px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
    border: 1px solid #f1f5f9;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 22px;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #1e293b;
    padding-bottom: 10px;
    border-bottom: 3px solid #667eea;
    display: inline-block;
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    opacity: 0.3;
    z-index: -1;
}



/* =============== 折线图样式（主页ECharts） =============== */
.chart-container {
    position: relative;
    height: auto;
    width: 100%;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 5px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-stats {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e40af;
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-change {
    font-size: 0.95rem;
    font-weight: 600;
}

.stat-change.positive {
    color: #dc2626;
}

.stat-change.negative {
    color: #0d9488;
}

.chart-controls {
    margin-bottom: 15px;
}

.time-filter {
    display: flex;
    background: #f1f8ff;
    border-radius: 12px;
    padding: 4px;
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.1);
}

.filter-btn {
    padding: 8px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    color: #64748b;
    font-size: 0.95rem;
}

.filter-btn.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.3);
}

.chart-area {
    position: relative;
    width: 100%;
    height: auto;
    margin: 15px 0 10px;
    aspect-ratio: 900 / 250;
}

.line-chart {
    width: 100%;
    height: 100%;
    display: block;
}

.empty-chart {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    font-size: 1.2rem;
    font-weight: 500;
}

.x-axis-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    padding: 0 20px;
}

.x-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    text-align: center;
    flex: 1;
    min-width: 60px;
}

.y-axis-labels {
    position: absolute;
    left: 10px;
    top: 30px;
    height: calc(100% - 60px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-left: 10px;
    z-index: 3;
}

.y-label {
    font-size: 0.8rem;
    color: #94a3b8;
    font-weight: 500;
    text-align: right;
    min-width: 40px;
}

.data-point {
    cursor: pointer;
    transition: all 0.3s ease;
}

.data-point:hover {
    r: 8;
    stroke: white;
    stroke-width: 2;
}

.tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(6px);
    border: 1px solid #cbd5e1;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    pointer-events: none;
    z-index: 100;
    transform: translateX(-50%) translateY(-120%);
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    min-width: 260px;
    border-left: 4px solid #3b82f6;
}

.tooltip.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(-150%);
}

.tooltip-date {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1e40af;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tooltip-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.metric-item {
    display: flex;
    flex-direction: column;
}

.metric-label {
    font-size: 0.85rem;
    color: #64748b;
}

.metric-value {
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 2px;
}

.legend {
    display: flex;
    gap: 25px;
    margin-top: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.legend-color {
    width: 24px;
    height: 4px;
    border-radius: 2px;
}

.legend-primary {
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
}

#echarts-chart {
    border-radius: 16px;
    transition: all 0.3s ease;
}

.echarts-loading {
    border-radius: 16px;
}

.echarts-toolbox-icon {
    border-radius: 8px !important;
}

.echarts-toolbox-icon:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

.spinner {
    border: 3px solid #e2e8f0;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* =============== 表格（主页表格样式） =============== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 20px;
    margin: 0 -10px;
    padding: 0 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 750px;
}

th {
    background: #f8fafc;
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
}

td {
    padding: 10px 15px;
    border-bottom: 1px dashed #9e9e9e;
    color: #334155;
}

tr:hover {
    background: #fefce8;
}

.ip-badge {
    font-family: 'SF Mono', 'Menlo', monospace;
    background: #eef2ff;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4338ca;
    display: inline-block;
    border: 1px solid #c7d2fe;
}

.referer-text {
    max-width: 350px;
    white-space: nowrap;
    font-size: 0.8rem;
    color: #2563eb;
    cursor: pointer;
    scrollbar-width: thin;
    scrollbar-color: #667eea #e2e8f0;
    cursor: help;
}

.referer-link {
    text-decoration: none;
    display: inline-block;
    max-width: 380px;
}

.referer-link:hover .referer-text {
    text-decoration: underline;
    color: #1d4ed8;
}

.empty-row td {
    text-align: center;
    color: #94a3b8;
    padding: 35px;
    font-style: italic;
    font-size: 1.1rem;
}

.referer-link,
.referer-text,
.referer-direct,
.referer-internal {
    font-size: 0.85rem;
    line-height: 1.4;
}

.referer-link::before,
.referer-text::before,
.referer-direct::before,
.referer-internal::before {
    font-size: 1rem;
    display: inline-block;
    width: 1.2em;
    text-align: center;
}

.referer-link,
.referer-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    vertical-align: middle;
}

/* =============== 排序按钮 =============== */
.sort-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.sort-btn {
    background: #f1f5f9;
    border: none;
    padding: 8px 20px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-btn:hover:not(.active) {
    background: #e2e8f0;
    color: #1e293b;
    transform: translateY(-1px);
}

.sort-btn.active {
    background: linear-gradient(135deg, #009688, #4CAF50);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.35);
    transform: translateY(-1px);
}

/* =============== 登录页 =============== */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: white;
    border-radius: 32px;
    padding: 36px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 10;
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.login-header h1 {
    font-size: 2.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.login-header p {
    color: #64748b;
    font-size: 1.05rem;
    line-height: 1.5;
}

.alert-login {
    padding: 14px;
    border-radius: 16px;
    margin-bottom: 24px;
    text-align: center;
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.alert-error {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.btn-login {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 30px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.5px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.55);
}

.login-footer {
    text-align: center;
    margin-top: 28px;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.6;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

/* =============== 页脚 =============== */
footer {
    text-align: center;
    padding: 22px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.88rem;
    margin-top: 10px;
    line-height: 1.5;
}

/* =============== 辅助类 =============== */
.loading {
    text-align: center;
    padding: 30px;
    color: #94a3b8;
    font-style: italic;
    font-size: 1.1rem;
}

.hidden {
    display: none !important;
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    flex-wrap: wrap;
}

.pagination button {
    background: #f1f5f9;
    border: none;
    padding: 8px 16px;
    border-radius: 30px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    transition: all 0.25s;
    min-width: 40px;
}

.pagination button:hover:not(:disabled) {
    background: #667eea;
    color: white;
    transform: translateY(-1px);
}

.pagination button.active-page,
.pagination button:disabled {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.page-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #475569;
    padding: 6px 12px;
    margin: 0 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background: #e2e8f0;
    color: #1e293b;
}

.page-btn.active {
    background: #4f46e5 !important;
    color: white !important;
    font-weight: 600;
    border-color: #4338ca;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.day-summary-stats {
    display: inline-flex;
    gap: 18px;
    margin-left: 20px;
    font-size: 0.9rem;
    font-weight: normal;
    color: #64748b;
    flex-wrap: wrap;
}

.day-summary-stats span {
    background: #f1f5f9;
    padding: 5px 14px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.day-summary-stats strong {
    color: #667eea;
    font-weight: 600;
}

.close-day-details {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    padding: 8px 18px;
    border-radius: 24px;
    font-weight: 500;
    cursor: pointer;
    color: #64748b;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.05rem;
}

.close-day-details:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fecaca;
    transform: scale(1.05);
}

/* IP地区显示样式 */
.ip-location {
    font-size: 0.65rem;
    color: #94a3b8;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* =============== 动画 =============== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.trend-section,
.details-section,
.day-details-section {
    animation: fadeIn 0.45s ease-out forwards;
    opacity: 0;
}

.stat-card:nth-child(1) {
    animation-delay: 0.1s;
}

.stat-card:nth-child(2) {
    animation-delay: 0.15s;
}

.stat-card:nth-child(3) {
    animation-delay: 0.2s;
}

.stat-card:nth-child(4) {
    animation-delay: 0.25s;
}

.trend-section {
    animation-delay: 0.3s;
}

.details-section {
    animation-delay: 0.35s;
}

/* =============== 响应式（主页专用） =============== */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .header {
        padding: 20px 16px;
        border-radius: 24px;
    }

    .header h1 {
        font-size: 1.45rem;
    }

    .header p {
        font-size: 0.9rem;
        margin-top: 8px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .stat-card {
        padding: 20px 14px;
        border-radius: 24px;
    }

    .stat-number {
        font-size: 2.3rem;
    }

    .kline-chart {
        min-width: 100%;
        gap: 10px;
        padding: 0 5px;
    }

    .kline-item {
        min-width: 65px;
        padding: 10px 4px;
        border-radius: 14px;
    }

    .kline-candle-wrapper {
        height: 110px;
    }

    .kline-date {
        font-size: 0.78rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 14px;
    }

    .sort-buttons {
        width: 100%;
        justify-content: center;
    }

    th,
    td {
        font-size: 0.85rem;
        padding: 10px 8px;
    }

    .ip-badge {
        font-size: 0.8rem;
        padding: 3px 10px;
    }

    .referer-text {
        max-width: 200px;
        font-size: 0.82rem;
    }

    .login-box {
        padding: 28px 24px;
        margin: 10px;
        border-radius: 28px;
    }

    .login-header h1 {
        font-size: 1.6rem;
    }

    .btn-login {
        font-size: 1.05rem;
        padding: 12px;
    }

    .pagination button {
        padding: 6px 12px;
        font-size: 0.85rem;
        min-width: 36px;
    }

    .close-day-details {
        padding: 6px 14px;
        font-size: 1.1rem;
    }

    .day-summary-stats {
        margin-left: 0;
        margin-top: 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .ip-location {
        font-size: 0.55rem;
    }
}

@media (max-width: 480px) {
    .chart-area {
        height: 260px;
    }

    .stat-item {
        min-width: 100px;
    }

    .x-label {
        font-size: 0.75rem;
    }

    .filter-btn {
        padding: 5px 10px;
        font-size: 0.85rem;
    }
}