/* ==========================================
   Vercel-inspired Design System
   简洁 · 专业 · 黑白分明
   ========================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg: #ffffff;
  --bg-secondary: #fafafa;
  --text-primary: #171717;
  --text-secondary: #4d4d4d;
  --text-tertiary: #808080;
  --border: rgba(0, 0, 0, 0.08);
  --border-light: #ebebeb;
  --accent: #171717;
  --accent-hover: #000000;
  --success: #0d7c3f;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --info: #0068d6;
  --info-bg: #ebf5ff;
  --focus: hsla(212, 100%, 48%, 1);

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, monospace;

  /* Shadows */
  --shadow-border: 0px 0px 0px 1px var(--border);
  --shadow-card: 0px 0px 0px 1px rgba(0,0,0,0.08), 0px 2px 2px rgba(0,0,0,0.04), 0px 8px 8px -8px rgba(0,0,0,0.04);
  --shadow-elevated: 0px 0px 0px 1px rgba(0,0,0,0.08), 0px 4px 12px rgba(0,0,0,0.08);
  --shadow-btn: 0px 0px 0px 1px rgba(0,0,0,0.08);

  /* Radii */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
}

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

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

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

/* ===== Layout ===== */
.app-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-header {
  background: var(--bg);
  border-bottom: var(--shadow-border);
  padding: 0 var(--space-6);
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.3px;
}

.app-header .logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
}

.app-header .nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: 14px;
  font-weight: 500;
}

.app-header .nav-links a {
  color: var(--text-secondary);
  transition: color 0.15s;
}

.app-header .nav-links a:hover {
  color: var(--text-primary);
}

.app-main {
  flex: 1;
  padding: var(--space-8) var(--space-6);
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
}

.app-main.wide {
  max-width: 960px;
}

/* ===== Card ===== */
.card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
  margin-bottom: var(--space-4);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

/* ===== Button ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 36px;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg);
  color: var(--text-primary);
  box-shadow: var(--shadow-btn);
}
.btn-secondary:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) {
  background: #b91c1c;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover {
  background: #f5f5f5;
  color: var(--text-primary);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 13px;
  min-height: 28px;
}

.btn-block { width: 100%; }

.btn-group {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ===== Form ===== */
.form-group {
  margin-bottom: var(--space-5);
}

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

.form-input {
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: 15px;
  color: var(--text-primary);
  background: var(--bg);
  box-shadow: var(--shadow-btn);
  transition: box-shadow 0.15s;
  appearance: none;
}

.form-input:focus {
  outline: none;
  box-shadow: 0px 0px 0px 2px var(--focus);
}

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

textarea.form-input {
  resize: vertical;
  min-height: 60px;
  line-height: 1.5;
}

.form-hint {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ===== Activity List ===== */
.activity-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.activity-item {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  cursor: pointer;
  transition: all 0.15s;
  border: 2px solid transparent;
}

.activity-item:hover {
  border-color: var(--border);
  box-shadow: var(--shadow-elevated);
}

.activity-item.selected {
  border-color: var(--accent);
  box-shadow: 0px 0px 0px 2px var(--accent);
}

.activity-item .name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.activity-item .desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.activity-item .meta {
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===== Status / Alert ===== */
.alert {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}

.alert-info { background: var(--info-bg); color: var(--info); }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }

/* ===== Spinner ===== */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ===== Toast ===== */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: white;
  box-shadow: var(--shadow-elevated);
  animation: toastIn 0.25s ease;
  max-width: 360px;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }
.toast-warning { background: var(--warning); }
.toast-info { background: var(--info); }

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

/* ===== Table ===== */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 500;
  color: var(--text-tertiary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: var(--shadow-border);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fafafa;
}

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

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

.badge-muted {
  background: #f5f5f5;
  color: var(--text-tertiary);
}

/* ===== Stats Grid ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.stat-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  text-align: center;
}

.stat-card .number {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

/* ===== Check-in Result ===== */
.result-display {
  text-align: center;
  padding: var(--space-8) 0;
}

.result-display .icon {
  font-size: 48px;
  margin-bottom: var(--space-4);
}

.result-display h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.5px;
  margin-bottom: var(--space-2);
}

.result-display .detail {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.8;
  margin-bottom: var(--space-6);
}

.result-display .detail strong {
  color: var(--text-primary);
}

/* ===== Map ===== */
.map-container {
  height: 360px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-btn);
  margin-bottom: var(--space-4);
}

.coord-display {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
}

/* ===== Login ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
  padding: var(--space-4);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: var(--space-8);
}

.login-card .logo {
  text-align: center;
  margin-bottom: var(--space-6);
}

.login-card .logo-icon {
  width: 44px;
  height: 44px;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  margin-bottom: var(--space-3);
}

.login-card .logo h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

.login-card .logo p {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-top: 4px;
}

.login-error {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: var(--space-4);
  display: none;
  padding: 8px 12px;
  background: var(--danger-bg);
  border-radius: var(--radius);
}

/* ===== Section Title ===== */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.section-title h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.5px;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-4);
  color: var(--text-tertiary);
}

.empty-state .icon {
  font-size: 36px;
  margin-bottom: var(--space-3);
}

.empty-state p {
  font-size: 15px;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .app-header {
    padding: 0 var(--space-4);
  }
  .app-main {
    padding: var(--space-4);
  }
  .card {
    padding: var(--space-4);
    border-radius: var(--radius);
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .map-container {
    height: 280px;
  }
  .login-card {
    padding: var(--space-6);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  .app-header .nav-links a span {
    display: none;
  }
}
