/* style.css */

/* 全局样式和暗色主题变量 */
:root {
    --bg-color: #121212;
    --card-bg-color: #1e1e1e;
    --text-color: #e0e0e0;
    --primary-color: #03dac6; /* 科技感颜色 */
    --border-color: #333;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --table-header-bg: #2c2c2c;
    --table-row-hover-bg: #3a3a3a;
    --danger-color: #cf6679; /* 用于删除和警告的颜色 */
}

/* 基础页面样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Meiryo", "MS PGothic";
    background: linear-gradient(135deg, #121212, #1e1e1e);
    color: var(--text-color);
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: 600;
}

.header p {
    font-size: 1.1rem;
    color: #a0a0a0;
}

/* 主容器 */
.main-container {
    display: flex;
    flex-direction: column;
    gap: 30px;
    width: 100%;
    max-width: 900px;
}

/* 程序卡片样式 */
.program-card {
    background-color: var(--card-bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 25px;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.program-card h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.8rem;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

/* 表格样式 */
.license-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.license-table th, .license-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.license-table thead {
    background-color: var(--table-header-bg);
}

.license-table th {
    font-weight: 600;
    color: #c0c0c0;
}

.license-table tbody tr:last-child td {
    border-bottom: none;
}

.license-table tbody tr {
    transition: background-color 0.3s ease;
}

.license-table tbody tr:hover {
    background-color: rgba(3, 218, 198, 0.1);
}

/* 使用凭证单元格样式 (复制功能) */
.credential-cell {
    font-family: 'Courier New', Courier, monospace;
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.credential-cell .copy-icon {
    opacity: 0;
    font-size: 0.8em;
    color: #888;
    transition: opacity 0.2s;
}

.credential-cell:hover .copy-icon {
    opacity: 1;
}

/* 复制成功提示 */
.copy-feedback {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--primary-color);
    color: #000;
    padding: 10px 20px;
    border-radius: 5px;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.5s, bottom 0.5s;
}

/* 尾部 */
footer {
    margin-top: 50px;
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}
/* --- 页脚链接样式 --- */
.footer-link {
    color: inherit; /* 关键：继承父元素(p标签)的文字颜色 */
    text-decoration: none; /* 关键：移除下划线 */
    margin-left: 15px; /* 与前面的内容或链接保持一些间距 */
}

/* (可选，但推荐) 鼠标悬停时显示下划线，以提示用户这是可点击的 */
.footer-link:hover {
    text-decoration: underline;
}
/* --- 新增功能的样式 --- */

/* 实时时钟 */
#real-time-clock {
    position: fixed;
    top: 20px;
    right: 20px;
    color: var(--text-color);
    font-size: 1rem;
    background-color: var(--card-bg-color);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* 管理员登录按钮 (index.html) */
.admin-login-button {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: var(--card-bg-color);
    color: var(--primary-color);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-decoration: none;
    font-weight: bold;
    z-index: 1002;
    transition: background-color 0.3s, color 0.3s;
}
.admin-login-button:hover {
    background-color: var(--primary-color);
    color: var(--bg-color);
}

/* 访问统计面板 (index.html) */
#visitor-stats {
    position: fixed;
    top: 75px; /* 在时钟下方 */
    right: 20px;
    background-color: var(--card-bg-color);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    z-index: 1001;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 0.9rem;
    color: var(--text-color);
    width: 150px; /* 给一个固定宽度，让其对齐 */
}
#visitor-stats div {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}
#visitor-stats div:last-child {
    margin-bottom: 0;
}
#visitor-stats span {
    color: var(--primary-color);
    font-weight: bold;
    margin-left: 10px;
}

/* --- 管理员页面的专属样式 (admin.html) --- */

/* 权限状态开关 */
.status-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}
.status-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #555;
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
}

/* 管理员操作按钮和容器 */
.table-controls, .module-controls, .page-controls {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap; /* 移动端换行 */
}
.admin-btn {
    background-color: var(--primary-color);
    color: #121212;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: opacity 0.3s;
    font-size: 0.9rem;
}
.admin-btn.danger {
    background-color: var(--danger-color);
    color: var(--text-color);
}
.admin-btn:hover {
    opacity: 0.8;
}

/* 可编辑单元格的视觉提示 */
td[contenteditable="true"], h2[contenteditable="true"] {
    background-color: rgba(3, 218, 198, 0.05);
    outline-color: var(--primary-color);
    border-radius: 4px;
    cursor: text;
}
td[contenteditable="true"]:focus, h2[contenteditable="true"]:focus {
    box-shadow: 0 0 5px var(--primary-color);
}


/* --- 移动端响应式设计 --- */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    #real-time-clock, #visitor-stats, .admin-login-button {
        position: relative;
        top: auto;
        right: auto;
        left: auto;
        text-align: center;
        margin: 0 auto 20px auto; /* 居中并添加底部间距 */
        width: calc(100% - 30px);
        box-sizing: border-box;
    }
    
    #visitor-stats {
        text-align: left; /* 统计面板内容保持左对齐 */
    }

    .header h1 {
        font-size: 2rem;
    }
    .program-card {
        padding: 20px;
    }

    /* 响应式表格核心逻辑 */
    .license-table {
        display: block;
        width: 100%;
    }
    .license-table thead {
        display: none; /* 在移动端隐藏表头 */
    }
    .license-table tbody, .license-table tr, .license-table td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }
    .license-table tr {
        margin-bottom: 15px;
        border: 1px solid var(--border-color);
        border-radius: 8px;
        overflow: hidden;
    }
    .license-table td {
        text-align: right; /* 数据内容靠右 */
        padding-left: 50%; /* 为左侧的标签留出空间 */
        position: relative;
        border-bottom: 1px solid var(--border-color);
    }
    .license-table td:last-child {
        border-bottom: none;
    }
    .license-table td::before {
        content: attr(data-label); /* 从td的data-label属性获取标签文本 */
        position: absolute;
        left: 15px;
        width: calc(50% - 30px);
        text-align: left; /* 标签文本靠左 */
        font-weight: bold;
        color: #c0c0c0;
    }
}