:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #1f5fbf;
  --primary-600: #1a4f9e;
  --border: #e5e7eb;
  --ring: rgba(31, 95, 191, .25);
  --shadow: 0 6px 24px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .02);
  --radius: 14px;
  --success: #059669;
  --warning: #d97706;
  --info: #0284c7;
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('index_background.png');
  background-size: cover;
  background-position: center;
  opacity: 0.9;
  z-index: -1;
}

.container {
  width: min(1200px, 94vw);
  margin: 0 auto
}

header.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #8B0000 0%, #A52A2A 100%);
  padding: 32px 0 48px;
  box-shadow: 0 8px 30px rgba(16, 24, 40, .12);
}

header.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('shimen_gate.jpg');
  background-size: cover;
  background-position: center;
  opacity: 0.08; /* 调整透明度以达到淡淡的效果 */
  z-index: 0; /* 确保在内容之下，但在背景之上 */
}

header .container {
  position: relative;
  z-index: 2
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
}

.brand-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  max-width: 560px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: .2px;
  font-size: 18px;
}

.logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .2);
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3);
}

.logo svg {
  width: 24px;
  height: 24px;
  fill: #fff
}

.school-logo {
  height: 60px;
  width: auto;
}

.hero-main {
  text-align: center;
  max-width: 600px;
  margin: 0 auto;
}

.hero h1 {
  margin: 0 0 24px;
  font-size: 32px;
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .1);
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 让整体内容更靠中，而不是过度贴右侧 */
@media(min-width:900px) {
  .header-content {
    justify-content: flex-start;
  }

  .school-logo {
    margin-right: auto;
  }

  .brand-group {
    margin-left: auto;
  }
}

@media(max-width: 768px) {
  .hero h1 {
    font-size: 24px;
  }
  
  .hero-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .hero-actions .btn {
    width: 100%;
    max-width: 280px;
  }
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  user-select: none;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: .2s;
}

.btn-primary {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  color: #0f3c82;
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1);
  font-weight: 600;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .15);
}

.btn-outline {
  background: rgba(255, 255, 255, .1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .3);
  backdrop-filter: blur(10px);
  font-weight: 600;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, .2);
  border-color: rgba(255, 255, 255, .5);
  transform: translateY(-2px);
}

main {
  margin-top: -32px;
  padding-bottom: 40px
}

section.view {
  display: none
}

section.view.active {
  display: block
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 搜索栏样式 */
.search-section {
  margin-bottom: 32px;
  padding: 32px 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(16, 24, 40, .08), 0 2px 8px rgba(16, 24, 40, .04);
  border: 1px solid rgba(255, 255, 255, .8);
}

.search-header {
  text-align: center;
  margin-bottom: 24px;
}

.search-header h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  background: linear-gradient(135deg, var(--primary) 0%, #1a4f9e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.search-header p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.search-box {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}

.search-input {
  width: 100%;
  padding: 18px 120px 18px 20px;
  border: 2px solid var(--border);
  border-radius: 16px;
  font-size: 16px;
  outline: none;
  transition: all .3s ease;
  background: #fff;
  box-shadow: 0 4px 12px rgba(16, 24, 40, .04);
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring), 0 8px 24px rgba(16, 24, 40, .08);
  transform: translateY(-2px);
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-icon {
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  background: var(--primary-600);
  transform: translateY(-50%) scale(1.05);
}

.search-btn:active {
  transform: translateY(-50%) scale(0.95);
}

/* 标签页样式 */
.tabs-section {
  margin-bottom: 32px;
}

.tabs-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  padding: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: .2s;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.tab-btn:hover {
  background: #f8fafc;
  color: var(--text);
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}

.tab-btn.active .tab-icon {
  background: rgba(255, 255, 255, .2) !important;
  color: #fff !important;
}

.tab-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 14px;
  flex-shrink: 0;
}

.tab-count {
  background: rgba(0, 0, 0, .1);
  color: currentColor;
  padding: 2px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
}

.tab-btn.active .tab-count {
  background: rgba(255, 255, 255, .2);
  color: #fff;
}

.tabs-content {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 响应式设计 */
@media(max-width:768px) {
  .tabs-nav {
    padding: 2px;
    gap: 4px;
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 13px;
  }

  .tab-btn span {
    display: none;
  }

  .tab-icon {
    width: 20px;
    height: 20px;
  }

  .tab-count {
    font-size: 10px;
    padding: 1px 4px;
  }
}

/* 列表样式 */
.item-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: .15s;
}

.item-row:last-child {
  border-bottom: none
}

.item-row:hover {
  background: #f8fafc
}

.item-row.disabled {
  opacity: .6;
  cursor: not-allowed
}

.item-row.disabled:hover {
  background: transparent
}

.item-icon-small {
  flex: 0 0 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}

.item-icon-small svg {
  width: 18px;
  height: 18px;
  fill: currentColor
}

.item-content {
  flex: 1;
  min-width: 0
}

.item-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px
}

