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

:root {
  /* HSL Color Palette - Teal/Medical Theme */
  --primary: 176 60% 38%;
  /* #269b90 Teal */
  --primary-dark: 176 70% 30%;
  --primary-light: 176 60% 92%;

  --secondary: 215 25% 27%;
  /* Slate Gray */

  --bg-page: 210 20% 98%;
  /* Light grayish blue */
  --bg-card: 0 0% 100%;

  --text-main: 217 33% 17%;
  --text-muted: 215 16% 47%;

  --danger: 0 84% 60%;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --radius-md: 0.75rem;
  --radius-lg: 1rem;

  /* Ticket Distinct Theme (Indigo/Violet) */
  --ticket-theme: 250 84% 54%;
  --ticket-theme-dark: 250 84% 45%;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: hsl(var(--bg-page));
  color: hsl(var(--text-main));
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 0;
  /* Remove default padding for mobile */
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0.75rem 0.5rem;
  /* Container handles padding */
  min-height: 100vh;
  background-color: hsl(var(--bg-page));
  /* Ensure background matches */
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .card {
    border-radius: var(--radius-md);
    /* Slightly smaller radius on mobile */
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    /* Flatter look */
  }

  .token-number {
    font-size: 3rem;
    /* Adjust for smaller screens */
  }
}

/* Header & Brand */
.header {
  text-align: center;
  margin-bottom: 0.5rem;
}

.brand-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: hsl(var(--primary));
  margin-bottom: 0.15rem;
}

.brand-subtitle {
  font-size: 0.9rem;
  color: hsl(var(--text-muted));
}

/* Cards */
.card {
  background: hsl(var(--bg-card));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  margin-bottom: 0.5rem;
  transition: transform 0.2s ease;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.02);
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-2px);
  }
}

.card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: hsl(var(--secondary));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Typography Helpers */
.text-label {
  font-size: 0.85rem;
  font-weight: 500;
  color: hsl(var(--text-muted));
  margin-bottom: 0.25rem;
  display: block;
}

.text-value {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--text-main));
}

/* Forms */
.form-group {
  margin-bottom: 0.75rem;
}

input[type="date"],
input[type="text"],
input[type="tel"],
select,
.btn {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  font-family: inherit;
  font-size: 1rem;

  background-color: #fff;
  color: hsl(var(--text-main));
  height: 42px;
  /* Force consistent height */
  appearance: none;
  /* Remove default browser styling */
}

input[type="date"]:focus,
input[type="text"]:focus,
input[type="tel"]:focus,
select:focus {
  border-color: hsl(var(--primary));
  outline: none;
  box-shadow: 0 0 0 3px hsl(var(--primary) / 0.15);
}

/* Radio Slots */
.radio-group {
  display: flex;
  gap: 1rem;
}

.radio-option {
  flex: 1;
  position: relative;
}

.radio-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.radio-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  background-color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  height: 100%;
}

.radio-option input:checked+.radio-tile {
  background-color: hsl(var(--primary-light));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
  font-weight: 600;
}

.radio-option input:disabled+.radio-tile {
  background-color: #f1f5f9;
  border-color: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Live Token Display */
.live-token-card {
  text-align: left;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--primary-dark)));
  color: white;
  border: none;
  padding: 0.75rem;
  min-height: 100px;
}

/* ... existing code ... */

/* Halt Message Styling moved to bottom */

.live-token-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-token-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.live-token-info {
  text-align: left;
}

.token-number {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
  font-family: 'Outfit', sans-serif;
  min-width: 3ch;
  text-align: right;
  margin: 0;
}

