/* ============================================
   江阴市体育中心座位查询H5 — 全局样式
   足球主题 | 移动端优先 | 扁平化设计
   ============================================ */

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

:root {
  /* 足球主题配色 */
  --grass-green: #2E7D32;
  --grass-green-light: #4CAF50;
  --dark-blue: #1A237E;
  --accent-gold: #FFC107;
  --white: #FFFFFF;
  --off-white: #F5F5F5;
  --text-dark: #212121;
  --text-light: #757575;
  --overlay-dark: rgba(0, 0, 0, 0.55);
  --overlay-card: rgba(255, 255, 255, 0.92);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  --shadow-heavy: 0 16px 48px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial,
    sans-serif;
  color: var(--text-dark);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Background Layer --- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, #B3E5FC 0%, #81D4FA 40%, #4FC3F7 100%);
}

.bg-layer::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("../imgs/体育馆海报.png") center / cover no-repeat;
  opacity: 0.75;
}

/* Dark overlay for text readability */
.page-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(26, 35, 126, 0.3) 0%,
    rgba(0, 0, 0, 0.45) 40%,
    rgba(0, 0, 0, 0.6) 100%
  );
  z-index: 0;
  pointer-events: none;
}

/* --- Main Container --- */
.main-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  overflow: hidden;
}

/* 内容包装层：单屏显示，超高时由 JS 整体缩放适配 */
.fit-wrap {
  width: 100%;
  max-width: 400px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* --- Corner Logo --- */
.corner-logo {
  position: fixed;
  top: 12px;
  left: 14px;
  z-index: 10;
  height: 36px;
  width: auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* --- Header --- */
.header {
  text-align: center;
  padding-top: 4px;
  margin-bottom: 8px;
  animation: fadeInDown 0.6s ease-out;
}

.header-icon {
  display: inline-block;
  font-size: 34px;
  margin-bottom: 2px;
  animation: ballBounce 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
  color: aliceblue;
}

.header-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--white);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 2px;
}

.header-subtitle {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  margin-top: 2px;
  letter-spacing: 1px;
}

/* --- Search Card --- */
.search-card {
  width: 100%;
  max-width: 400px;
  background: var(--overlay-card);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-heavy);
  backdrop-filter: blur(10px);
  animation: fadeInUp 0.6s ease-out 0.15s both;
}

.search-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--dark-blue);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-card-label .icon {
  font-size: 18px;
}

/* --- Select Grid: 2×2 layout for 4 dropdowns --- */
.select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 8px;
  width: 100%;
  margin-bottom: 8px;
}

.select-wrapper {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.select-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--dark-blue);
  text-align: center;
  letter-spacing: 0.5px;
}

.seat-select {
  width: 100%;
  height: 42px;
  border: 2px solid #E0E0E0;
  border-radius: var(--radius-sm);
  padding: 0 8px;
  font-size: 15px;
  color: var(--text-dark);
  outline: none;
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  /* Custom dropdown arrow */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%23757575'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  padding-right: 28px;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.seat-select:focus {
  border-color: var(--grass-green);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.15);
}

.seat-select.error {
  border-color: #E53935;
  animation: shake 0.5s ease-in-out;
}

.seat-select.success {
  border-color: var(--grass-green);
}

/* Search button — full width below selects */
.search-btn {
  width: 100%;
  height: 42px;
  padding: 0;
  background: var(--grass-green);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.search-btn:active {
  transform: scale(0.96);
  background: #1B5E20;
}

.search-btn:disabled {
  background: #BDBDBD;
  cursor: not-allowed;
  transform: none;
}

/* --- Hint Text --- */
.hint-text {
  font-size: 11px;
  color: var(--text-light);
  margin-top: 8px;
  text-align: center;
}

/* --- Result Area --- */
.result-area {
  width: 100%;
  max-width: 400px;
  margin-top: 8px;
  display: none;
  animation: fadeInUp 0.4s ease-out;
}

.result-area.visible {
  display: block;
}

/* --- Error Message --- */
.error-msg {
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid rgba(229, 57, 53, 0.3);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: #C62828;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  animation: fadeInUp 0.3s ease-out;
}

.error-msg .icon {
  font-size: 20px;
  flex-shrink: 0;
}

/* --- Seat Info Card --- */
.seat-card {
  background: var(--overlay-card);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  text-align: center;
  border-left: 4px solid var(--grass-green);
}

.seat-card-header {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
}

.seat-card-seat {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark-blue);
  letter-spacing: 2px;
  margin-bottom: 2px;
}

.seat-card-location {
  font-size: 12px;
  color: var(--text-light);
  margin-bottom: 4px;
  line-height: 1.6;
}

.seat-card-location span {
  display: inline-block;
  background: rgba(46, 125, 50, 0.1);
  color: var(--grass-green);
  padding: 2px 10px;
  border-radius: 20px;
  margin: 2px 4px;
  font-weight: 500;
}

/* --- Gate Navigation Buttons --- */
.gate-nav-caption {
  font-size: 11px;
  color: var(--text-light);
  margin: 6px 0;
  text-align: center;
}

.gate-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.gate-nav .gate-btn-wrap {
  position: relative;
  display: inline-flex;
  flex: 1 1 38%;
  min-width: 118px;
}

