/* 融金大厦-团队校外住宿/工位管理系统 - 全局样式（移动端优先） */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #2B6FF2;
  --primary-light: #E8F1FF;
  --success: #07C160;
  --warning: #FF9500;
  --danger: #FA5151;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --text: #333333;
  --text-2: #666666;
  --text-3: #999999;
  --border: #EBEDF0;
}

html {
  font-size: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  /* 电脑浏览器上居中限宽，手机全宽 */
  max-width: 750px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

a { text-decoration: none; color: inherit; }
button { font-family: inherit; }

/* ===== 顶部导航栏 ===== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--primary);
  color: #fff;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  font-size: 17px;
  font-weight: 600;
}
.navbar .back {
  position: absolute;
  left: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
}
.app-navbar-title {
  height: auto;
  min-height: 52px;
  padding: 7px 46px;
  font-size: 13px;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
}

/* ===== 页面主体 ===== */
.page {
  padding: 12px 12px 70px; /* 底部留出 tabbar 空间 */
}

/* ===== 卡片 ===== */
.card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

/* ===== 统计栏 ===== */
.stats-bar {
  display: flex;
  background: linear-gradient(135deg, #2B6FF2, #5B8FF9);
  border-radius: 12px;
  padding: 20px 8px;
  color: #fff;
  margin-bottom: 16px;
}
.stat-item {
  flex: 1;
  text-align: center;
}
.stat-item + .stat-item { border-left: 1px solid rgba(255,255,255,0.25); }
.stat-num { font-size: 24px; font-weight: 700; display: block; }
.stat-label { font-size: 12px; opacity: 0.85; }

/* ===== 章节标题 ===== */
.section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 16px 4px 10px;
}

/* ===== 房间类型网格 ===== */
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.type-card {
  background: var(--card);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  cursor: pointer;
}
.type-card:active { transform: scale(0.97); }
.type-header { display: flex; align-items: center; margin-bottom: 8px; }
.type-icon { font-size: 22px; margin-right: 8px; }
.type-name { font-size: 15px; font-weight: 600; }
.type-detail { font-size: 12px; color: var(--text-3); }
.progress-bar {
  height: 6px; background: #F0F0F0; border-radius: 3px;
  margin: 10px 0 6px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 3px; }
.type-stats {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-3);
}