.token-label {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Info List */
.info-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.info-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Reception Controls */
.control-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn-control {
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  color: white;
}

.btn-inc {
  background-color: hsl(var(--primary));
}

.btn-inc:hover {
  background-color: hsl(var(--primary-dark));
}

.btn-dec {
  background-color: hsl(var(--secondary));
}

.btn-dec:hover {
  background-color: #334155;
}

/* Slots List (Reception) */
.slots-container {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.slots-container::-webkit-scrollbar {
  width: 6px;
}

.slots-container::-webkit-scrollbar-track {
  background: #f1f5f9;
}

.slots-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.slot-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: hsl(var(--text-muted));
  margin: 1rem 0 0.5rem 0;
  padding-left: 0.5rem;
}

.slot-item {
  display: flex;
  align-items: center;
  padding: 0.75rem;
  background: #fff;
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  border: 1px solid #f1f5f9;
}

.slot-item.active {
  border-color: hsl(var(--primary));
  background-color: hsl(var(--primary-light));
}

.slot-token {
  background: hsl(var(--bg-page));
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  font-size: 0.9rem;
  color: hsl(var(--secondary));
  margin-right: 1rem;
}

.slot-name {
  font-weight: 500;
}

.slot-time {
  margin-left: auto;
  font-size: 0.8rem;
  color: hsl(var(--text-muted));
}

.message-success {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  padding: 0.75rem;
  border-radius: var(--radius-md);
}

/* Digital Ticket Styling */
.digital-ticket-card {
  background: white;
  border: 1px solid #e2e8f0;
  position: relative;
  overflow: hidden;
  animation: slideIn 0.4s ease-out;
}

.ticket-header {
  background: linear-gradient(135deg, hsl(var(--ticket-theme)), hsl(var(--ticket-theme-dark)));
  padding: 0.75rem;
  color: white;
  text-align: center;
  position: relative;
  margin: -1rem -1rem 1rem -1rem;
  /* Bleed to edges */
  border-bottom: 2px dashed rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
}

.ticket-brand {
  display: none;
  /* Hide brand if present in HTML, though removed */
}

.ticket-status {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  opacity: 0.9;
  background: rgba(255, 255, 255, 0.2);
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-weight: 600;
}

.ticket-body {
  text-align: center;
}

.ticket-row {
  margin-bottom: 0.5rem;
}

.ticket-token {
  font-size: 3.5rem;
  font-weight: 800;
  color: hsl(var(--ticket-theme-dark));
  line-height: 1;
  font-family: 'Outfit', sans-serif;
  margin-top: 0.5rem;
}

.ticket-divider {
  height: 1px;
  background: #e2e8f0;
  margin: 0.75rem 0;
  border-top: 2px dashed #cbd5e1;
  position: relative;
}

/* Cutout notches for ticket effect */
.ticket-divider::before,
.ticket-divider::after {
  content: '';
  position: absolute;
  top: -10px;
  width: 20px;
  height: 20px;
  background-color: hsl(var(--bg-page));
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  /* inner shadow */
}

.ticket-divider::before {
  left: -2rem;
  /* Pull outside padding */
}

.ticket-divider::after {
  right: -2rem;
}

.ticket-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  text-align: left;
  background: #f8fafc;
  padding: 0.75rem;
  border-radius: var(--radius-md);
}

.ticket-item {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.ticket-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.ticket-item .ticket-label {
  font-size: 0.85rem;
  color: hsl(var(--text-muted));
  font-weight: 500;
}

.ticket-item .ticket-value {
  font-weight: 600;
  color: hsl(var(--text-main));
}

.hidden {
  display: none !important;
}

.btn-secondary {
  background-color: white;
  border: 1px solid #cbd5e1;
  color: hsl(var(--text-muted));
}

.btn-secondary:hover {
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ticket-warning {
  font-size: 1rem;
  color: hsl(var(--ticket-theme-dark));
  /* Matches ticket theme */
  text-align: center;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

#btn-book-another {
  background-color: hsl(var(--primary));
  color: white;
  border: none;
  font-weight: 600;
}

#btn-book-another:hover {
  background-color: hsl(var(--primary) / 0.9);
}

/* Error Card Styling */
.error-card {
  text-align: center;
  padding: 2rem;
  animation: slideIn 0.4s ease-out;
  border: 1px solid #fecaca;
  background: #fef2f2;
}

.error-icon {
  color: #ef4444;
  margin-bottom: 1rem;
}

.error-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #991b1b;
  margin-bottom: 0.5rem;
}

.error-message {
  color: #7f1d1d;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.btn-error {
  background-color: #ef4444;
  color: white;
  border: none;
}


.btn-error:hover {
  background-color: #dc2626;
}




/* Halt Message Styling */
.halt-message {
  background-color: #fef2f2;
  /* red-50 */
  color: #b91c1c;
  /* red-700 */
  border: 1px solid #fecaca;
  /* red-200 */
  padding: 0.15rem;
  border-radius: var(--radius-md);
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  margin-top: 0;
  display: inline-block;
  animation: slideIn 0.3s ease-out;
}

/* Validation Styles */
.error-msg {
  color: #b91c1c;
  /* High contrast red */
  font-size: 0.85rem;
  margin-top: 0.25rem;
  display: none;
  font-weight: 600;
}

.error-msg.visible {
  display: block;
}

input.invalid {
  border-color: var(--danger) !important;
}

/* Custom Message */
.custom-message {
  background-color: #fee2e2;
  /* Light red background */
  color: #dc2626;
  /* Deep red text */
  padding: 0.25rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  text-align: center;
  font-weight: 600;
  font-size: 1rem;
  border: 1px solid #fecaca;
}

/* Feedback Card Styling */
.feedback-card {
  text-align: center;
  padding: 1.5rem;
}

.feedback-question {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: hsl(var(--secondary));
  margin-bottom: 1rem;
}

.feedback-actions {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 1rem;
}

.btn-icon {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: hsl(var(--text-muted));
}

.btn-icon:hover {
  transform: translateY(-2px) scale(1.05);
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-icon:active {
  transform: scale(0.95);
}

.btn-icon.active {
  background-color: hsl(var(--primary-light));
  border-color: hsl(var(--primary));
  color: hsl(var(--primary));
}

.review-section {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px dashed #e2e8f0;
  animation: slideIn 0.4s ease-out;
}

.review-text {
  font-weight: 500;
  color: hsl(var(--text-main));
  margin-bottom: 0.75rem;
}

.btn-review {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 150px;
}