/* ============================================
   财贸职高凤凰校区家长开放日签到系统
   配色参考邀请函：暖杏底色 + 深棕红强调
   ============================================ */

/* --- CSS Variables --- */
:root {
  --bg-primary: #F5E6D0;
  --bg-secondary: #EDD9C0;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-hover: rgba(255, 255, 255, 0.9);

  --color-primary: #8B2500;
  --color-primary-light: #A83820;
  --color-accent: #C23A2A;
  --color-accent-hover: #D4463A;
  --color-text: #4A3728;
  --color-text-light: #7A6A5A;
  --color-text-muted: #9A8A7A;
  --color-border: #D4A574;
  --color-border-light: #E8CEB0;

  --color-success: #2D7A3A;
  --color-success-bg: #E8F5E9;
  --color-warning: #E8A317;
  --color-warning-bg: #FFF8E1;
  --color-error: #C62828;
  --color-error-bg: #FFEBEE;
  --color-info: #1565C0;
  --color-info-bg: #E3F2FD;

  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-sm: 0 2px 8px rgba(74, 55, 40, 0.08);
  --shadow-md: 0 4px 16px rgba(74, 55, 40, 0.12);
  --shadow-lg: 0 8px 32px rgba(74, 55, 40, 0.16);
  --shadow-xl: 0 16px 48px rgba(74, 55, 40, 0.2);

  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

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

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

body {
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--bg-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Background Pattern --- */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 20% 20%, rgba(139, 37, 0, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(194, 58, 42, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(212, 165, 116, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* --- Main Container --- */
.container {
  position: relative;
  z-index: 1;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
}

/* --- Header --- */
.header {
  text-align: center;
  padding: 32px 0 24px;
  animation: fadeInDown 0.6s ease;
}

.header__school {
  font-size: 0.85rem;
  color: var(--color-text-light);
  letter-spacing: 2px;
  margin-bottom: 4px;
  font-weight: 400;
}

.header__campus {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  letter-spacing: 3px;
  margin-bottom: 16px;
}

.header__title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 2px;
  line-height: 1.3;
}

.header__divider {
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
  margin: 16px auto 0;
  border-radius: 2px;
}

/* --- Card --- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-light);
  animation: fadeInUp 0.5s ease;
  transition: box-shadow var(--transition-normal);
}

.card + .card {
  margin-top: 16px;
}

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

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-light);
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  font-size: 1rem;
  font-family: var(--font-family);
  color: var(--color-text);
  background: #FFFFFF;
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input::placeholder {
  color: var(--color-text-muted);
}

.form-input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(194, 58, 42, 0.1);
}

.form-input:disabled {
  background: #F5F0EB;
  cursor: not-allowed;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-family);
  letter-spacing: 2px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  color: #FFFFFF;
  background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-primary) 100%);
  box-shadow: 0 4px 12px rgba(194, 58, 42, 0.3);
}

.btn--primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(194, 58, 42, 0.4);
  transform: translateY(-1px);
}

.btn--success {
  color: #FFFFFF;
  background: linear-gradient(135deg, #43A047, #2D7A3A);
  box-shadow: 0 4px 12px rgba(45, 122, 58, 0.3);
}

.btn--success:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(45, 122, 58, 0.4);
  transform: translateY(-1px);
}

.btn--outline {
  color: var(--color-text-light);
  background: transparent;
  border: 1.5px solid var(--color-border);
  box-shadow: none;
  height: 42px;
  font-weight: 500;
  letter-spacing: 1px;
}

.btn--outline:hover {
  background: rgba(212, 165, 116, 0.1);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* Button loading state */
.btn--loading {
  pointer-events: none;
}

.btn--loading::after {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 8px;
}

/* --- Alert Banners --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 16px;
  animation: fadeIn 0.3s ease;
}

.alert__icon {
  flex-shrink: 0;
  font-size: 1.1rem;
  margin-top: 1px;
}

.alert--warning {
  background: var(--color-warning-bg);
  color: #8D6600;
  border: 1px solid #FFE082;
}

.alert--success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #A5D6A7;
}

.alert--error {
  background: var(--color-error-bg);
  color: var(--color-error);
  border: 1px solid #EF9A9A;
}

.alert--info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid #90CAF9;
}

.alert--notice {
  background: rgba(212, 165, 116, 0.15);
  color: var(--color-text-light);
  border: 1px solid var(--color-border-light);
  font-size: 0.8rem;
  text-align: center;
  justify-content: center;
}

/* --- Info Display (Query Result) --- */
.info-section {
  animation: fadeInUp 0.4s ease;
}

.info-row {
  display: flex;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid rgba(212, 165, 116, 0.2);
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  flex-shrink: 0;
  width: 80px;
  font-size: 0.85rem;
  color: var(--color-text-light);
  font-weight: 400;
}

.info-value {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-text);
}

.info-value--highlight {
  color: var(--color-primary);
  font-weight: 600;
}

/* --- Visitor Count Input --- */
.visitor-input {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
}

.visitor-input__label {
  font-size: 0.9rem;
  color: var(--color-text-light);
  font-weight: 500;
}

.visitor-input__controls {
  display: flex;
  align-items: center;
  gap: 0;
  background: #FFFFFF;
  border: 1.5px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.visitor-input__btn {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: var(--color-accent);
  cursor: pointer;
  transition: background var(--transition-fast);
  font-family: var(--font-family);
  font-weight: 600;
}

.visitor-input__btn:hover {
  background: rgba(194, 58, 42, 0.08);
}

.visitor-input__btn:active {
  background: rgba(194, 58, 42, 0.15);
}

.visitor-input__value {
  width: 52px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--color-text);
  border-left: 1px solid var(--color-border-light);
  border-right: 1px solid var(--color-border-light);
  user-select: none;
}

/* --- Success View --- */
.success-view {
  text-align: center;
  animation: fadeInUp 0.5s ease;
}

.success-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: bounceIn 0.6s ease;
}

.success-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-success);
  margin-bottom: 4px;
}

