/* ===== CSS Custom Properties ===== */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #93c5fd;
  --accent: #d97706;
  --accent-dark: #b45309;
  --green: #059669;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --amber-light: #fef3c7;
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0,0,0,0.1), 0 4px 10px -2px rgba(0,0,0,0.05);
  --shadow-xl: 0 20px 40px -5px rgba(0,0,0,0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Animation ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.animate-in {
  animation: fadeInUp 0.5s ease both;
}

.animate-in-d1 { animation-delay: 0.05s; }
.animate-in-d2 { animation-delay: 0.1s; }
.animate-in-d3 { animation-delay: 0.15s; }
.animate-in-d4 { animation-delay: 0.2s; }
.animate-in-d5 { animation-delay: 0.25s; }
.animate-in-d6 { animation-delay: 0.3s; }

/* ===== Header ===== */
header {
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 64px;
}

.logo {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: -0.5px;
}

.logo:hover { opacity: 0.85; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-danger {
  background: var(--red);
  color: #fff;
  border: none;
}

.btn-danger:hover {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}

/* ===== Cover / Full-screen splash ===== */
.page-cover {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  will-change: transform;
}

.cover-spacer {
  height: 100vh;
  pointer-events: none;
}

.cover-bg {
  position: absolute;
  inset: 0;
  background: url("/cover-bg.jpg") center/cover no-repeat;
  will-change: transform;
}

.cover-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.50) 0%, rgba(0,0,0,0.20) 40%, rgba(0,0,0,0.20) 60%, rgba(0,0,0,0.55) 100%);
}

.cover-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  transform: translateY(-40px);
}

.cover-logo {
  width: 160px;
  height: auto;
  filter: brightness(1.1) drop-shadow(0 4px 20px rgba(0,0,0,0.3));
  animation: fadeInUp 0.8s ease 0.2s both;
}

.cover-text-box {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 32px 0 16px;
  animation: fadeInUp 0.8s ease 0.4s both;
}

.cover-line {
  width: 40px;
  height: 1px;
  background: rgba(255,255,255,0.35);
}

.cover-tagline {
  font-size: 32px;
  font-weight: 300;
  color: #fff;
  letter-spacing: 12px;
  text-shadow: 0 2px 16px rgba(0,0,0,0.35);
}

.cover-sub {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  letter-spacing: 5px;
  font-weight: 400;
  text-transform: uppercase;
  animation: fadeInUp 0.8s ease 0.6s both;
}

.cover-scroll-hint {
  position: absolute;
  bottom: 52px;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: fadeInUp 1s ease 1.2s both;
}

.cover-scroll-hint span {
  color: rgba(255,255,255,0.4);
  font-size: 11px;
  letter-spacing: 3px;
}

.scroll-arrow {
  width: 18px;
  height: 18px;
  border-right: 1.5px solid rgba(255,255,255,0.35);
  border-bottom: 1.5px solid rgba(255,255,255,0.35);
  transform: rotate(45deg);
  animation: scrollBounce 2.4s ease infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.3; }
  50% { transform: rotate(45deg) translate(4px, 4px); opacity: 0.8; }
}

/* ===== Header hidden when cover is visible ===== */
header.header-hidden {
  transform: translateY(-100%);
  transition: transform 0.3s ease;
}

header.header-visible {
  transform: translateY(0);
  transition: transform 0.3s ease;
}

/* ===== Hall Header ===== */
.hall-header {
  margin: 28px 0 0;
}

.hall-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.hall-header-top h1 {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
}

.hall-actions {
  display: flex;
  gap: 10px;
}

/* ===== Hall Search ===== */
.hall-search {
  margin-top: 20px;
}

.hall-search-box {
  display: flex;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
  max-width: 480px;
}

.hall-search-box:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.hall-search-box input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  font-size: 14px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  outline: none;
}

.hall-search-box input::placeholder {
  color: var(--text-muted);
}

.hall-search-box .btn {
  border: none;
  border-radius: 0;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
}

.hall-search-box .btn:hover {
  background: var(--primary-dark);
}

/* ===== Campus Tabs ===== */
.campus-tabs {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.campus-tab {
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.campus-tab:hover {
  border-color: var(--primary-light);
  color: var(--primary);
}

.campus-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ===== Hall Meta ===== */
.hall-meta {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== Hall Grid ===== */
.hall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
  margin: 18px 0 48px;
}

.hall-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: fadeInUp 0.5s ease both;
}

.hall-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-xl);
  border-color: var(--primary-light);
}

.hall-card-top {
  position: relative;
  overflow: hidden;
}

.hall-card-cover {
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  overflow: hidden;
}

.hall-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.hall-card:hover .hall-card-cover img {
  transform: scale(1.05);
}

