/* ==============================
   TRAVEL BY MK — Packing Checklist
   Teal / White theme matching TravelByMK.com
   ============================== */

:root {
  --teal:         #2abfab;
  --teal-dark:    #1a9e8c;
  --teal-deeper:  #167a6c;
  --teal-light:   #e8faf7;
  --white:        #ffffff;
  --bg:           #f4f6f5;
  --text:         #1a2e2b;
  --text-muted:   #5a7a74;
  --danger:       #c0392b;
  --border:       rgba(42,191,171,0.25);
  --border-light: #ddecea;
  --radius:       8px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Source Sans 3', Arial, sans-serif;
}

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

/* Screen-reader-only: present in the DOM for SEO/accessibility,
   but visually hidden. Used for the page's main <h1>. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- HEADER ---- */
header {
  background: var(--teal);
  border-bottom: 1px solid var(--teal-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--white);
  letter-spacing: 0.02em;
}
.tagline {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.75);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Header action buttons sit in a row with a small gap. */
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ---- BUTTONS ---- */
button {
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
  font-size: 0.85rem;
  border-radius: var(--radius);
  transition: all 0.15s ease;
}
.btn-outline {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: var(--white);
  padding: 7px 14px;
}
.btn-outline:hover {
  border-color: var(--white);
  background: rgba(255,255,255,0.15);
}
.btn-primary {
  background: var(--teal);
  color: var(--white);
  padding: 8px 20px;
  font-weight: 600;
}
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost {
  background: transparent;
  color: var(--teal-dark);
  border: 1px dashed var(--border);
  padding: 10px 20px;
  width: 100%;
  letter-spacing: 0.04em;
}
.btn-ghost:hover {
  border-color: var(--teal);
  background: var(--teal-light);
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 8px 20px;
  font-weight: 600;
}
.btn-danger:hover { background: #a93226; }

/* ---- PROGRESS ---- */
.progress-bar-wrap {
  max-width: 640px;
  margin: 20px auto 0;
  padding: 0 20px;
}
.progress-bar-track {
  background: var(--border-light);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--teal-dark), var(--teal));
  border-radius: 99px;
  width: 0%;
  transition: width 0.4s ease;
}
.progress-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 0.04em;
}

/* ---- MAIN ---- */
main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* ---- CATEGORY CARD ---- */
.category-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--teal-light);
}
.category-header:hover { background: #d4f3ee; }

.category-chevron {
  font-size: 0.7rem;
  color: var(--teal-dark);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.category-card.collapsed .category-chevron { transform: rotate(-90deg); }

.category-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--teal-deeper);
  flex: 1;
  letter-spacing: 0.02em;
}
.category-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 4px;
}
.category-edit-btn, .category-delete-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 4px 8px;
  border-radius: 4px;
  border: none;
}
.category-edit-btn:hover { color: var(--teal-dark); }
.category-delete-btn:hover { color: var(--danger); }

/* ---- ITEMS ---- */
.category-body {
  border-top: 1px solid var(--border-light);
  padding: 8px 0;
}
.category-card.collapsed .category-body { display: none; }

.item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 16px;
  transition: background 0.15s;
}
.item-row:hover { background: var(--teal-light); }

.item-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid var(--border-light);
  background: transparent;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  transition: all 0.15s;
}
.item-checkbox:checked {
  background: var(--teal);
  border-color: var(--teal);
}
.item-checkbox:checked::after {
  content: '✓';
  position: absolute;
  top: -1px;
  left: 3px;
  font-size: 13px;
  color: var(--white);
  font-weight: 700;
}

.item-label {
  flex: 1;
  font-size: 0.92rem;
  color: var(--text);
  transition: color 0.2s, text-decoration 0.2s;
}
.item-row.packed .item-label {
  color: var(--text-muted);
  text-decoration: line-through;
}

.item-edit-btn, .item-delete-btn {
  background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 3px 7px;
  border-radius: 4px;
  border: none;
  opacity: 0;
  transition: opacity 0.15s;
}
.item-row:hover .item-edit-btn,
.item-row:hover .item-delete-btn { opacity: 1; }
.item-edit-btn:hover { color: var(--teal-dark); }
.item-delete-btn:hover { color: var(--danger); }