.gate-nav .pano-btn {
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  justify-content: center;
}

/* 官方推荐入口：按钮描金边 + 高亮"推荐"徽标 */
.gate-btn-wrap.rec .pano-btn {
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.35), 0 0 0 2px rgba(255, 193, 7, 0.85);
}

.rec-badge {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: linear-gradient(135deg, #FFC107, #FF8F00);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 10px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(255, 160, 0, 0.45);
  animation: badgePulse 1.8s ease-in-out infinite;
}

/* --- Panorama Button --- */
.pano-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--grass-green), var(--grass-green-light));
  color: var(--white);
  border: none;
  border-radius: 28px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 6px 20px rgba(46, 125, 50, 0.35);
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.pano-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.pano-btn:active {
  transform: scale(0.95);
  box-shadow: 0 3px 10px rgba(46, 125, 50, 0.3);
}

.pano-btn:active::before {
  width: 300px;
  height: 300px;
}

.pano-btn .icon {
  font-size: 22px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* --- Loading Overlay --- */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

.loading-overlay.active {
  display: flex;
}

/* Football Loading Animation */
.football-loader {
  width: 64px;
  height: 64px;
  position: relative;
  animation: spinFootBall 1s linear infinite;
}

.football-loader .ball-body {
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle at 35% 35%,
    #FFFFFF 0%,
    #F5F5F5 30%,
    #E0E0E0 60%,
    #9E9E9E 100%
  );
  border-radius: 50%;
  position: relative;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 -4px 8px rgba(0, 0, 0, 0.15);
}

/* Pentagon patches on football */
.football-loader .ball-body::before {
  content: "⚽";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: rgba(0, 0, 0, 0.8);
}

.loading-text {
  color: var(--white);
  font-size: 15px;
  margin-top: 16px;
  letter-spacing: 2px;
  animation: pulse 1.5s ease-in-out infinite;
}

/* --- Footer --- */
.footer {
  margin-top: 6px;
  padding: 6px 0 2px;
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 10px;
  letter-spacing: 1px;
}

/* ============================================
   Panorama Page Styles
   ============================================ */

.pano-body {
  overflow: hidden;
}

.pano-container {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.pano-topbar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.85), rgba(0, 0, 0, 0.4));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-height: 52px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.15);
  color: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  flex-shrink: 0;
}

.back-btn:active {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0.95);
}

.back-btn .icon {
  font-size: 18px;
}

.pano-seat-info {
  color: var(--white);
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pano-seat-info .seat-label {
  color: var(--accent-gold);
  font-weight: 700;
  font-size: 15px;
}

/* Iframe Wrapper */
.pano-iframe-wrap {
  flex: 1;
  position: relative;
  background: #000;
}

.pano-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Panorama Loading */
.pano-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #1A1A2E;
  z-index: 5;
  transition: opacity 0.5s ease;
}

.pano-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.pano-loading .football-icon-lg {
  font-size: 56px;
  animation: ballBounce 1s ease-in-out infinite;
}

.pano-loading-text {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-top: 12px;
  letter-spacing: 2px;
}

/* ============================================
   Keyframe Animations
   ============================================ */

@keyframes fadeInDown {
  from {
    opacity: 0;
    transform: translateY(-24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spinFootBall {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes ballBounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-12px) scale(1.08);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  10%, 50%, 90% {
    transform: translateX(-6px);
  }
  30%, 70% {
    transform: translateX(6px);
  }
}

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

/* Page transition: slide-left */
@keyframes slideOutLeft {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-30%);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.page-exit {
  animation: slideOutLeft 0.3s ease-in forwards;
}

.page-enter {
  animation: slideInRight 0.35s ease-out;
}

/* ============================================
   Responsive Tweaks
   ============================================ */

/* Small phones */
@media (max-width: 360px) {
  .header-icon {
    font-size: 30px;
  }
  .header-title {
    font-size: 17px;
  }
  .search-card {
    padding: 10px;
  }
  .select-grid {
    gap: 5px 6px;
  }
  .seat-select {
    font-size: 14px;
    height: 40px;
    padding: 0 6px;
    padding-right: 24px;
    background-position: right 6px center;
  }
  .search-btn {
    height: 40px;
    font-size: 14px;
  }
  .gate-nav .gate-btn-wrap {
    min-width: 108px;
  }
  .gate-nav .pano-btn {
    font-size: 13px;
    padding: 8px 10px;
  }
}

/* Extra small: further compact selects */
@media (max-width: 340px) {
  .select-grid {
    gap: 4px;
  }
  .seat-select {
    font-size: 13px;
    padding: 0 4px;
    padding-right: 20px;
    background-position: right 4px center;
    background-size: 10px;
  }
  .search-btn {
    font-size: 13px;
  }
}

/* Larger phones / small tablets */
@media (min-width: 480px) {
  .search-card {
    padding: 16px 20px;
  }
}

/* Tablet and above */
@media (min-width: 768px) {
  .fit-wrap {
    max-width: 440px;
  }
  .search-card {
    max-width: 440px;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .bg-layer::before {
    /* Ensure crisp background on retina */
  }
}

/* Safe area for notched phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .main-container {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  .pano-topbar {
    padding-top: calc(10px + env(safe-area-inset-top));
  }
}
