/* ── Scoped Reset ── */
#walkin-widget *, #walkin-widget *::before, #walkin-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Ensure hidden attribute works even if host page CSS overrides it */
#walkin-widget [hidden] {
  display: none !important;
}

/* ── Widget Container ── */
#walkin-widget {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: #1a1a2e;
  -webkit-text-size-adjust: 100%;
}

/* ── Step Transitions ── */
#walkin-widget .step {
  animation: walkinFadeIn 0.2s ease;
}

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

/* ── Step Header ── */
#walkin-widget .step-header {
  position: relative;
  text-align: center;
  margin-bottom: 1.75rem;
}

#walkin-widget .btn-lock {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  color: #64748b;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

#walkin-widget .btn-lock:hover {
  background: #f1f5f9;
  color: #334155;
}

#walkin-widget .location-name {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563eb;
  margin-bottom: 0.4rem;
}

#walkin-widget .step-header h1 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #0a2342;
  margin-bottom: 0.4rem;
  line-height: 1.2;
}

#walkin-widget .step-subtitle {
  font-size: 1.05rem;
  color: #555;
}

/* ── Section Cards ── */
#walkin-widget .section-card {
  background: #fff;
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
}

#walkin-widget .section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0a2342;
  margin-bottom: 1.25rem;
  padding-bottom: 0.65rem;
  border-bottom: 2px solid #e8ecf0;
}

/* ── Form Layout ── */
#walkin-widget .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

#walkin-widget .form-row:last-child {
  margin-bottom: 0;
}

#walkin-widget .form-row--three {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 600px) {
  #walkin-widget .form-row,
  #walkin-widget .form-row--three {
    grid-template-columns: 1fr;
  }
}

#walkin-widget .form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

#walkin-widget label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #333;
}

#walkin-widget .required {
  color: #c0392b;
}

/* ── Inputs ── */
#walkin-widget input[type="text"],
#walkin-widget input[type="email"],
#walkin-widget input[type="tel"],
#walkin-widget input[type="date"],
#walkin-widget select {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  border: 2px solid #d1d9e0;
  border-radius: 10px;
  background: #fafbfc;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
  min-height: 54px;
  font-family: inherit;
}

#walkin-widget input:focus,
#walkin-widget select:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── Children Cards ── */
#walkin-widget .child-card {
  background: #f7f9fc;
  border: 1.5px solid #d1d9e0;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

#walkin-widget .child-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}

#walkin-widget .child-label {
  font-weight: 700;
  font-size: 1rem;
  color: #0a2342;
}

#walkin-widget .remove-child-btn {
  background: none;
  border: 1.5px solid #c0392b;
  color: #c0392b;
  border-radius: 8px;
  padding: 0.3rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  font-family: inherit;
  transition: background 0.15s;
}

#walkin-widget .remove-child-btn:hover {
  background: #fdf0ee;
}

/* ── Attribute Expand/Collapse ── */
#walkin-widget .attr-expand-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
  background: none;
  border: 1.5px dashed #b0bec5;
  border-radius: 8px;
  padding: 0.55rem 0.9rem;
  margin-top: 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}

#walkin-widget .attr-expand-btn:hover {
  border-color: #2563eb;
  color: #2563eb;
  background: #f8faff;
}

#walkin-widget .attr-expand-btn.open {
  border-color: #2563eb;
  color: #2563eb;
  border-style: solid;
  background: #f0f6ff;
}

#walkin-widget .attr-expand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
}

#walkin-widget .attr-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease, margin-top 0.3s ease;
  margin-top: 0;
}

#walkin-widget .attr-panel.open {
  max-height: 600px;
  opacity: 1;
  margin-top: 0.6rem;
}

/* ── Child Attribute Icons ── */
#walkin-widget .attr-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.4rem;
}

#walkin-widget .attr-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: #fff;
  border: 1.5px solid #d1d9e0;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: #555;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  font-family: inherit;
  min-height: 36px;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

#walkin-widget .attr-toggle:hover {
  border-color: #2563eb;
  background: #f0f6ff;
}

#walkin-widget .attr-toggle.active {
  border-color: #2563eb;
  background: #dbeafe;
  color: #1d4ed8;
}

#walkin-widget .attr-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

#walkin-widget .attr-notes-wrap {
  grid-column: 1 / -1;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease, margin-top 0.25s ease;
  margin-top: 0;
}

#walkin-widget .attr-notes-wrap.open {
  max-height: 80px;
  margin-top: 0.25rem;
}

#walkin-widget .attr-notes {
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  border: 2px solid #d1d9e0;
  border-radius: 10px;
  background: #fff;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  resize: none;
  min-height: 48px;
}

#walkin-widget .attr-notes:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* ── Buttons ── */
#walkin-widget .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  min-height: 54px;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  text-decoration: none;
}

#walkin-widget .btn--primary {
  background: #2563eb;
  color: #fff;
}

#walkin-widget .btn--primary:hover:not(:disabled) {
  background: #1d4ed8;
}

#walkin-widget .btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#walkin-widget .btn--secondary {
  background: #fff;
  color: #2563eb;
  border: 2px solid #2563eb;
}

#walkin-widget .btn--secondary:hover:not(:disabled) {
  background: #eff6ff;
}

#walkin-widget .btn--secondary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#walkin-widget .btn--large {
  width: 100%;
  font-size: 1.15rem;
  min-height: 60px;
}

#walkin-widget .btn--add {
  width: 100%;
  border: 2px dashed #2563eb;
  background: #f0f6ff;
  color: #2563eb;
  margin-top: 0.25rem;
}

#walkin-widget .btn--add:hover:not(:disabled) {
  background: #dbeafe;
}

#walkin-widget .btn--add:disabled {
  border-color: #9ca3af;
  color: #9ca3af;
  background: #f9fafb;
  cursor: not-allowed;
}

/* ── Form Actions ── */
#walkin-widget .form-actions {
  margin-top: 1.5rem;
}

/* ── Error Messages ── */
#walkin-widget .error-msg {
  background: #fef2f2;
  border: 1.5px solid #fca5a5;
  color: #b91c1c;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 1rem;
}

/* ── Screen Reader Only ── */
#walkin-widget .sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ── Thank You ── */
#walkin-widget .thankyou-card {
  background: #fff;
  border-radius: 18px;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
  margin-top: 2rem;
}

#walkin-widget .thankyou-icon {
  width: 76px;
  height: 76px;
  background: #16a34a;
  color: #fff;
  font-size: 2.2rem;
  font-weight: 900;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
}

#walkin-widget .thankyou-card h1 {
  font-size: 2.1rem;
  font-weight: 800;
  color: #0a2342;
  margin-bottom: 0.85rem;
}

#walkin-widget .thankyou-message {
  font-size: 1.1rem;
  color: #333;
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

#walkin-widget .thankyou-reset {
  font-size: 0.95rem;
  color: #777;
  margin-bottom: 1.75rem;
}

#walkin-widget #countdown {
  font-weight: 700;
  color: #2563eb;
}
