/* ===== Noite portenha — design tokens ===== */
:root {
  color-scheme: dark;
  --bg: #16171b;
  --surface: #1f2127;
  --surface-2: #262932;
  --line: #343843;
  --text: #e9e6df;
  --text-dim: #9a97a0;
  --amber: #f2a33c;
  --amber-deep: #d97e1e;
  --danger: #e5636e;
  --cat-food: #ff9f5a;
  --cat-sightseeing: #4fd1a5;
  --cat-transport: #75aadb; /* celeste argentino */
  --cat-lodging: #b294e8;   /* jacarandá */
  --cat-other: #8b90a0;
  --radius: 10px;
  --shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 24px;
  line-height: 1.5;
}

h1, h2, h3 { color: var(--text); margin: 0 0 12px; }
h2 { font-size: 1.05rem; font-weight: 700; letter-spacing: 0.01em; }

/* ===== Header da viagem ===== */
.trip-header {
  max-width: 1200px;
  margin: 0 auto 28px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--amber);
}

.trip-title h1 {
  font-family: var(--font-display);
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 2px 0 0;
}
.trip-title h1 em { font-style: italic; }

/* Assinatura visual: divisor fileteado (filete porteño) */
.filete {
  height: 1px;
  margin-top: 10px;
  max-width: 340px;
  background: linear-gradient(90deg, transparent, var(--amber) 18%, var(--amber) 82%, transparent);
  position: relative;
}
.filete::after {
  content: "◆";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--amber);
  font-size: 9px;
  background: var(--bg);
  padding: 0 8px;
}

.trip-meta {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.trip-meta .form-group { margin: 0; }

.trip-stats {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 8px;
}
.stat { font-size: 0.85rem; color: var(--text-dim); }
.stat-amber { color: var(--amber); font-weight: 700; }

/* ===== Layout ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(300px, 1fr) 2fr;
  gap: 20px;
  align-items: start;
}

.left-col { display: flex; flex-direction: column; gap: 20px; }

.panel {
  background: var(--surface);
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ===== Formulários ===== */
.form-group { margin-bottom: 14px; }
label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
input, textarea, select {
  width: 100%;
  padding: 9px 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: 0.7; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 1px;
}

button {
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  transition: background-color 0.15s ease, transform 0.1s ease;
}
button:hover { transform: translateY(-1px); }

.btn-primary {
  background-color: var(--amber);
  color: #1a1204;
  padding: 10px 16px;
  width: 100%;
}
.btn-primary:hover { background-color: var(--amber-deep); }
.trip-meta .btn-primary { width: auto; }

.btn-small {
  padding: 6px 10px;
  font-size: 0.78rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.btn-small:hover { background: var(--line); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #1a0508; }

/* ===== Backlog ===== */
.backlog-list { max-height: 520px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }

.activity-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-other);
  padding: 12px;
  border-radius: 8px;
  cursor: grab;
}
.activity-card h4, .schedule-card h4 {
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
.activity-card p, .schedule-card p { margin: 3px 0; font-size: 0.82rem; color: var(--text-dim); }
.activity-card a, .schedule-card a { color: var(--amber); }

.activity-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.activity-actions input[type="date"] { flex: 1; min-width: 130px; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #15161a;
}
.cat-FOOD { background: var(--cat-food); }
.cat-SIGHTSEEING { background: var(--cat-sightseeing); }
.cat-TRANSPORT { background: var(--cat-transport); }
.cat-LODGING { background: var(--cat-lodging); }
.cat-OTHER { background: var(--cat-other); }
.status-IDEA { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.status-CONFIRMED { background: transparent; color: var(--cat-sightseeing); border: 1px solid var(--cat-sightseeing); }
.status-DONE { background: transparent; color: var(--text-dim); border: 1px solid var(--line); text-decoration: line-through; }

/* ===== Abas ===== */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}
.tab {
  background: none;
  color: var(--text-dim);
  padding: 10px 18px;
  font-weight: 600;
  border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); transform: none; }
.tab.active { color: var(--amber); border-bottom-color: var(--amber); }

/* ===== Programação (lista) ===== */
.day-section { margin-bottom: 22px; }

.day-header {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: capitalize;
  padding-bottom: 6px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.day-header.day-free { color: var(--text-dim); font-weight: 400; }

.free-note {
  margin: 0;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--text-dim);
}

.schedule-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-other);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.schedule-card .time {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--amber);
  margin-right: 8px;
}