.hall-card-emoji {
  font-size: 56px;
  opacity: 0.5;
  filter: grayscale(0.3);
  transition: transform 0.3s, opacity 0.3s;
}

.hall-card:hover .hall-card-emoji {
  transform: scale(1.1) rotate(-4deg);
  opacity: 0.7;
}

.hall-card-body {
  padding: 16px 18px 18px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.hall-card-body h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.hall-card-author {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hall-card-tags {
  margin-bottom: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.hall-card-contact {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.hall-card-contact::before {
  content: "📞";
  font-size: 11px;
  opacity: 0.6;
}

.hall-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.hall-card-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-dark);
}

.hall-card-seller {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===== Tags ===== */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.tag-campus {
  background: #dbeafe;
  color: #1e40af;
}

/* ===== Empty State ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.empty-state p {
  font-size: 16px;
  margin-bottom: 24px;
}

/* ===== Detail Page ===== */
.detail-page {
  margin: 28px 0 48px;
  animation: fadeInUp 0.4s ease both;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--primary);
}

.detail-card {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 36px;
  background: var(--card);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.detail-left {
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: var(--radius);
  overflow: hidden;
  width: 100%;
}

.detail-cover img {
  max-width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.detail-cover-placeholder {
  font-size: 90px;
  opacity: 0.5;
  filter: grayscale(0.3);
}

.detail-right {
  display: flex;
  flex-direction: column;
}

.detail-tags {
  margin-bottom: 12px;
}

.detail-right h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  line-height: 1.3;
}

.detail-right .detail-author {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.detail-price {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent-dark);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

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

.detail-section h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.detail-section p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-secondary);
}

.detail-seller {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.seller-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}

.seller-info {
  display: flex;
  flex-direction: column;
}

.seller-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.seller-time {
  font-size: 12px;
  color: var(--text-muted);
}

.detail-contact {
  background: var(--green-light);
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.contact-label {
  font-size: 13px;
  font-weight: 600;
  color: #065f46;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contact-value {
  font-size: 18px;
  font-weight: 700;
  color: #047857;
}

.detail-date {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.detail-notice {
  padding: 14px 18px;
  background: var(--amber-light);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  font-size: 13px;
  color: #92400e;
  line-height: 1.6;
}

.detail-delete-form {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.detail-delete-form .btn-danger {
  font-size: 13px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.detail-delete-form .btn-danger:hover {
  opacity: 1;
}

/* ===== Manage Page ===== */
.manage-search-form {
  margin: 20px 0;
}

.manage-search-box {
  display: flex;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  max-width: 440px;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.manage-search-box:focus-within {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.manage-search-box input {
  flex: 1;
  padding: 12px 16px;
  border: none;
  font-size: 14px;
  font-family: inherit;
  background: transparent;
  color: var(--text);
  outline: none;
}

.manage-search-box .btn {
  border: none;
  border-radius: 0;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
}

.manage-count {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-weight: 500;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.manage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}

.manage-item:hover {
  box-shadow: var(--shadow-md);
}

.manage-item-info {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}

.manage-item-info strong {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.manage-item-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
}

/* ===== Form Page ===== */
.form-page {
  max-width: 580px;
  margin: 28px auto 48px;
  background: var(--card);
  padding: 36px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  animation: fadeInUp 0.4s ease both;
}

.form-page h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}

.form-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.form-group label .required {
  color: var(--red);
  margin-left: 2px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  background: var(--bg);
  color: var(--text);
  transition: all 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  background: var(--card);
}

.form-group textarea {
  resize: vertical;
  min-height: 100px;
}

.form-group .hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}

.form-actions .btn {
  flex: 1;
  padding: 12px;
  font-size: 15px;
}

.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
  font-size: 14px;
  line-height: 1.5;
}

.alert-error {
  background: var(--red-light);
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ===== Footer ===== */
footer {
  margin-top: auto;
  background: #1e293b;
  color: #94a3b8;
  padding: 24px 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.6;
}

footer a {
  color: var(--primary-light);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 16px;
  }

  .hall-header-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .hall-header-top h1 {
    font-size: 22px;
  }

  .hall-search-box {
    max-width: 100%;
  }

  .detail-card {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px;
  }

  .detail-cover {
    min-height: 220px;
  }

  .detail-right h1 {
    font-size: 22px;
  }

  .detail-price {
    font-size: 26px;
  }

  .hall-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
  }

  .hall-card-cover {
    height: 160px;
  }

  .form-page {
    padding: 24px 20px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .manage-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .manage-item-info strong {
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .hall-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .hall-card-body {
    padding: 12px;
  }

  .hall-card-body h3 {
    font-size: 14px;
  }

  .hall-card-price {
    font-size: 16px;
  }

  .campus-tabs {
    gap: 6px;
  }

  .campus-tab {
    padding: 5px 14px;
    font-size: 12px;
  }
}