/* ============================================================
   石家庄城市宣讲官管理系统 - 统一样式
   配色：中国红 #C41E3A + 金色 #D4AF37
   ============================================================ */

/* --- 基础重置 --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, "Microsoft YaHei", "PingFang SC", "Helvetica Neue", sans-serif;
  color: #333;
  background: #f5f0eb;
  line-height: 1.6;
}

a { color: #C41E3A; text-decoration: none; }
img { max-width: 100%; }

/* --- 按钮 --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
}
.btn:hover { opacity: .85; transform: translateY(-1px); }
.btn-primary { background: #C41E3A; color: #fff; }
.btn-gold { background: #D4AF37; color: #fff; }
.btn-outline { background: #fff; color: #C41E3A; border: 1px solid #C41E3A; }
.btn-danger { background: #fff; color: #d9534f; border: 1px solid #d9534f; }
.btn-danger:hover { background: #d9534f; color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

.required { color: #C41E3A; }
.text-muted { color: #999; font-size: 14px; }

/* =========================================
   登录页
   ========================================= */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #C41E3A 0%, #8B0000 50%, #5a0018 100%);
  position: relative;
  overflow: hidden;
}
.login-body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(circle at 20% 50%, rgba(212,175,55,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.05) 0%, transparent 40%);
  pointer-events: none;
}
.login-container {
  background: rgba(255,255,255,0.95);
  border-radius: 16px;
  padding: 48px 40px;
  width: 420px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  position: relative;
  border: 1px solid rgba(212,175,55,0.3);
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.login-header h1 {
  font-size: 24px;
  color: #C41E3A;
  margin-bottom: 4px;
}
.login-subtitle {
  font-size: 14px;
  color: #888;
}
.login-form .form-group {
  margin-bottom: 20px;
}
.login-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #555;
  font-weight: 500;
}
.login-form input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 15px;
  transition: border-color .2s;
  font-family: inherit;
}
.login-form input:focus {
  outline: none;
  border-color: #C41E3A;
  box-shadow: 0 0 0 3px rgba(196,30,58,0.1);
}
.error-msg {
  color: #d9534f;
  font-size: 13px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: #fff5f5;
  border-radius: 6px;
  border: 1px solid #ffe0e0;
}
.login-form .btn {
  margin-top: 8px;
  padding: 12px;
  font-size: 16px;
  letter-spacing: 4px;
}
.login-footer {
  text-align: center;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}
.login-footer p {
  font-size: 12px;
  color: #aaa;
}
.login-footer a {
  color: #aaa;
  text-decoration: none;
}
.login-footer a:hover {
  text-decoration: underline;
}

/* =========================================
   导航栏
   ========================================= */
.navbar {
  background: linear-gradient(90deg, #C41E3A, #9B1B30);
  color: #fff;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.navbar-icon {
  font-size: 28px;
}
.navbar-brand h1 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}
.navbar-user {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
}
.navbar-user .btn-outline {
  color: #fff;
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.15);
  padding: 5px 14px;
  font-size: 13px;
}
.navbar-user .btn-outline:hover {
  background: rgba(255,255,255,0.15);
}

/* =========================================
   主容器
   ========================================= */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* --- 搜索栏 --- */
.search-bar {
  background: #fff;
  border-radius: 12px;
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid rgba(212,175,55,0.2);
}
.search-fields {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}
.search-input {
  padding: 9px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  width: 160px;
  font-family: inherit;
}
.search-input-sm { width: 100px; }
.search-input:focus {
  outline: none;
  border-color: #C41E3A;
  box-shadow: 0 0 0 2px rgba(196,30,58,0.1);
}
.search-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* --- 人员卡片网格 --- */
.personnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.person-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: all .3s;
  border: 1px solid rgba(212,175,55,0.15);
}
.person-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(196,30,58,0.12);
  border-color: rgba(212,175,55,0.4);
}

.person-photo-wrap {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: linear-gradient(135deg, #fff5f5, #ffecd2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.person-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.person-photo-placeholder {
  font-size: 64px;
  opacity: .3;
}
.photo-count {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}
.person-photo-wrap {
  position: relative;
}

.person-info {
  padding: 16px;
}
.person-name {
  font-size: 18px;
  color: #C41E3A;
  margin-bottom: 4px;
}
.person-age {
  font-size: 13px;
  color: #888;
  margin-bottom: 4px;
}
.person-expertise {
  font-size: 13px;
  color: #666;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.person-actions {
  padding: 0 16px 16px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* --- 空状态 --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}
.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: .5;
}

