/* css/style.css */

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

body {
    font-family: "Microsoft YaHei", sans-serif;
    background: #f4f6f8; /* 浅灰背景 */
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative; /* 为了底部栏定位 */
    padding-bottom: 80px; /* 给底部栏留空间 */
}

/* 头部 */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

h1 {
    color: #2c3e50; /* 深蓝灰 */
}

.auth-area {
    display: flex;
    gap: 10px;
    align-items: center;
}

.hidden {
    display: none !important;
}

/* 按钮通用样式 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: opacity 0.2s;
}

.btn:hover {
    opacity: 0.85;
}

.btn-primary {
    background: #3498db; /* 亮蓝 */
    color: white;
}

.btn-danger {
    background: #e74c3c; /* 红色 */
    color: white;
}

.btn-success {
    background: #2ecc71; /* 绿色 */
    color: white;
}

.btn-secondary {
    background: #95a5a6; /* 灰色 */
    color: white;
}

/* 下载区域 */
.download-section {
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.hint {
    color: #888;
    font-size: 0.9em;
}

/* 卡片与表格 */
.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 14px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa; /* 表头浅灰 */
    font-weight: 600;
}

tr:hover {
    background: #fcfcfc;
}

/* 标签 */
.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.badge-free {
    background: #e1f5fe;
    color: #0288d1;
}

.badge-paid {
    background: #ffebee;
    color: #c62828;
}

/* 加载状态 */
.loading {
    text-align: center;
    padding: 50px;
    color: #888;
}

/* 分页 */
.pagination {
    text-align: center;
    padding: 20px;
}

.pagination button {
    padding: 8px 16px;
    margin: 0 5px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover {
    background: #f0f0f0;
}

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

/* 底部管理栏 */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #2c3e50; /* 深色背景 */
    color: white;
    padding: 15px;
    display: flex;
    justify-content: center;
    gap: 20px;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 1000;
}

.bottom-bar.show {
    transform: translateY(0);
}

.bottom-bar .btn {
    background: #34495e; /* 稍浅的深色 */
    color: white;
    border: none;
}

.bottom-bar .btn:hover {
    background: #46627f;
}

/* 密钥管理表格 */
#keyListContainer table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
#keyListContainer th, #keyListContainer td {
    border: 1px solid #eee;
    padding: 8px;
    text-align: left;
}
#keyListContainer th {
    background: #f8f9fa;
}
.form-control {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

/* 详情弹窗修复 */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6); /* 半透明黑色遮罩 */
    z-index: 9998;
    justify-content: center;
    align-items: center;
}
.modal-overlay.show { display: flex; }

.detail-popup {
    background: #ffffff; /* 强制白色背景，绝对不能透明 */
    width: 600px;
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3); /* 加深阴影，凸显层次 */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* 防止内容溢出破坏圆角 */
    z-index: 9999; /* 确保在遮罩之上 */
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa; /* 头部浅灰背景 */
}

.popup-close {
    font-size: 28px;
    cursor: pointer;
    color: #888;
    transition: color 0.2s;
}
.popup-close:hover { color: #333; }

.popup-body {
    padding: 25px;
    overflow-y: auto; /* 内容多了可以滚动 */
    font-size: 14px;
    line-height: 1.6;
    color: #333; /* 确保文字是深色的 */
}

/* 弹窗内部的图片样式 */
.popup-body img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 1px solid #eee;
}

.popup-body h4 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #2c3e50;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

/* 1. 外层容器：确保全屏覆盖且层级最高 */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6); /* 半透明黑色背景 */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* 确保在最上层 */
    padding: 20px;
    box-sizing: border-box;
}

/* 2. 弹窗卡片：必须是白色背景 + 阴影 */
.detail-popup {
    background: #ffffff; /* 关键：强制白色背景 */
    width: 100%;
    max-width: 600px; /* 最大宽度 */
    border-radius: 12px; /* 圆角 */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); /* 明显的阴影 */
    overflow: hidden; /* 防止内容溢出 */
    animation: fadeInScale 0.2s ease;
    max-height: 90vh; /* 最大高度，防止超出屏幕 */
    display: flex; /* 启用 Flex 布局 */
    flex-direction: column; /* 垂直排列 */
}

/* 3. 头部标题栏 */
.detail-header {
    background: #f8f9fa; /* 浅灰色头部 */
    padding: 15px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.detail-title {
    font-size: 18px;
    font-weight: bold;
    color: #333; /* 深色文字 */
    margin: 0;
}

.popup-close {
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.2s;
}
.popup-close:hover { color: #333; }

/* 4. 内容区域：可滚动 + 深色文字 */
.detail-body {
    padding: 25px;
    overflow-y: auto; /* 内容多了在这里滚动，不影响头部 */
    font-size: 15px;
    line-height: 1.8;
    color: #333; /* 关键：深色文字，确保清晰可读 */
    background: #fff; /* 再次确认白底 */
    flex-grow: 1; /* 占据剩余空间 */
}

/* 图片样式 */
.detail-body img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #eee;
    display: block; /* 消除图片下方的空白间隙 */
}

/* 简单的内容排版优化 */
.detail-body h4 {
    margin-top: 20px;
    margin-bottom: 10px;
    color: #2c3e50;
    border-left: 4px solid #007bff;
    padding-left: 10px;
}

/* 入场动画 */
@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}