/* Add item row */
.add-item-row {
  padding: 8px 16px;
  display: flex;
  gap: 8px;
}
.add-item-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 7px 12px;
  outline: none;
  transition: border-color 0.15s;
}
.add-item-input::placeholder { color: var(--text-muted); }
.add-item-input:focus { border-color: var(--teal); }
.add-item-btn {
  background: var(--teal);
  color: var(--white);
  padding: 7px 14px;
  font-weight: 700;
  border-radius: var(--radius);
  font-size: 1rem;
}
.add-item-btn:hover { background: var(--teal-dark); }

/* ---- ADD CATEGORY ---- */
.add-category-wrap {
  margin-top: 8px;
}

/* ---- SHARE NUDGE ---- */
.share-nudge {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 16px;
}
.share-nudge-link {
  background: none;
  border: none;
  color: var(--teal-dark);
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.share-nudge-link:hover { text-decoration: underline; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--teal-deeper);
  margin-bottom: 14px;
}
.modal-msg {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 18px;
}
.modal-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 9px 14px;
  margin-bottom: 16px;
  outline: none;
}
.modal-input:focus { border-color: var(--teal); }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* The header uses .btn-outline with white text on the teal bar. Inside a white
   modal that would be invisible, so re-skin outline buttons in modal context to
   the teal outline used elsewhere. Fixes the existing Cancel buttons too. */
.modal-box .btn-outline {
  color: var(--teal-dark);
  border-color: var(--border);
}
.modal-box .btn-outline:hover {
  border-color: var(--teal);
  background: var(--teal-light);
}

/* ---- TEMPLATE PICKER ---- */
.template-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
/* Each template is a tappable card: bold name over a one-line description. */
.template-option {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.template-option:hover {
  border-color: var(--teal);
  background: var(--teal-light);
}
.template-option-name {
  font-weight: 600;
  color: var(--teal-deeper);
  font-size: 0.95rem;
}
.template-option-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ---- FOOTER ---- */
footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 20px 30px;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
}
footer a { color: var(--teal-dark); text-decoration: none; }
footer a:hover { text-decoration: underline; }
.install-hint {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---- EMAIL CAPTURE (funnel) ---- */
.funnel-card {
  max-width: 640px;
  margin: 8px auto 0;
  padding: 22px 20px;
  background: var(--teal-light);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.funnel-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--teal-deeper);
  margin-bottom: 6px;
}
.funnel-text {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.funnel-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}
.funnel-input {
  flex: 1;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 9px 12px;
  outline: none;
}
.funnel-input:focus { border-color: var(--teal); }
.funnel-status { font-size: 0.82rem; margin-top: 10px; min-height: 1.1em; }
.funnel-status.success { color: var(--teal-deeper); }
.funnel-status.error { color: var(--danger); }
/* Honeypot lives in the DOM but off-screen. */
.funnel-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* ---- EMAIL GATE ---- */
/* Full-screen overlay shown to every visitor until they unlock the app with
   an email. Removed (display:none) once <html> gets the "tbmk-unlocked"
   class, set either by the early head script (returning visitors) or by the
   gate controller after a successful signup. */
.email-gate {
  position: fixed;
  inset: 0;
  z-index: 400; /* above the toast (300) and everything else */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--teal-light);
  overflow-y: auto;
}
.tbmk-unlocked .email-gate { display: none; }
/* Stop the app behind the gate from scrolling while the gate is up. */
html:not(.tbmk-unlocked) body { overflow: hidden; }

.email-gate-card {
  max-width: 460px;
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 26px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.10);
}
.email-gate-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 14px; }
.email-gate-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--teal-deeper);
  margin-bottom: 10px;
}
.email-gate-text {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}
/* Success-state buttons (shown after signup) stack full width. */
.email-gate-pdf,
.email-gate-open { display: block; width: 100%; margin-top: 10px; }

/* ---- TOAST ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  background: var(--teal-deeper);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 300;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- RESPONSIVE ---- */
@media (max-width: 480px) {
  .brand { font-size: 1rem; }
  .item-edit-btn, .item-delete-btn { opacity: 1; }
  .funnel-form { flex-direction: column; }
  /* Three header buttons can crowd a narrow phone: let them wrap and tighten
     padding so the logo keeps its space. */
  .header-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  .header-actions .btn-outline { padding: 6px 10px; font-size: 0.8rem; }
}