/* =========================================
   弹窗
   ========================================= */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
}
.modal-content {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: 560px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-sm { width: 360px; }
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 {
  font-size: 18px;
  color: #C41E3A;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
  padding: 0 4px;
}
.modal-close:hover { color: #C41E3A; }
.modal-body {
  padding: 24px;
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* --- 表单 --- */
.modal-body .form-group {
  margin-bottom: 18px;
}
.modal-body label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: #555;
  font-weight: 500;
}
.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s;
}
.modal-body input:focus,
.modal-body textarea:focus {
  outline: none;
  border-color: #C41E3A;
  box-shadow: 0 0 0 3px rgba(196,30,58,0.1);
}
.modal-body textarea {
  resize: vertical;
}
.input-readonly {
  background: #f5f5f5;
  color: #888;
  cursor: not-allowed;
}

/* --- 图片上传 --- */
.photo-upload {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.photo-preview {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid #eee;
}
.photo-upload input[type="file"] {
  font-size: 13px;
}
.photo-hint {
  font-size: 12px;
  color: #999;
  margin: 0;
}
.form-hint {
  font-size: 12px;
  color: #999;
  margin: 4px 0 0;
}

/* --- 二维码弹窗 --- */
.qrcode-body {
  text-align: center;
}
.qrcode-name {
  font-size: 20px;
  font-weight: 600;
  color: #C41E3A;
  margin-bottom: 20px;
}
#qrcodeCanvas {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border: 2px solid #D4AF37;
  border-radius: 12px;
  margin-bottom: 12px;
}
.qrcode-hint {
  font-size: 13px;
  color: #999;
  margin-bottom: 16px;
}

/* --- 详情弹窗 --- */
.modal-lg { width: 680px; }
.detail-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.detail-photo-wrap {
  flex-shrink: 0;
}
.detail-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid #D4AF37;
}
.detail-photo-placeholder {
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  opacity: .3;
  background: #f9f9f9;
  border-radius: 12px;
}
.detail-info h2 {
  color: #C41E3A;
  margin-bottom: 12px;
  font-size: 22px;
}
.detail-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.detail-meta-item {
  display: inline-block;
  padding: 3px 12px;
  background: #fff5f5;
  color: #C41E3A;
  border-radius: 16px;
  font-size: 13px;
  border: 1px solid rgba(196,30,58,0.12);
}
.detail-meta-date {
  margin-left: auto;
  background: #fef9f0;
  color: #999;
  border-color: rgba(212,175,55,0.2);
  font-size: 12px;
}
.detail-sections {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.detail-section {
  padding: 14px 16px;
  background: #fef9f0;
  border-radius: 10px;
  border-left: 3px solid #D4AF37;
}
.detail-section-title {
  font-size: 14px;
  color: #D4AF37;
  margin-bottom: 8px;
  font-weight: 600;
}
.detail-section-body {
  font-size: 14px;
  line-height: 1.8;
  color: #555;
  max-height: 200px;
  overflow-y: auto;
}

/* =========================================
   公开资料页（profile）
   ========================================= */
.profile-body {
  min-height: 100vh;
  background: linear-gradient(180deg, #C41E3A 0%, #9B1B30 200px, #f5f0eb 200px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.profile-container {
  width: 100%;
  max-width: 480px;
  padding: 0 16px;
}
.profile-header-bar {
  text-align: center;
  padding: 20px 0;
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.profile-header-icon {
  font-size: 24px;
}
.profile-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  padding: 0;
  margin-bottom: 20px;
}
.profile-loading {
  text-align: center;
  padding: 60px 20px;
  color: #999;
}
.profile-photo-wrap {
  width: 100%;
  height: 280px;
  overflow: hidden;
  background: linear-gradient(135deg, #fff5f5, #ffecd2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.profile-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.profile-photo-placeholder {
  font-size: 80px;
  opacity: .3;
}
.profile-name {
  text-align: center;
  font-size: 26px;
  color: #C41E3A;
  padding: 20px 20px 8px;
}
.profile-tags {
  text-align: center;
  padding: 0 20px 16px;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-tag {
  display: inline-block;
  padding: 4px 14px;
  background: #fff5f5;
  color: #C41E3A;
  border-radius: 20px;
  font-size: 14px;
  border: 1px solid rgba(196,30,58,0.15);
}
.profile-section {
  padding: 0 20px 16px;
}
.profile-section h3 {
  font-size: 15px;
  color: #D4AF37;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f0e6d2;
}
.profile-experience {
  font-size: 14px;
  line-height: 1.8;
  color: #555;
  max-height: 300px;
  overflow-y: auto;
  padding: 8px 12px;
  background: #fef9f0;
  border-radius: 8px;
}
.profile-badge {
  text-align: center;
  padding: 16px 20px;
  background: linear-gradient(90deg, #fef9f0, #fff5f5, #fef9f0);
  border-top: 1px solid #f0e6d2;
  color: #D4AF37;
  font-size: 14px;
  font-weight: 500;
}
.profile-error {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  background: #fff;
  border-radius: 16px;
}
.profile-footer {
  text-align: center;
  padding: 16px 0 32px;
}
.profile-footer p {
  font-size: 12px;
  color: #aaa;
}

/* --- 多图上传预览 --- */
.photo-preview-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.photo-preview-item {
  position: relative;
  width: 90px;
  height: 90px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #eee;
}
.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
  padding: 0;
}
.photo-remove-btn:hover { background: #C41E3A; }
.photo-preview-new { border-color: #D4AF37; }
.photo-uploading {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(212,175,55,0.8);
  color: #fff;
  font-size: 10px;
  text-align: center;
  padding: 1px 0;
}

/* --- 详情弹窗多图布局 --- */
.detail-photos {
  display: grid;
  gap: 4px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}
.detail-photos-item {
  background: #f5f0eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.detail-photos-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
/* 1张：全宽自适应 */
.detail-photos.photos-1 {
  grid-template-columns: 1fr;
}
.detail-photos.photos-1 .detail-photos-item {
  max-height: 400px;
}
/* 2张：并排 */
.detail-photos.photos-2 {
  grid-template-columns: 1fr 1fr;
}
.detail-photos.photos-2 .detail-photos-item {
  aspect-ratio: 3 / 4;
  max-height: 300px;
}
/* 3张：左大右二 */
.detail-photos.photos-3 {
  grid-template-columns: 3fr 2fr;
  grid-template-rows: 1fr 1fr;
}
.detail-photos.photos-3 .detail-photos-item:first-child {
  grid-row: 1 / 3;
}
.detail-photos.photos-3 .detail-photos-item {
  aspect-ratio: 1 / 1;
}
/* 4张：2x2网格 */
.detail-photos.photos-4 {
  grid-template-columns: 1fr 1fr;
}
.detail-photos.photos-4 .detail-photos-item {
  aspect-ratio: 4 / 3;
  max-height: 220px;
}

.detail-info-block {
  padding: 0 0 4px;
}
.detail-info-block h2 {
  color: #C41E3A;
  margin-bottom: 10px;
  font-size: 22px;
}

/* --- profile 页多图布局 --- */
.profile-photos {
  display: grid;
  gap: 3px;
  overflow: hidden;
}
.profile-photos-item {
  background: #f5f0eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.profile-photos-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.profile-photos.photos-1 { grid-template-columns: 1fr; }
.profile-photos.photos-1 .profile-photos-item { max-height: 420px; }
.profile-photos.photos-2 { grid-template-columns: 1fr 1fr; }
.profile-photos.photos-2 .profile-photos-item { aspect-ratio: 3 / 4; max-height: 280px; }
.profile-photos.photos-3 {
  grid-template-columns: 3fr 2fr;
  grid-template-rows: 1fr 1fr;
}
.profile-photos.photos-3 .profile-photos-item:first-child {
  grid-row: 1 / 3;
}
.profile-photos.photos-3 .profile-photos-item { aspect-ratio: 1 / 1; }
.profile-photos.photos-4 { grid-template-columns: 1fr 1fr; }
.profile-photos.photos-4 .profile-photos-item { aspect-ratio: 4 / 3; max-height: 200px; }

/* =========================================
   响应式
   ========================================= */
@media (max-width: 768px) {
  .search-bar { flex-direction: column; }
  .search-fields { width: 100%; }
  .search-input { width: 100%; }
  .search-actions { width: 100%; }
  .search-actions .btn { flex: 1; }
  .personnel-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .detail-layout { flex-direction: column; align-items: center; text-align: center; }
  .detail-sections { text-align: left; }
  .navbar-brand h1 { font-size: 15px; }
}

@media (max-width: 480px) {
  .login-container { padding: 32px 24px; }
  .personnel-grid { grid-template-columns: 1fr; }
  .container { padding: 16px; }
}