.success-subtitle {
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 24px;
}

/* --- Route Guide --- */
.route-guide {
  margin-top: 20px;
  animation: fadeInUp 0.6s ease 0.2s both;
}

.route-guide__title {
  text-align: center;
  font-size: 0.9rem;
  color: var(--color-text-light);
  margin-bottom: 12px;
  font-weight: 500;
  letter-spacing: 1px;
}

.route-guide__image {
  width: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

/* --- Footer --- */
.footer {
  text-align: center;
  padding: 24px 0 16px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  animation: fadeIn 0.6s ease 0.4s both;
}

/* --- Back Link --- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--color-text-light);
  text-decoration: none;
  font-size: 0.85rem;
  margin-top: 16px;
  cursor: pointer;
  transition: color var(--transition-fast);
}

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

/* --- View Transitions --- */
.view {
  display: none;
}

.view--active {
  display: block;
}

.view-enter {
  animation: fadeInUp 0.4s ease;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* ============================================
   Admin Page Styles
   ============================================ */

.admin-container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100vh;
}

.admin-header {
  text-align: center;
  padding: 24px 0;
}

.admin-header__title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
}

.admin-header__subtitle {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* --- Session Cards --- */
.session-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.session-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-light);
  text-align: center;
}

.session-card__title {
  font-size: 0.85rem;
  color: var(--color-text-light);
  margin-bottom: 8px;
  font-weight: 500;
}

.session-card__toggle {
  margin-bottom: 12px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle__slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #CCC;
  border-radius: 28px;
  transition: var(--transition-normal);
}

.toggle__slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition-normal);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle input:checked + .toggle__slider {
  background: var(--color-success);
}

.toggle input:checked + .toggle__slider::before {
  transform: translateX(24px);
}

.session-card__stat {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.session-card__stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.session-card__visitors {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--color-text-light);
}

/* --- Stats Table --- */
.stats-section {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-border-light);
}

.stats-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.stats-toolbar__title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
}

.stats-filter {
  padding: 6px 12px;
  font-size: 0.85rem;
  font-family: var(--font-family);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  background: white;
  color: var(--color-text);
  outline: none;
}

.stats-filter:focus {
  border-color: var(--color-accent);
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.stats-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--color-text-light);
  border-bottom: 2px solid var(--color-border-light);
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.stats-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(212, 165, 116, 0.15);
  vertical-align: top;
}

.stats-table tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.stats-table tbody tr:hover {
  background: rgba(212, 165, 116, 0.08);
}

.stats-table .class-row--expanded {
  background: rgba(212, 165, 116, 0.06);
}

/* Progress bar */
.progress {
  height: 6px;
  background: var(--color-border-light);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 4px;
}

.progress__bar {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), #43A047);
  border-radius: 3px;
  transition: width var(--transition-normal);
}

/* Detail rows */
.detail-rows {
  display: none;
}

.detail-rows--open {
  display: table-row-group;
}

.detail-row {
  background: rgba(245, 230, 208, 0.3);
  font-size: 0.8rem;
}

.detail-row td {
  padding: 6px 12px 6px 28px;
  color: var(--color-text-light);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 500;
}

.badge--checked {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge--pending {
  background: rgba(212, 165, 116, 0.2);
  color: var(--color-text-muted);
}

/* Auto-refresh indicator */
.refresh-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  animation: pulse 2s infinite;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .admin-container {
    padding: 16px 12px 32px;
  }

  .session-cards {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .session-card {
    padding: 14px;
  }

  .stats-table {
    font-size: 0.78rem;
  }

  .stats-table th,
  .stats-table td {
    padding: 8px 6px;
  }

  .stats-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 380px) {
  .container {
    padding: 16px 14px 32px;
  }

  .card {
    padding: 20px 16px;
  }

  .header__title {
    font-size: 1.4rem;
  }
}
