/* ── Logo ── */
.site-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.site-logo-text {
  font-size: 18px;
  font-weight: 700;
  color: #2D1B4E;
  letter-spacing: -0.02em;
}

.site-logo-spain {
  color: #c2410c;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.5;
  background: #FAF7F2;
  color: #1E1228;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ── Header ── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.back-link {
  font-size: 16px;
  color: #5C3D9E;
  text-decoration: none;
  font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

.header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: #4a5568;
  transition: background 0.15s;
}
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: #EDE5F5; }
.btn-danger { color: #e53e3e; }
.btn-danger:hover { background: #fff5f5; }

/* ── Checklist title ── */
.checklist-title {
  font-size: 28px;
  font-weight: 700;
  color: #2D1B4E;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.checklist-meta {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 20px;
}

.tab-description {
  font-size: 15px;
  color: #6b7280;
  margin-bottom: 16px;
}

.checklist-resource-link {
  color: #5C3D9E;
  text-decoration: underline;
}

/* ── Item list ── */
.item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.item-card {
  background: #FFFCF8;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(92, 61, 158, 0.08);
  transition: opacity 0.2s;
  overflow: hidden;
  border-left: 4px solid #d1d5db;
}

.item-card.item-status-done { border-left-color: #16a34a; }
.item-card.item-status-due  { border-left-color: #d97706; }

.checklist-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.checklist-progress-label {
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
}

.checklist-progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.checklist-progress-fill {
  height: 100%;
  background: #16a34a;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.item-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
}

.item-done {
  opacity: 0.55;
}

/* ── Checkbox button ── */
.checkbox-btn {
  background: none;
  border: none;
  padding: 2px;
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}
/* override Rails button_to form wrapper */
.checkbox-btn form, form.checkbox-btn {
  display: inline;
}

.checkbox {
  display: block;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid #D4C9E2;
  background: #FFFCF8;
  transition: background 0.15s, border-color 0.15s;
  position: relative;
}

.checkbox.checked {
  background: #c2410c;
  border-color: #c2410c;
}

.checkbox.checked::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 3px;
  width: 7px;
  height: 13px;
  border: 2.5px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Item body ── */
.item-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.item-name {
  font-size: 18px;
  font-weight: 500;
  color: #1E1228;
  word-break: break-word;
}

.item-done .item-name {
  text-decoration: line-through;
  color: #9ca3af;
}

.item-progress {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: #5C3D9E;
  background: #EDE5F5;
  border-radius: 999px;
  padding: 2px 10px;
  letter-spacing: 0.02em;
}

.item-description {
  font-size: 15px;
  color: #4b5563;
  line-height: 1.5;
  word-break: break-word;
}

.item-description p {
  margin-bottom: 6px;
}
.item-description p:last-child { margin-bottom: 0; }

.item-meta {
  font-size: 14px;
  color: #6b7280;
}

.item-completed-on {
  color: #c2410c;
}

/* ── Per-item actions ── */
.item-actions {
  display: none;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}

.edit-mode .item-actions {
  display: flex;
}

.item-action-link {
  font-size: 14px;
  color: #9ca3af;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 0;
  font-family: inherit;
}
.item-action-link:hover { color: #5C3D9E; }
.item-action-delete:hover { color: #e53e3e; }

/* ── Add item button ── */
.add-item-btn {
  display: block;
  width: 100%;
  padding: 16px;
  text-align: center;
  background: #FFFCF8;
  border: 2px dashed #c2410c;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  color: #c2410c;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.add-item-btn:hover {
  background: #FEF0EB;
  border-color: #9a3412;
  color: #9a3412;
}

/* ── Inline edit ── */
.item-editing {
  padding: 16px;
}

.task-row.task-editing {
  padding: 12px;
  background: #FFFCF8;
  border-radius: 8px;
}

.inline-edit-form {
  width: 100%;
}

.inline-edit-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.inline-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.inline-label {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inline-input {
  font-size: 17px;
  font-family: inherit;
  padding: 10px 12px;
  border: 1.5px solid #D4C9E2;
  border-radius: 8px;
  background: #FAF7F2;
  color: #1E1228;
  width: 100%;
  transition: border-color 0.15s;
}
.inline-input:focus {
  outline: none;
  border-color: #c2410c;
  background: #FFFCF8;
}

.inline-edit-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

.btn-save {
  padding: 10px 20px;
  background: #5C3D9E;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-save:hover { background: #4A2F85; }

.btn-cancel {
  font-size: 16px;
  color: #9ca3af;
  text-decoration: none;
}
.btn-cancel:hover { color: #4b5563; }

.inline-field-note {
  font-size: 13px;
  color: #9ca3af;
  font-style: italic;
}

.inline-errors {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  padding: 10px 14px;
  color: #c53030;
  font-size: 15px;
}

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 2px solid #EDE5F5;
  padding-bottom: 0;
}

.tab-link {
  padding: 8px 20px;
  font-size: 16px;
  font-weight: 500;
  color: #9ca3af;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.tab-link:hover { color: #5C3D9E; }

.tab-active {
  color: #5C3D9E;
  border-bottom-color: #5C3D9E;
}

/* ── Start Here ── */
.start-here { max-width: 640px; }
.start-here p { margin-bottom: 16px; line-height: 1.5; color: #374151; }
.start-here ol { padding-left: 20px; }
.start-here li { margin-bottom: 10px; line-height: 1.5; color: #374151; }
.start-here a { color: #5C3D9E; text-decoration: underline; }

.whats-next-card {
  background: #FFFCF8;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(92, 61, 158, 0.08);
  padding: 20px;
  margin-bottom: 24px;
}

.whats-next-heading {
  font-size: 18px;
  font-weight: 600;
  color: #2D1B4E;
  margin-bottom: 12px;
}

.whats-next-intro {
  font-size: 15px;
  color: #4b5563;
  margin-bottom: 14px;
  line-height: 1.5;
}

.whats-next-empty {
  font-size: 15px;
  color: #9ca3af;
}

.start-here { max-width: 640px; }
.start-here h2 { font-size: 22px; font-weight: 600; margin-bottom: 12px; }
.start-here p { margin-bottom: 16px; line-height: 1.5; color: #374151; }
.start-here ol { padding-left: 20px; }
.start-here li { margin-bottom: 10px; line-height: 1.5; color: #374151; }
.start-here a { color: #5C3D9E; text-decoration: underline; }

/* ── Calendar ── */
.calendar { width: 100%; }

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-month-label {
  font-size: 18px;
  font-weight: 600;
  color: #2D1B4E;
}

.cal-nav-btn {
  font-size: 20px;
  color: #5C3D9E;
  text-decoration: none;
  padding: 4px 10px;
  border-radius: 8px;
  transition: background 0.15s;
}
.cal-nav-btn:hover { background: #EDE5F5; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-header {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  padding: 4px 0 8px;
}

.cal-cell {
  min-height: 80px;
  background: #FFFCF8;
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(92, 61, 158, 0.06);
}

.cal-empty {
  background: transparent;
  box-shadow: none;
}

.cal-today {
  background: #EDE5F5;
}

.cal-date-num {
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  align-self: flex-end;
}

.cal-today .cal-date-num {
  color: #5C3D9E;
}

.cal-item {
  font-size: 12px;
  background: #c2410c;
  color: #fff;
  border-radius: 4px;
  padding: 2px 5px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cal-item-done {
  background: #d1d5db;
  color: #6b7280;
}


/* ── Location picker ── */
.location-heading {
  font-size: 26px;
  font-weight: 700;
  color: #2D1B4E;
  margin-bottom: 28px;
  text-align: center;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.country-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  background: #FFFCF8;
  border: 2px solid #E8E0F4;
  border-radius: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  font-family: inherit;
  position: relative;
}

.country-card:hover {
  border-color: #5C3D9E;
  background: #F3EEF9;
}

.country-card.active {
  border-color: #5C3D9E;
  background: #EDE5F5;
  box-shadow: 0 0 0 3px rgba(92, 61, 158, 0.15);
}

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

.country-card--disabled:hover {
  border-color: #E8E0F4;
  background: #FFFCF8;
}

.country-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  background: #1E1228;
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  padding: 7px 12px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

.country-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #1E1228;
}

.country-card--disabled:hover .country-tooltip {
  display: block;
}

.country-flag {
  font-size: 40px;
  line-height: 1;
}

.country-name {
  font-size: 15px;
  font-weight: 600;
  color: #2D1B4E;
}

.city-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease;
}

.city-list.visible {
  max-height: 600px;
  opacity: 1;
}

.city-btn {
  width: 100%;
  padding: 14px 20px;
  background: #FFFCF8;
  border: 1.5px solid #E8E0F4;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 500;
  color: #2D1B4E;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.city-btn:hover {
  border-color: #5C3D9E;
  background: #F3EEF9;
}

.city-btn.active {
  border-color: #5C3D9E;
  background: #EDE5F5;
  font-weight: 600;
}

.people-section {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.3s ease;
}

.people-section.visible {
  max-height: 400px;
  opacity: 1;
}

.people-heading {
  font-size: 20px;
  font-weight: 600;
  color: #2D1B4E;
  margin: 8px 0 12px;
}

.people-select {
  width: 100%;
  padding: 14px 20px;
  background: #FFFCF8;
  border: 1.5px solid #E8E0F4;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 500;
  color: #2D1B4E;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.people-select:hover,
.people-select:focus {
  border-color: #5C3D9E;
  background: #F3EEF9;
  outline: none;
}

.btn-primary {
  background: #5C3D9E;
  color: #fff;
  padding: 14px 32px;
  font-size: 17px;
  border-radius: 12px;
}

.btn-primary:hover:not(:disabled) { background: #4a2f85; }

.start-btn {
  display: block;
  width: 100%;
  margin-top: 20px;
  transition: opacity 0.2s, background 0.15s;
}

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

/* ── Tasks (subtasks of items) ── */
.task-disclosure {
  border-top: 1px solid #F0EAF8;
  background: #FBF8F3;
}

.task-disclosure[open] {
  background: #FBF8F3;
}

.task-disclosure-summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 16px 10px 56px;
  font-size: 13px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
  position: relative;
  transition: color 0.15s;
}
.task-disclosure-summary::-webkit-details-marker { display: none; }

.task-disclosure-summary:hover { color: #5C3D9E; }

.task-disclosure-summary::before {
  content: "";
  position: absolute;
  left: 36px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-75%) rotate(-45deg);
  transition: transform 0.15s;
}

.task-disclosure[open] .task-disclosure-summary::before {
  transform: translateY(-25%) rotate(45deg);
}

.task-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 12px 56px;
}

.task-list:empty { padding-bottom: 0; }

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: #FFFCF8;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(92, 61, 158, 0.05);
  transition: opacity 0.2s;
  border-left: 3px solid #d1d5db;
}

.task-row.task-status-done { border-left-color: #16a34a; }
.task-row.task-status-due  { border-left-color: #d97706; }

.task-done {
  opacity: 0.55;
}

.task-row .checkbox {
  width: 20px;
  height: 20px;
  border-width: 2px;
  margin-top: 1px;
}
.task-row .checkbox.checked::after {
  left: 5px;
  top: 2px;
  width: 5px;
  height: 10px;
  border-width: 2px;
}

.task-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.task-name {
  font-size: 15px;
  font-weight: 600;
  color: #1E1228;
  word-break: break-word;
}

.task-done .task-name {
  text-decoration: line-through;
  color: #9ca3af;
}

.task-description {
  font-size: 13px;
  color: #4b5563;
  line-height: 1.5;
  word-break: break-word;
}

.task-description p {
  margin-bottom: 4px;
}
.task-description p:last-child { margin-bottom: 0; }

.nlv-intro p { margin-bottom: 10px; }
.nlv-intro p:last-child { margin-bottom: 0; }

.task-meta {
  font-size: 13px;
  color: #6b7280;
}

.task-actions {
  display: none;
  gap: 4px;
  flex-shrink: 0;
  align-items: center;
}

.edit-mode .task-actions {
  display: flex;
}

.add-task-btn {
  display: none;
  margin-left: 56px;
  margin-bottom: 12px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #5C3D9E;
  background: transparent;
  border: 1px dashed #C5B4DD;
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.add-task-btn:hover {
  background: #EDE5F5;
  border-color: #5C3D9E;
}

.edit-mode .add-task-btn {
  display: inline-block;
}

/* ── Edit mode toolbar ── */
.list-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 8px;
  position: sticky;
  top: 0;
  background: #FAF7F2;
  padding: 8px 0;
  z-index: 10;
}

.edit-mode-btn {
  font-size: 14px;
  font-weight: 500;
  color: #5C3D9E;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 0;
}
.edit-mode-btn:hover { text-decoration: underline; }

/* ── Collapsible task list ── */
[data-controller="task-list"] .item-title-row {
  cursor: pointer;
}

.task-list-collapse {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s ease;
}

.tasks-open .task-list-collapse {
  grid-template-rows: 1fr;
}

.task-list-inner {
  min-height: 0;
  overflow: hidden;
}

[data-controller="task-list"] .new-task-frame {
  display: none;
}

[data-controller="task-list"].tasks-open .new-task-frame {
  display: block;
}

/* ── Completed filter (Step-by-step Guide) ── */
[data-controller~="completed-filter"] turbo-frame:has(.task-done) {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}
[data-controller~="completed-filter"].show-completed turbo-frame:has(.task-done) {
  max-height: 200px;
  opacity: 1;
}

/* ── Step-by-step Guide tab ── */
.guide-task-list {
  padding: 0;
  margin-bottom: 20px;
}

/* ── Mobile tweaks ── */
@media (max-width: 480px) {
  body { font-size: 17px; }
  .checklist-title { font-size: 24px; }
  .item-row { padding: 14px 12px; }
  .page { padding: 16px 12px 40px; }
  .country-grid { grid-template-columns: repeat(2, 1fr); }
  .country-flag { font-size: 32px; }
  .task-disclosure-summary { padding-left: 44px; }
  .task-disclosure-summary::before { left: 24px; }
  .task-list { padding-left: 44px; }
  .edit-mode .add-task-btn { margin-left: 44px; }
}
