/* ========================================
   检验科人员档案管理系统 - 3D国风浮雕样式
   主色：黛青绿 #225A50
   ======================================== */

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

body {
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    font-size: 14px;
    color: #262626;
    background: #F5F1EB;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(34,90,80,0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(34,90,80,0.03) 0%, transparent 50%);
    min-height: 100vh;
}

/* ---------- 登录页 ---------- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #F5F1EB 0%, #E8E2D6 100%);
}

.login-container { width: 100%; max-width: 420px; padding: 20px; }

.login-box {
    background: #FFFFFF;
    padding: 40px 35px;
    border-radius: 12px;
}

.login-header { text-align: center; margin-bottom: 30px; }
.login-icon { font-size: 48px; margin-bottom: 10px; }
.login-header h1 { font-size: 22px; color: #225A50; margin-bottom: 5px; }
.login-header p { color: #666; font-size: 14px; }

.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; margin-bottom: 6px; color: #555; font-weight: 500; }
.login-form input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #D6CDC0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color .2s;
}
.login-form input:focus { outline: none; border-color: #225A50; }

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

/* ---------- 布局 ---------- */
.layout { display: flex; flex-direction: column; min-height: 100vh; }

.top-header {
    height: 60px;
    background: linear-gradient(90deg, #225A50 0%, #2D6B60 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: relative;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 12px; }
.header-icon { font-size: 24px; }
.header-title { font-size: 18px; font-weight: 600; letter-spacing: 1px; }

.header-right { display: flex; align-items: center; gap: 15px; }
.user-info { font-size: 13px; }
.user-role { 
    background: rgba(255,255,255,0.2); 
    padding: 2px 8px; 
    border-radius: 10px; 
    margin-right: 5px;
    font-size: 12px;
}
.btn-logout {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
}
.btn-logout:hover { background: rgba(255,255,255,0.25); }

.main-wrapper { display: flex; flex: 1; }

/* ---------- 侧边栏 ---------- */
.sidebar {
    width: 220px;
    background: #FFFFFF;
    border-right: 1px solid #D6CDC0;
    box-shadow: 2px 0 8px rgba(0,0,0,0.05);
    position: relative;
    overflow-y: auto;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 0 L60 30 L30 60 L0 30 Z' fill='none' stroke='%23225A50' stroke-width='0.5' opacity='0.05'/%3E%3C/svg%3E");
    pointer-events: none;
}

.nav-menu { padding: 15px 0; position: relative; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    color: #555;
    text-decoration: none;
    transition: all .2s;
    border-left: 3px solid transparent;
    position: relative;
}

.nav-item:hover {
    background: #F5F1EB;
    color: #225A50;
    transform: translateX(2px);
}

.nav-item.active {
    background: #E4ECE9;
    color: #225A50;
    border-left-color: #225A50;
    font-weight: 600;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-divider { height: 1px; background: #D6CDC0; margin: 10px 15px; }

/* ---------- 主内容 ---------- */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.page-header { margin-bottom: 20px; }
.page-header h2 { color: #225A50; font-size: 20px; margin-bottom: 5px; }
.page-header p { color: #666; font-size: 13px; }

/* ---------- 浮雕卡片 ---------- */
.relief-card {
    background: #FFFFFF;
    border-radius: 10px;
    box-shadow: 
        0 1px 3px rgba(0,0,0,0.08),
        0 4px 12px rgba(0,0,0,0.05),
        inset 0 1px 0 rgba(255,255,255,0.9);
    border: 1px solid #E8E2D6;
    position: relative;
}

.section-card { margin-bottom: 20px; }

.card-header {
    padding: 15px 20px;
    border-bottom: 1px solid #E8E2D6;
    background: linear-gradient(180deg, #FAF8F4 0%, #FFFFFF 100%);
    border-radius: 10px 10px 0 0;
}
.card-header h3 { font-size: 16px; color: #225A50; }

/* ---------- 工具栏 ---------- */
.toolbar {
    padding: 12px 15px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-left, .toolbar-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- 按钮 ---------- */
.btn {
    padding: 7px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
    display: inline-block;
    transition: all .2s;
    font-family: inherit;
}

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; display: block; }

.btn-primary { background: #225A50; color: #fff; }
.btn-primary:hover { background: #2D6B60; }

.btn-success { background: #699685; color: #fff; }
.btn-success:hover { background: #7AA896; }

.btn-danger { background: #9D3A3A; color: #fff; }
.btn-danger:hover { background: #B04848; }

.btn-warning { background: #C4873A; color: #fff; }

.btn-default { background: #F0EBE2; color: #555; border: 1px solid #D6CDC0; }
.btn-default:hover { background: #E8E2D6; }

/* 浮雕按钮效果 */
.btn-relief {
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.3);
    transform: translateY(0);
}
.btn-relief:hover {
    transform: translateY(-1px);
    box-shadow: 
        0 4px 8px rgba(0,0,0,0.18),
        inset 0 1px 0 rgba(255,255,255,0.3);
}
.btn-relief:active {
    transform: translateY(1px);
    box-shadow: 
        0 1px 2px rgba(0,0,0,0.15),
        inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn-relief-depressed {
    box-shadow: 
        inset 0 2px 4px rgba(0,0,0,0.2),
        0 1px 0 rgba(255,255,255,0.2);
}

/* ---------- 表单 ---------- */
.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 6px; color: #555; font-size: 13px; }

.form-control, input[type="text"], input[type="password"], input[type="date"], 
input[type="file"], select, textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #D6CDC0;
    border-radius: 5px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    transition: border-color .2s;
}
.form-control:focus, input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #225A50;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}
.form-full { grid-column: 1 / -1; }

textarea { resize: vertical; min-height: 60px; }

/* ---------- 表格 ---------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    background: #F5F1EB;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #225A50;
    border-bottom: 2px solid #D6CDC0;
}

.data-table td {
    padding: 9px 12px;
    border-bottom: 1px solid #E8E2D6;
}

.data-table tbody tr:hover { background: #F8F6F1; }
.data-table tbody tr:nth-child(even) { background: #FCFAF7; }

.thumb-photo { width: 36px; height: 45px; object-fit: cover; border-radius: 3px; }

/* ---------- 弹窗 ---------- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    /* 关键修复：用flex居中，JS直接切换flex/none */
    align-items: center;
    justify-content: center;
}

/* 弹窗打开状态 */
.modal.show {
    display: flex;
}


.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn .2s ease-out;
}

@keyframes modalIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #E8E2D6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, #FAF8F4 0%, #FFFFFF 100%);
    border-radius: 10px 10px 0 0;
}
.modal-header h3 { color: #225A50; font-size: 16px; }

.close {
    font-size: 22px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}
.close:hover { color: #555; }

.modal form { padding: 20px; }

.modal-footer {
    padding-top: 15px;
    border-top: 1px solid #E8E2D6;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* ---------- 统计卡片 ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
}

.stat-num { font-size: 24px; font-weight: 700; color: #225A50; }
.stat-label { color: #666; font-size: 13px; margin-top: 3px; }

/* ---------- 快捷操作 ---------- */
.quick-actions {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.quick-btn {
    padding: 15px;
    text-align: center;
    background: #F8F6F1;
    border: 1px solid #E8E2D6;
    border-radius: 8px;
    color: #333;
    text-decoration: none;
    transition: all .2s;
}
.quick-btn:hover {
    background: #E4ECE9;
    border-color: #225A50;
    color: #225A50;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(34,90,80,0.15);
}

/* ---------- 证件管理 ---------- */
.doc-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
}

.doc-tab {
    padding: 8px 18px;
    background: #FFFFFF;
    border: 1px solid #D6CDC0;
    border-radius: 6px 6px 0 0;
    text-decoration: none;
    color: #666;
    font-size: 13px;
}
.doc-tab.active {
    background: #225A50;
    color: #fff;
    border-color: #225A50;
}

.doc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    padding: 20px;
}

.doc-item {
    border: 1px solid #E8E2D6;
    border-radius: 8px;
    overflow: hidden;
    transition: all .2s;
}
.doc-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.doc-preview {
    height: 140px;
    background: #F8F6F1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.doc-preview img { max-width: 100%; max-height: 100%; cursor: pointer; }
.doc-icon { font-size: 48px; }

.doc-info { padding: 10px; }
.doc-name { font-size: 13px; font-weight: 500; margin-bottom: 3px; }
.doc-time { font-size: 11px; color: #999; }

.doc-actions { padding: 8px 10px; border-top: 1px solid #E8E2D6; display: flex; gap: 5px; }

.empty-tip {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px;
    color: #999;
}

/* 图片预览 */
.preview-content {
    max-width: 90%;
    max-height: 90%;
}
.preview-content img { max-width: 100%; max-height: 90vh; }

/* ---------- 导出面板 ---------- */
.export-panel { padding: 25px; }
.export-info { margin-bottom: 25px; }
.export-info h3 { color: #225A50; margin-bottom: 10px; }
.export-info ul { padding-left: 20px; color: #666; line-height: 1.8; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}
.badge.admin { background: #9D3A3A; color: #fff; }
.badge.user { background: #699685; color: #fff; }
.badge.on { background: #699685; color: #fff; }
.badge.off { background: #999; color: #fff; }

/* ---------- 危险区域 ---------- */
.danger-zone { padding: 20px; }
.danger-item { 
    padding: 15px; 
    border: 1px solid #E8E2D6; 
    border-radius: 8px; 
    margin-bottom: 15px;
    background: #FDFAFA;
}
.danger-item h4 { color: #9D3A3A; margin-bottom: 8px; }
.danger-item p { color: #666; margin-bottom: 10px; font-size: 13px; }

/* ---------- 提示 ---------- */
.alert {
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 13px;
}
.alert-error { background: #FDECEC; color: #9D3A3A; border: 1px solid #F5CACA; }

/* ---------- 响应式 ---------- */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .nav-item span:not(.nav-icon) { display: none; }
    .stats-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .form-grid { grid-template-columns: 1fr; }
}
/* ========== 证件网格+悬停预览 优化版 ========== */
.doc-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    padding: 24px;
}
.doc-item {
    text-align: center;
    width: 108px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}
.doc-item:hover {
    transform: translateY(-4px);
}
.doc-name {
    font-size: 13px;
    color: var(--ink);
    margin-top: 10px;
    word-break: break-all;
    font-weight: 500;
}
.cert-thumb {
    position: relative;
    display: inline-block;
    width: 88px;
    height: 88px;
    padding: 4px;
    background: #fff;
    border: 1px solid var(--paper-deep);
    border-radius: 6px;
    box-shadow: 
        inset 0 1px 2px rgba(0,0,0,0.06),
        var(--shadow-1);
    transition: all 0.25s ease;
}
.doc-item:hover .cert-thumb {
    box-shadow: 
        inset 0 1px 2px rgba(0,0,0,0.06),
        var(--shadow-2);
    border-color: var(--gold-light);
}
.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 3px;
    background: var(--paper-dark);
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}
@keyframes fadeIn {
    to { opacity: 1; }
}

/* ========== 档案卡片 移除溢出隐藏（关键修复） ========== */
.archive-section {
    margin-bottom: 20px;
    background: linear-gradient(180deg, #fffdfa 0%, #faf6ed 100%);
    border: 1px solid var(--paper-deep);
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    overflow: visible; /* 由hidden改为visible，预览框不再被裁剪 */
    transition: box-shadow 0.3s ease;
}

/* ========== 证件缩略图容器 国风装裱款 ========== */
.cert-thumb {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 90px;
    height: 90px;
    padding: 8px;
    background: #ffffff;
    border: 1px solid var(--paper-deep);
    border-radius: 8px;
    box-shadow: 
        inset 0 1px 3px rgba(0,0,0,0.05),
        var(--shadow-1);
    cursor: zoom-in;
    transition: all 0.25s ease;
    overflow: visible; /* 关键：子元素预览框不被裁剪 */
}

/* 悬停容器高亮效果 */
.doc-item:hover .cert-thumb {
    border-color: var(--gold-light);
    box-shadow: 
        inset 0 1px 3px rgba(0,0,0,0.05),
        var(--shadow-2);
    transform: translateY(-2px);
}

/* ========== 缩略图本身 适配显示 ========== */
.thumb-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain; /* 完整显示图片，不变形不裁切 */
    border-radius: 4px;
    background: var(--paper-dark); /* 图片透明时的衬底 */
}

/* ========== 悬停预览框 国风悬浮款 ========== */
.cert-preview {
    display: none;
    position: absolute;
    bottom: calc(100% + 16px);
    z-index: 999; /* 最高层级，确保不被任何卡片遮挡 */
    padding: 10px;
    background: #ffffff;
    border: 1px solid var(--paper-deep);
    border-radius: 8px;
    box-shadow: 
        0 0 0 1px rgba(184,134,11,0.3),
        var(--shadow-3);
    min-width: 360px;
    text-align: center;
    pointer-events: none; /* 避免预览框干扰鼠标 */
}

/* 鼠标移入缩略图 显示预览 */
.cert-thumb:hover .cert-preview {
    display: block;
}

/* 预览标题栏 */
.preview-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--paper-dark);
    font-family: "Noto Serif SC", serif;
}

/* 预览原图 500px 清晰尺寸 */
.cert-preview img {
    max-width: 160px;
    max-height: 160px;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 4px;
}

/* 非图片文件占位 */
.cert-thumb .file-icon {
    font-size: 48px;
    color: var(--ink-light);
}

