/* 全局变量设定 - 打造高级灰+蓝调 */
:root { 
    --primary: #2563eb; 
    --primary-light: #dbeafe;
    --bg: #f0f2f5; 
    --card-bg: #ffffff; 
    --text: #1f2937; 
    --text-muted: #6b7280;
    --radius: 16px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { 
    background: var(--bg); 
    min-height: 100vh; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    color: var(--text); 
    -webkit-font-smoothing: antialiased;
}

/* --- 认证页 (登录/注册) --- */
.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: 100vh; background: linear-gradient(135deg, #e0e7ff 0%, #f0f2f5 100%); }
.auth-card { background: var(--card-bg); padding: 48px 40px; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 420px; border: 1px solid rgba(255,255,255,0.5); }
.auth-card h2 { text-align: center; margin-bottom: 32px; font-weight: 700; letter-spacing: -0.5px; }
.input-group { display: flex; align-items: center; margin-bottom: 16px; }
.input-group label { width: 60px; flex-shrink: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.input-group input, .input-group select { 
    flex: 1; padding: 10px 14px; border: 1px solid #e5e7eb; border-radius: 8px; outline: none; background: #f9fafb;
    transition: var(--transition); font-size: 15px;
}
.input-group input:focus, .input-group select:focus { border-color: var(--primary); background: #ffffff; box-shadow: 0 0 0 4px var(--primary-light); }
.btn-primary { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 10px; font-weight: 600; font-size: 16px; cursor: pointer; transition: var(--transition); }
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.small { width: auto; padding: 6px 16px; font-size: 14px;}
.btn-outline { border: 1px solid #e5e7eb; background: white; padding: 6px 16px; border-radius: 10px; cursor: pointer; transition: var(--transition); font-size: 14px; color: var(--text); }
.btn-outline:hover { background: #f9fafb; border-color: #d1d5db; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-muted); }
.auth-footer a { color: var(--primary); text-decoration: none; font-weight: 500; transition: var(--transition); }
.auth-footer a:hover { text-decoration: underline; }

/* --- 主页导航栏 --- */
.navbar { 
    background: rgba(255, 255, 255, 0.8); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    padding: 12px 32px; border-bottom: 1px solid rgba(229, 231, 235, 0.5); 
    display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; 
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.nav-left h2 { font-size: 20px; font-weight: 700; color: #111827; }
.badge { background: var(--primary-light); color: var(--primary); padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; }
.nav-right { display: flex; gap: 12px; align-items: center; }

/* --- 管理员模块化 TAB 面板 (全新优化) --- */
#adminTabs { display: flex; flex-wrap: wrap; background: #f8fafc; padding: 0 32px; border-bottom: 1px solid #e5e7eb; }
.tab-btn { padding: 12px 20px; border: none; background: transparent; cursor: pointer; font-size: 14px; font-weight: 500; color: #6b7280; border-bottom: 2px solid transparent; transition: all 0.2s; }
.tab-btn:hover { color: #1f2937; }
.tab-btn.active { color: #2563eb; border-bottom: 2px solid #2563eb; }

/* 模块内容区通用 */
.tab-content { display: none; padding: 24px 32px; }
.tab-content.active { display: block; }

/* 消灭白条与布局修正：操作条 */
.admin-panel-header { 
    background: #ffffff; border-radius: 12px; padding: 16px 25px; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); margin-bottom: 20px; 
    display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; /* 解决换行问题 */
    width: fit-content; /* 解决长白条问题 */
    border: 1px solid #f3f4f6;
}

/* 消灭白条与布局修正：下方数据区域 (表格/网格) */
#adminFamilyList, #adminUserList, #adminCodeList, #adminPhotoList {
    background: #ffffff; border-radius: 12px; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06); border: 1px solid #f3f4f6;
}

/* 操作条内部文字和输入框 */
.admin-panel-header .input-group { margin: 0; display: flex; align-items: center; gap: 8px; }
.admin-panel-header label { margin: 0; font-size: 14px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.admin-panel-header input { padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 8px; font-size: 14px; width: 200px; outline: none; transition: all 0.2s; background: #f9fafb; }
.admin-panel-header input:focus { border-color: var(--primary); background: #ffffff; box-shadow: 0 0 0 3px var(--primary-light); }
.admin-panel-header .btn-primary.small { width: auto; padding: 8px 16px; font-size: 14px; height: auto; line-height: normal; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; }

/* 内部数据表格样式 */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th { background: #f8fafc; text-align: left; padding: 16px; font-weight: 600; font-size: 14px; border-bottom: 2px solid #e5e7eb; }
.admin-table td { padding: 14px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; color: var(--text); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .btn-danger { background: #ef4444; color: white; border: none; padding: 4px 12px; border-radius: 6px; cursor: pointer; }
.admin-table .btn-danger:hover { background: #dc2626; }

/* --- 注册码显示 --- */
#codeDisplay { margin-left: 12px; font-weight: bold; color: var(--primary); }
#codeDisplay:empty::before { content: "点击左侧按钮生成新注册码"; color: #9ca3af; font-weight: normal; }


/* --- 照片网格 --- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; padding: 32px; max-width: 1440px; margin: 0 auto; }
.photo-card { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: var(--transition); cursor: pointer; border: 1px solid rgba(255,255,255,0.8); }
.photo-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.photo-card img { width: 100%; height: 240px; object-fit: cover; display: block; transition: var(--transition); }
.photo-card:hover img { transform: scale(1.02); }
.photo-info { padding: 16px 20px; display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--text-muted); }
.badge-printed { background: #d1fae5; color: #065f46; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-keep { background: #fef3c7; color: #92400e; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }


/* --- 大图 Modal (查看器) --- */
.modal { display: none; position: fixed; z-index: 2000; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(17, 24, 39, 0.9); backdrop-filter: blur(8px); overflow: auto; }
.modal-content { margin: 5% auto; display: block; max-width: 85%; max-height: 75vh; border-radius: var(--radius); box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5); }
.close { position: absolute; top: 40px; right: 50px; color: #f1f1f1; font-size: 40px; font-weight: 300; cursor: pointer; transition: var(--transition); }
.close:hover { transform: rotate(90deg); color: #ffffff; }
.modal-actions { text-align: center; margin-top: 30px; display: flex; justify-content: center; gap: 16px; }
.modal-actions button { background: white; color: #111827; border: none; padding: 10px 24px; border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 600; transition: var(--transition); }
.modal-actions button:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }


/* --- 响应式调整 --- */
@media (max-width: 600px) {
    .photo-grid { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
    .navbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px;}
    .nav-right { justify-content: space-between; }
    .auth-card { padding: 32px 24px; margin: 16px; }
}