/* 通用样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', sans-serif;
}

body {
    background-color: #f5f5f7;
    color: #333;
    line-height: 1.6;
    position: relative; /* 为预览框定位提供参考 */
}

a {
    text-decoration: none;
    color: #165DFF;
}

.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #165DFF;
    box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.1);
}

.form-group small {
    display: block;
    margin-top: 4px;
    color: #888;
    font-size: 12px;
}

.alert {
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert.success {
    background-color: #f0f9eb;
    color: #00B42A;
    border: 1px solid #e1f3d8;
}

.alert.error {
    background-color: #fef3f2;
    color: #F53F3F;
    border: 1px solid #fee2e2;
}

.text-primary {
    color: #165DFF;
}

/* 登录页面样式 */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

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

.login-header h1 {
    margin-top: 10px;
    color: #333;
    font-size: 22px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-btn {
    width: 100%;
    background-color: #165DFF;
    color: #fff;
    font-weight: 500;
    padding: 12px;
}

.login-btn:hover {
    background-color: #0E4CD1;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 12px;
    color: #888;
}

/* 后台页面样式 */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background-color: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h1 {
    font-size: 18px;
    color: #333;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    color: #F53F3F;
    font-size: 14px;
}

.admin-main {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
}

.upload-section, .history-section {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.upload-section h2, .history-section h2 {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    color: #333;
}

.upload-btn {
    background-color: #165DFF;
    color: #fff;
}

.upload-btn:hover {
    background-color: #0E4CD1;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.history-table th, .history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.history-table th {
    background-color: #f9fafb;
    font-weight: 500;
    color: #666;
}

.history-table tr:hover {
    background-color: #f9fafb;
}

.empty-state {
    text-align: center;
    padding: 40px 0;
    color: #888;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.admin-footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 14px;
    border-top: 1px solid #eee;
    margin-top: 50px;
}

/* 导出按钮样式 */
.export-btn {
    background-color: #36CFC9;
    color: white;
    padding: 6px 12px;
    font-size: 13px;
}

.export-btn:hover {
    background-color: #2DB8B0;
}

.history-section .flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 删除按钮样式 */
.delete-btn {
    border: none;
    background: none;
    color: #F53F3F;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 5px;
}

.delete-btn:hover {
    color: #d32f2f;
    text-decoration: underline;
}

.delete-form {
    margin: 0;
    padding: 0;
    display: inline;
}

/* 图片预览功能样式（核心修复） */
.preview-trigger {
    color: #165DFF;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
    position: relative; /* 辅助预览框定位参考 */
}

.preview-trigger:hover {
    color: #0E4CD1;
}

/* 预览悬浮框（固定大小，避免过大） */
.file-preview {
    position: absolute;
    display: none;
    z-index: 1000;
    padding: 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    max-width: 200px; /* 固定最大宽度，避免预览框过大 */
    max-height: 200px; /* 固定最大高度 */
    width: auto;
    height: auto;
}

/* 预览图片（关键：等比例缩小，不拉伸） */
.preview-img {
    width: 100%;
    height: 100%;
    max-width: 184px; /* 预览框内边距8px，所以184=200-16 */
    max-height: 184px;
    object-fit: contain; /* 等比例显示，不拉伸，空白处留空 */
    border-radius: 4px;
}

/* 非图片格式提示 */
.preview-info {
    text-align: center;
    padding: 15px 10px;
    color: #666;
    width: 180px; /* 固定提示框宽度 */
}

.preview-info i {
    font-size: 24px;
    margin-bottom: 8px;
    color: #ccc;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .history-table {
        font-size: 12px;
    }
    
    .history-table th, .history-table td {
        padding: 8px 10px;
    }
    
    .admin-header {
        padding: 15px 20px;
    }
    
    /* 响应式预览框：缩小最大尺寸 */
    .file-preview {
        max-width: 150px;
        max-height: 150px;
    }
    
    .preview-img {
        max-width: 134px;
        max-height: 134px;
    }
}