.item-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4
}

.item-status {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.status-active {
  background: #dcfce7;
  color: #166534
}

.status-ended {
  background: #fef3c7;
  color: #92400e
}

.status-coming {
  background: #e0e7ff;
  color: #3730a3
}

.item-arrow {
  color: var(--muted)
}

.item-arrow svg {
  width: 16px;
  height: 16px;
  fill: currentColor
}

/* 隐藏样式 */
.hidden {
  display: none !important
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: .5
}

.panel {
  padding: 18px
}

.breadcrumbs {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px
}

.back {
  color: var(--primary);
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center
}

.panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px
}

.panel-title {
  font-size: 20px;
  font-weight: 800
}

.panel-sub {
  color: var(--muted);
  font-size: 13px
}

/* --- CSS 修改点 1 --- */
.panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-top: 14px
}

@media(min-width:900px) {

  /* 默认状态下，设为单列并居中 */
  .panel-grid {
    grid-template-columns: 380px;
    justify-content: center;
  }

  /* 当有 .results-shown 类时，恢复两列布局 */
  .panel-grid.results-shown {
    grid-template-columns: 380px 1fr;
    justify-content: initial;
  }
}

.form-card {
  padding: 16px
}

.field {
  margin-bottom: 12px
}

label {
  display: block;
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px
}

.input {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  outline: none;
  font-size: 14px;
  transition: .15s;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring)
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px
}

.btn-solid {
  background: var(--primary);
  color: #fff;
  padding: 11px 16px;
  border-radius: 10px;
  border: 1px solid var(--primary);
}

.btn-solid:hover {
  background: var(--primary-600)
}

.btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  padding: 11px 16px;
  border-radius: 10px
}

.help {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px
}

/* --- CSS 修改点 2 --- */
.result-card {
  padding: 16px;
  min-height: 140px;
  display: none;
  /* 默认隐藏结果卡片 */
}

/* 当父元素有 .results-shown 类时，显示结果卡片 */
.panel-grid.results-shown .result-card {
  display: block;
}

.result-empty {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media(min-width:600px) {
  .result-grid {
    grid-template-columns: repeat(2, 1fr)
  }
}

.kv {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px
}

.kv .k {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px
}

.kv .v {
  font-weight: 700
}

.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px
}

.tag {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #334155;
  border: 1px solid #e5e7eb
}

.roommates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px
}

.mate {
  padding: 6px 10px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 999px
}

.banner {
  padding: 12px 14px;
  border-radius: 12px;
  background: #f0f7ff;
  border: 1px solid #dbeafe;
  color: #0f3c82;
  font-size: 13px
}

.muted {
  color: var(--muted)
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0
}

.loader {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  border-top-color: var(--primary);
  animation: spin .8s linear infinite
}

@keyframes spin {
  to {
    transform: rotate(360deg)
  }
}

/* 弹窗样式 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all .3s ease;
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--surface);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .15);
  max-width: 500px;
  width: 90vw;
  max-height: 80vh;
  overflow: hidden;
  transform: scale(0.9) translateY(20px);
  transition: all .3s ease;
}

.modal-overlay.show .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 24px 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  color: var(--muted);
  transition: .2s;
}

.modal-close:hover {
  background: #f3f4f6;
  color: var(--text);
}

.modal-content {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(80vh - 80px);
}

.system-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.info-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.info-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--primary);
  color: #fff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.info-text h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.info-text p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

footer {
  color: #6b7280;
  font-size: 12px;
  padding: 24px 0 40px;
  text-align: center;
}

.footer-content {
    text-align: center;
    padding: 20px;
}

.footer-contact-info, .footer-beian-info {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px; /* Adds space between items */
}

.footer-contact-info span,
.footer-contact-info address {
    display: inline; /* Ensure they behave as inline elements */
}

.footer-beian-info p {
    margin: 0;
}

@media (max-width: 768px) {
    .footer-contact-info, .footer-beian-info {
        flex-direction: column;
        align-items: center;
        gap: 5px; /* Adjust gap for vertical layout */
    }

    .footer-contact-info span,
    .footer-contact-info address {
        display: block; /* Stack them on mobile */
        text-align: center;
    }
}