/* 现代化样式 - 更新版 */
:root {
    --primary-color: #009eff;
    --secondary-color: #00bbff;
    --background-color: #f4f7f6;
    --container-bg: #ffffff;
    --text-color: #333;
    --border-color: #e0e0e0;
    --error-color: #d9534f;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    box-sizing: border-box;
}

/* 登录页面 */
.login-container {
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 400px;
    margin-top: 50px;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
}

.input-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.3s;
    font-size: 16px; 
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

button, .show-more-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: box-shadow 0.3s, transform 0.2s;
    background-size: 200% 100%;
}

button:hover, .show-more-btn:hover {
    box-shadow: 0 4px 12px rgba(0, 158, 255, 0.3);
    transform: translateY(-2px);
}

.error {
    color: var(--error-color);
    background-color: #f2dede;
    border: 1px solid #ebccd1;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

/* 主内容区 */
.main-container {
    width: 100%;
    max-width: 1200px;
    background-color: var(--container-bg);
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

/* 默认桌面端样式 */
header {
    display: flex;
    justify-content: space-between; /* 左右两端对齐 */
    align-items: center; /* 垂直居中 */
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap; 
}

header h1 a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.8rem;
    margin-right: 20px; /* 增加一点右边距，防止极端情况换行不好看 */
}

header nav span {
    margin-right: 15px;
}

header nav a {
    color: var(--primary-color);
    text-decoration: none;
}
header nav a:hover {
    text-decoration: underline;
}

.content h2 {
    position: relative;
    padding-bottom: 10px;
    margin-bottom: 20px;
}
.content h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
}

/* 网站列表 */
.site-list {
    list-style: none;
    padding: 0;
}

.site-list li {
    margin-bottom: 10px;
}

.site-list li a {
    display: block;
    padding: 15px;
    background-color: #f9f9f9;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: background-color 0.3s, border-color 0.3s, transform 0.2s;
}

.site-list li a:hover {
    background-color: #eef5fc;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

/* 日志详情 */
.log-section, .analysis-section {
    margin-bottom: 40px;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.analysis-card {
    background: #fafafa;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 5px;
}
.analysis-card h4 {
    margin-top: 0;
    border-bottom: 1px solid #eee;
    padding-bottom: 8px;
}
.analysis-card ul {
    padding-left: 20px;
    margin: 0;
}

code {
    background-color: #eee;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: "Courier New", Courier, monospace;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    border: 1px solid var(--border-color);
    padding: 10px;
    text-align: left;
    vertical-align: top;
}

th {
    background-color: #f2f2f2;
    font-weight: 600;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

td.ua {
    word-break: break-all;
    font-size: 0.85em;
    color: #555;
}

/* 折叠功能样式 */
.log-table tbody.collapsible tr:nth-child(n+11) {
    display: none;
}
.show-more-btn {
    margin-top: 15px;
    width: auto;
    padding: 8px 15px;
    font-size: 14px;
}


/* ======================================================= */
/* ===== 移动端适配 (当屏幕宽度小于等于 768px 时生效) ===== */
/* ======================================================= */
@media (max-width: 768px) {
    body {
        padding: 10px; 
    }

    .main-container, .login-container {
        padding: 20px 15px;
        margin-top: 10px;
    }
    
    /* 这是实现您要求的换行效果的关键部分 */
    header {
        flex-direction: column; /* 将 flex 布局的主轴从横向改为纵向，实现堆叠效果 */
        align-items: flex-start; /* 让堆叠后的项目在交叉轴（现在是横向）上从头开始对齐，即左对齐 */
        gap: 15px; /* 在标题和导航之间增加 15px 的垂直间距 */
    }
    
    header h1 a {
        font-size: 1.5rem;
    }

    header nav {
        width: 100%;
        display: flex;
        flex-direction: column; 
        align-items: flex-start;
        gap: 8px;
    }

    .content h2 {
        font-size: 1.4rem;
    }

    /* 使表格可以水平滚动，防止页面布局被破坏 */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    th, td {
        white-space: nowrap;
    }

    .site-list li a:hover {
        transform: none;
    }
}

.notification {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
    font-size: 15px;
}
.notification.success {
    color: #155724;
    background-color: #d4edda;
    border-color: #c3e6cb;
}
.notification.error {
    color: #721c24;
    background-color: #f8d7da;
    border-color: #f5c6cb;
}
.notification.info {
    color: #0c5460;
    background-color: #d1ecf1;
    border-color: #bee5eb;
}

.ip-list-container {
    background-color: #f7f7f7;
    border: 1px solid #ddd;
    padding: 15px;
    border-radius: 5px;
    margin-top: 10px;
    font-family: monospace;
    font-size: 14px;
    line-height: 1.8;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
}