/**
 * Ticket Page CSS
 * Mobile-first design optimized for outdoor visibility
 */

:root {
  --brand: #f10000;
  --brand-dark: #cc0000;
  --text: #111;
  --text-muted: #666;
  --bg: #ffffff;
  --bg-light: #f8f9fa;
  --border: #e0e0e0;
  --shadow: rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.ticket-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
}

/* Header with Logo and Language Selector */
.ticket-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0 1.5rem;
  width: 100%;
}

.logo-container {
  background: white;
  padding: 0.75rem 1.25rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.logo-container a {
  display: block;
  line-height: 0;
}

.logo-container img {
  height: 45px;
  width: auto;
}

/* Language Selector */
.language-selector {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem;
  max-width: 100%;
}

.lang-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.lang-btn:hover {
  background: var(--bg-light);
  color: var(--text);
}

.lang-btn.active {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}

/* Sections */
.ticket-section {
  width: 100%;
  text-align: center;
}

.ticket-section h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.ticket-section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.ticket-subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.4;
}

/* Form */
.ticket-form {
  width: 100%;
}

.input-group {
  margin-bottom: 1rem;
  text-align: left;
}

.input-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.input-group input {
  width: 100%;
  padding: 1rem;
  font-size: 1.125rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 0.5px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  text-transform: uppercase;
}

.input-group input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(241, 0, 0, 0.1);
}

.input-group input::placeholder {
  color: #aaa;
  text-transform: none;
}

/* Buttons */
.ticket-btn {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  text-align: center;
}

.ticket-btn-primary {
  background: linear-gradient(135deg, var(--brand) 0%, #ff3333 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(241, 0, 0, 0.25);
}

.ticket-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(241, 0, 0, 0.35);
}

.ticket-btn-primary:active {
  transform: translateY(0);
}

.ticket-btn-secondary {
  background: var(--bg-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.ticket-btn-secondary:hover {
  background: #eee;
}

/* Helper text */
.ticket-helper {
  margin-top: 1.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

/* QR Code */
.qr-container {
  background: white;
  padding: 1rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 1.5rem;
  display: inline-block;
}

.qr-code {
  width: 280px;
  height: 280px;
  display: block;
}

/* Booking Reference Display */
.booking-ref-container {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.booking-ref-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.booking-ref-value {
  display: block;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'SF Mono', 'Fira Code', monospace;
  color: var(--text);
  letter-spacing: 0.5px;
  word-break: break-all;
}

/* Ticket Details */
.ticket-details {
  background: var(--bg-light);
  border-radius: 12px;
  padding: 0.5rem;
  margin-bottom: 1.5rem;
}

.detail-row {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

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

.detail-icon {
  font-size: 1.25rem;
  margin-right: 0.75rem;
  flex-shrink: 0;
}

.detail-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  width: 80px;
}

.detail-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  text-align: right;
}

/* Instruction */
.ticket-instruction {
  background: #e8f5e9;
  color: #2e7d32;
  padding: 1rem;
  border-radius: 12px;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.instruction-icon {
  font-size: 1.25rem;
}

/* Error View */
.error-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.error-message {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 1.5rem;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

.loading-overlay p {
  color: var(--text-muted);
  font-size: 1rem;
}

/* Responsive adjustments */
@media (min-width: 480px) {
  .ticket-container {
    padding: 2rem 1.5rem;
  }

  .ticket-header {
    padding: 1rem 0 2rem;
  }

  .logo-container img {
    height: 50px;
  }

  .ticket-section h1 {
    font-size: 2rem;
  }

  .input-group input {
    font-size: 1.25rem;
  }
}

/* High contrast for outdoor visibility */
@media (prefers-contrast: more) {
  :root {
    --border: #999;
    --text-muted: #444;
  }

  .input-group input {
    border-width: 3px;
  }

  .qr-container {
    box-shadow: 0 0 0 4px var(--text);
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a1a1a;
    --bg-light: #2a2a2a;
    --text: #f0f0f0;
    --text-muted: #999;
    --border: #444;
    --shadow: rgba(0, 0, 0, 0.3);
  }

  .logo-container {
    background: white;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
  }

  .input-group input {
    background: var(--bg-light);
    color: var(--text);
  }

  .qr-container {
    background: white;
  }

  .ticket-instruction {
    background: #1b3a1b;
    color: #81c784;
  }

  .loading-overlay {
    background: rgba(26, 26, 26, 0.95);
  }
}