/* Bordas por categoria — depois de .activity-card e .schedule-card para
   vencer o empate de especificidade na cascata (ordem no arquivo decide). */
.cat-border-FOOD { border-left-color: var(--cat-food); }
.cat-border-SIGHTSEEING { border-left-color: var(--cat-sightseeing); }
.cat-border-TRANSPORT { border-left-color: var(--cat-transport); }
.cat-border-LODGING { border-left-color: var(--cat-lodging); }
.cat-border-OTHER { border-left-color: var(--cat-other); }

.empty-note {
  color: var(--text-dim);
  text-align: center;
  padding: 28px 12px;
  font-style: italic;
}

/* ===== Calendário ===== */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.calendar-header h2 { margin: 0; font-family: var(--font-display); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.day-name {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 8px 0;
  color: var(--text-dim);
}
.calendar-cell {
  background: var(--surface-2);
  border: 1px solid var(--line);
  min-height: 110px;
  border-radius: 6px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.calendar-cell.empty { background: transparent; border: none; }
.calendar-cell.drag-over { border: 2px dashed var(--amber); background: #2a2416; }
.date-number { font-size: 0.78rem; font-weight: 700; text-align: right; color: var(--text-dim); }

.cal-activity {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cat-other);
  border-radius: 4px;
  padding: 5px 6px;
  font-size: 0.7rem;
}
.cal-activity strong { display: block; margin-bottom: 4px; }
.cal-activity .btn-small { padding: 2px 6px; font-size: 0.62rem; }

/* ===== Anexos ===== */
.attachment-list { list-style: none; padding: 0; margin: 6px 0 0; }
.attachment-list li {
  font-size: 0.78rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
}

/* ===== Responsivo ===== */
@media (max-width: 860px) {
  body { padding: 14px; }
  .container { grid-template-columns: 1fr; }
  .trip-header { flex-direction: column; align-items: stretch; }
  .trip-title h1 { font-size: 2rem; }
}

/* ===== Acessibilidade: movimento reduzido ===== */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  button:hover { transform: none; }
}

/* ===== Modal de detalhes ===== */
dialog#activityModal {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0;
  width: min(92vw, 520px);
  max-height: 85vh;
}
dialog#activityModal::backdrop { background: rgba(0, 0, 0, 0.6); }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }

#modalBody { padding: 14px 18px 18px; overflow-y: auto; }
#modalBody p { margin: 6px 0; font-size: 0.88rem; color: var(--text-dim); }
#modalBody a { color: var(--amber); }
.modal-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.modal-notes { white-space: pre-wrap; }
#modalBody .modal-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 12px;
  color: var(--text);
}

/* Cards clicáveis sinalizam interatividade */
.schedule-card { cursor: pointer; }
.schedule-card:hover { background: var(--line); }
.cal-activity { cursor: pointer; }

/* ===== Responsivo: telas pequenas (celular) ===== */
@media (max-width: 560px) {
  .trip-title h1 { font-size: 1.7rem; }
  .trip-meta { flex-direction: column; align-items: stretch; }
  .trip-meta .btn-primary { width: 100%; }
  .trip-stats { margin-left: 0; flex-direction: row; justify-content: space-between; flex-wrap: wrap; }
  .calendar-cell { min-height: 64px; padding: 4px; }
  .cal-activity { font-size: 0.6rem; }
  /* Em telas pequenas, as ações da atividade vivem no modal */
  .cal-activity .btn-small { display: none; }
  .calendar-header h2 { font-size: 0.95rem; }
  .activity-actions { flex-direction: column; align-items: stretch; }
  .activity-actions .btn-small { width: 100%; }
}