/* ===== 列表卡片 ===== */
.list-item {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  cursor: pointer;
}
.list-item:active { background: #fafafa; }

/* ===== 按钮 ===== */
.btn {
  display: block;
  width: 100%;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
}
.btn:active { opacity: 0.85; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-sm {
  display: inline-block; padding: 6px 16px; border-radius: 8px;
  font-size: 13px; border: 1px solid; cursor: pointer;
}

/* ===== 标签 ===== */
.tag {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 12px; line-height: 1.4;
}
.tag-blue { background: var(--primary-light); color: var(--primary); }
.tag-green { background: #E6F9F0; color: var(--success); }
.tag-orange { background: #FFF3E6; color: var(--warning); }
.tag-red { background: #FFEBEB; color: var(--danger); }
.tag-gray { background: #F0F0F0; color: var(--text-3); }

/* ===== 表单 ===== */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block; font-size: 13px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 500;
}
.form-input {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 8px;
  background: #fff; outline: none;
}
.form-input:focus { border-color: var(--primary); }
.form-textarea {
  width: 100%; padding: 11px 12px; font-size: 15px; min-height: 80px;
  border: 1px solid var(--border); border-radius: 8px; resize: vertical;
  font-family: inherit; outline: none;
}
select.form-input { appearance: auto; }

/* ===== 底部 TabBar ===== */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 750px;
  margin: 0 auto;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex;
  height: 52px;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-3);
  cursor: pointer;
}
.tab-item .tab-icon { font-size: 20px; line-height: 1; }
.tab-item.active { color: var(--primary); }

/* ===== 分布图 ===== */
.legend {
  display: flex; justify-content: center; gap: 16px;
  padding: 8px; font-size: 12px; color: var(--text-2);
  flex-wrap: wrap;
}
.legend-item { display: flex; align-items: center; }
.legend-dot {
  flex: 0 0 12px;
  width: 12px; height: 12px; border-radius: 3px; margin-right: 4px;
  padding: 0;
}
.legend-dot.empty { background: var(--success); }
.legend-dot.occupied { background: var(--danger); }
.legend-dot.reserved { background: var(--warning); }
.legend-dot.maintain { background: var(--text-3); }

.seat-grid {
  display: grid;
  gap: 8px;
  justify-content: center;
  padding: 8px;
}
.seat {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 8px; border: 2px solid;
  cursor: pointer; position: relative;
  transition: transform 0.1s;
  min-width: 0;
}
.seat:active { transform: scale(0.94); }
.seat:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.seat-icon { font-size: 22px; line-height: 1; margin-bottom: 3px; }
.seat .seat-label { font-size: 12px; font-weight: 600; color: #333; }
.seat .seat-occupant {
  font-size: 9px; color: #666; max-width: 90%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.seat.status-empty { background: #E6F9F0; border-color: var(--success); }
.seat.status-occupied { background: #FFEBEB; border-color: var(--danger); }
.seat.status-reserved { background: #FFF3E6; border-color: var(--warning); }
.seat.status-maintain { background: #F0F0F0; border-color: #ccc; }

/* ===== 按现场图绘制的平面布局 ===== */
.dorm-grid {
  align-items: stretch;
  max-width: 520px;
  margin: 0 auto;
}
.dorm-grid .seat { aspect-ratio: 1.08; }

.floorplan {
  position: relative;
  min-height: 320px;
  padding: 12px;
  background: #fbfcff;
  border: 1px solid #e5eaf5;
  border-radius: 10px;
  overflow: hidden;
}
.floorplan-office { overflow-x: auto; }
.office-room-shell {
  --desk-width: clamp(44px, 9.2vw, 68px);
  position: relative;
  width: max-content;
  min-width: 100%;
  padding: 54px 38px 58px;
  border: 2px solid #64748b;
  background: #fff;
}
.desk-banks {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 34px;
}
.desk-bank {
  display: grid;
  grid-template-columns: repeat(2, var(--desk-width));
  width: max-content;
}
.desk-column {
  display: grid;
  grid-template-rows: repeat(var(--desk-rows), 62px);
}
.desk-bank .seat {
  width: var(--desk-width);
  height: 62px;
  border-width: 1px;
  border-radius: 0;
  margin: 0;
}
.desk-column .seat + .seat { border-top-width: 0; }
.desk-column-right .seat { border-left-width: 0; }
.desk-column-left .seat:first-child { border-radius: 5px 0 0 0; }
.desk-column-right .seat:first-child { border-radius: 0 5px 0 0; }
.desk-column-left .seat:last-child { border-radius: 0 0 0 5px; }
.desk-column-right .seat:last-child { border-radius: 0 0 5px 0; }
.desk-bank .seat-icon { height: 19px; margin-bottom: 2px; }
.desk-bank .seat .seat-label { font-size: 10px; }
.desk-bank .seat .seat-occupant { font-size: 8px; }
.workstation-symbol {
  position: relative;
  display: block;
  width: 20px;
  height: 18px;
}
.workstation-symbol::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 1px;
  width: 14px;
  height: 8px;
  border: 1.5px solid #475569;
  border-radius: 2px;
  background: #fff;
}
.workstation-symbol::after {
  content: '';
  position: absolute;
  left: 6px;
  bottom: 1px;
  width: 8px;
  height: 5px;
  border: 1.5px solid #475569;
  border-radius: 5px 5px 2px 2px;
}
.workstation-symbol i {
  position: absolute;
  left: 9px;
  top: 10px;
  width: 2px;
  height: 3px;
  background: #475569;
}
.desk-column-left .workstation-symbol { transform: rotate(90deg); }
.desk-column-right .workstation-symbol { transform: rotate(-90deg); }
.window-segment {
  position: absolute;
  top: -3px;
  height: 5px;
  border-top: 2px solid #38a3db;
  border-bottom: 2px solid #38a3db;
  background: #e0f4ff;
}
.window-segment-1 { left: 7%; width: 23%; }
.window-segment-2 { left: 39%; width: 18%; }
.window-segment-3 { left: 68%; width: 23%; }
.plan-label {
  position: absolute;
  z-index: 2;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1.2;
  color: #26749d;
  background: #e7f6fd;
}
.window-label { left: 12px; top: 10px; }
.door-opening {
  position: absolute;
  left: 48%;
  bottom: -3px;
  width: 54px;
  height: 43px;
  background: #fff;
}
.door-leaf {
  position: absolute;
  left: 2px;
  bottom: 1px;
  width: 38px;
  height: 2px;
  background: #64748b;
  transform: rotate(50deg);
  transform-origin: left center;
}
.door-swing {
  position: absolute;
  left: 2px;
  bottom: 1px;
  width: 39px;
  height: 39px;
  border-right: 1px dashed #94a3b8;
  border-top: 1px dashed #94a3b8;
  border-radius: 0 39px 0 0;
}
.door-label {
  position: absolute;
  left: 21px;
  bottom: 2px;
  font-size: 11px;
  color: var(--text-2);
}

.floorplan-meeting {
  min-height: 270px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
}
.meeting-table {
  width: min(250px, 70%);
  min-height: 120px;
  border: 3px solid #b9a3d9;
  border-radius: 50%;
  background: #f1eafd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #6d4b9c;
}
.meeting-table span:last-child { font-size: 11px; color: var(--text-3); }
.meeting-icon { font-size: 28px; }
.floorplan-meeting .seat { width: 120px; aspect-ratio: 1; }

/* ===== 弹窗 ===== */
.overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); display: flex;
  align-items: center; justify-content: center; z-index: 200;
}
.popup {
  width: 88%; max-width: 360px; background: #fff;
  border-radius: 16px; overflow: hidden;
}
.popup-header {
  padding: 16px; text-align: center; font-size: 16px; font-weight: 600;
  border-bottom: 1px solid var(--border);
}
.popup-body { padding: 16px; }
.popup-footer { padding: 12px 16px 16px; }
.detail-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; font-size: 14px;
  border-bottom: 1px solid #f5f5f5;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-3); }
.detail-value { color: var(--text); font-weight: 500; }

/* ===== 空状态 ===== */
.empty-state { text-align: center; padding: 60px 0; color: var(--text-3); }
.empty-icon { font-size: 48px; display: block; margin-bottom: 8px; }

/* ===== 工具类 ===== */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-1 { flex: 1; }
.text-ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.mt8 { margin-top: 8px; }
.mt16 { margin-top: 16px; }
.mb8 { margin-bottom: 8px; }
.gap8 { gap: 8px; }
.gap12 { gap: 12px; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-primary { color: var(--primary); }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
