/* travel.lobos.pm — Lobos Travel Dashboard
 * paleta + komponenty 1:1 z PLAN_PODROZY.html (źródło prawdy estetyki)
 * + nowe komponenty: search bar, comments inline, globalny form, online/offline indicator
 */

:root {
  /* Background / surfaces */
  --bg: #faf8f3;
  --surface: #ffffff;

  /* Text */
  --text: #1a1814;
  --text-muted: #6b665d;
  --text-soft: #9a958b;

  /* Borders */
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);

  /* Country palettes */
  --cn-bg: #faece7;
  --cn-fg: #993c1d;
  --cn-line: #d85a30;
  --tw-bg: #e1f5ee;
  --tw-fg: #085041;
  --tw-line: #1d9e75;
  --kr-bg: #eeedfe;
  --kr-fg: #3c3489;
  --kr-line: #7f77dd;
  --transit-bg: #f1efe8;
  --transit-fg: #5f5e5a;
  --transit-line: #b4b2a9;

  /* Brand accent */
  --accent: #b87333;

  /* User-input highlight (legacy) */
  --user-bg: #fff8e1;
  --user-fg: #7a5800;
  --user-line: #f0b400;

  /* Status colors */
  --ok-bg: #e1f5ee;
  --ok-fg: #085041;
  --warn-bg: #fff3d6;
  --warn-fg: #7a5800;
  --err-bg: #faece7;
  --err-fg: #993c1d;

  /* Radii */
  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;

  /* Z layers */
  --z-toast: 100;
  --z-modal: 200;

  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 20px 80px; }

/* ============== ONLINE / OFFLINE INDICATOR ============== */

.net-status {
  position: fixed;
  top: 12px;
  right: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: var(--z-toast);
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
.net-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok-fg);
}
.net-status.offline { color: var(--warn-fg); border-color: var(--user-line); }
.net-status.offline::before { background: var(--warn-fg); }
.net-status .queue-count {
  background: var(--accent);
  color: white;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  margin-left: 4px;
  display: none;
}
.net-status .queue-count.visible { display: inline-block; }

/* ============== HERO ============== */

.hero {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
}
.hero-eyebrow {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-soft);
  font-weight: 500;
  margin-bottom: 12px;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 48px);
  font-weight: 500;
  line-height: 1.1;
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}
.hero-flags { font-size: 16px; color: var(--text-muted); margin-bottom: 24px; }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 24px 32px;
  align-items: center;
}
.hero-meta-item { display: flex; flex-direction: column; gap: 2px; }
.hero-meta-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.hero-meta-value { font-size: 17px; font-weight: 500; }
.countdown {
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  display: inline-block;
  margin-top: 16px;
}

/* ============== SEARCH BAR ============== */

.search-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 4px 4px 18px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.search-bar::before {
  content: '🔍';
  opacity: 0.5;
  font-size: 14px;
}
.search-bar input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 12px 4px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  outline: none;
}
.search-bar input::placeholder { color: var(--text-soft); }
.search-bar .clear-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  display: none;
  align-items: center;
  justify-content: center;
}
.search-bar .clear-btn.visible { display: flex; }
.search-bar input:focus + .clear-btn { display: flex; }

.search-meta {
  font-size: 12px;
  color: var(--text-muted);
  padding: 0 4px 8px;
  display: none;
}
.search-meta.visible { display: block; }
.search-meta strong { color: var(--text); font-weight: 500; }

/* ============== STATS ============== */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 40px;
}
.stat-card {
  background: var(--surface);
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.stat-num { font-size: 28px; font-weight: 500; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ============== SECTION HEADERS ============== */

section.block { margin-bottom: 48px; }
.section-head { margin-bottom: 20px; }
.section-num {
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-bottom: 4px;
}
.section-title { font-size: 24px; font-weight: 500; letter-spacing: -0.01em; }

/* ============== TIMELINE ============== */

.timeline-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-dot { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot::before {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.legend-dot.cn::before { background: var(--cn-line); }
.legend-dot.tw::before { background: var(--tw-line); }
.legend-dot.kr::before { background: var(--kr-line); }
.legend-dot.tr::before { background: var(--transit-line); }
.timeline {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(40px, 1fr));
  gap: 6px;
}
.day-cell {
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 6px 4px;
  transition: transform 0.15s ease;
  text-decoration: none;
  position: relative;
}
.day-cell:hover { transform: translateY(-2px); }
.day-cell.cn { background: var(--cn-bg); color: var(--cn-fg); }
.day-cell.tw { background: var(--tw-bg); color: var(--tw-fg); }
.day-cell.kr { background: var(--kr-bg); color: var(--kr-fg); }
.day-cell.tr { background: var(--transit-bg); color: var(--transit-fg); }
.day-cell.has-comment::after {
  content: '●';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 7px;
  color: var(--accent);
}
.day-num { font-size: 14px; font-weight: 500; }
.day-mon { font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; opacity: 0.75; }

/* ============== FILTER ============== */

.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.filter-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: all 0.15s ease;
}
.filter-btn:hover { background: var(--surface); }
.filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ============== DAY CARDS ============== */

.itinerary { display: grid; gap: 14px; }
.day-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 22px 26px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--transit-line);
  scroll-margin-top: 20px;
  transition: opacity 0.15s ease;
}
.day-card.cn { border-left-color: var(--cn-line); }
.day-card.tw { border-left-color: var(--tw-line); }
.day-card.kr { border-left-color: var(--kr-line); }
.day-card.tr { border-left-color: var(--transit-line); }
.day-card.search-hidden { display: none; }

.day-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 10px;
}
.day-date { font-size: 14px; font-weight: 500; }
.day-dow {
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.day-city { font-size: 19px; font-weight: 500; margin-left: auto; }
.day-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tag {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.tag.cn { background: var(--cn-bg); color: var(--cn-fg); }
.tag.tw { background: var(--tw-bg); color: var(--tw-fg); }
.tag.kr { background: var(--kr-bg); color: var(--kr-fg); }
.tag.tr { background: var(--transit-bg); color: var(--transit-fg); }
.tag.special { background: #fff3d6; color: #7a5800; }

/* ============== HOURS ============== */

.hours { display: grid; gap: 4px; margin-top: 8px; }
.hour-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 14px;
  padding: 8px 0;
  align-items: baseline;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.hour-row:last-child { border-bottom: 0; }
.hour-time {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  font-variant-numeric: tabular-nums;
}
.hour-act { color: var(--text); line-height: 1.5; }

/* ============== INLINE COMMENTS PER DAY ============== */

.comments-toggle {
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
}
.comments-toggle:hover { color: var(--text); }

.comments-panel {
  display: none;
  margin-top: 14px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.comments-panel.open { display: block; }

.comment-form {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.comment-form .row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.comment-form select,
.comment-form input[type="text"],
.comment-form textarea {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.comment-form select { width: 130px; }
.comment-form textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
}
.comment-form input:focus,
.comment-form textarea:focus,
.comment-form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.comment-list { display: grid; gap: 8px; }
.comment-item {
  background: var(--user-bg);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--user-fg);
  line-height: 1.5;
  position: relative;
}
.comment-item::before {
  content: attr(data-prefix);
  font-weight: 500;
  margin-right: 6px;
}
.comment-item .meta {
  font-size: 10px;
  color: var(--text-soft);
  margin-top: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.comment-item.queued::after {
  content: '⏳ kolejka';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  color: var(--warn-fg);
  background: var(--warn-bg);
  padding: 2px 8px;
  border-radius: 999px;
}

/* ============== BUTTONS ============== */

.btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.danger { color: var(--cn-fg); border-color: rgba(153, 60, 29, 0.3); }
.btn.danger:hover { background: var(--cn-bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.small { padding: 5px 12px; font-size: 12px; }

/* ============== HOTELS ============== */

.hotels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.hotel-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
}
.hotel-card.cn { border-top: 3px solid var(--cn-line); }
.hotel-card.tw { border-top: 3px solid var(--tw-line); }
.hotel-card.kr { border-top: 3px solid var(--kr-line); }
.hotel-dates {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-soft);
}
.hotel-name { font-size: 17px; font-weight: 500; margin: 6px 0; line-height: 1.3; }
.hotel-loc { font-size: 13px; color: var(--text-muted); }
.hotel-room { font-size: 12px; color: var(--text-muted); margin-top: 8px; font-style: italic; }
.hotel-meta {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.hotel-price { font-size: 14px; font-weight: 500; }
.hotel-price small { color: var(--text-muted); font-weight: 400; font-size: 11px; }
.hotel-conf { font-size: 10px; color: var(--text-soft); font-family: monospace; }
.hotel-status {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 500;
  display: inline-block;
}
.status-paid { background: var(--ok-bg); color: var(--ok-fg); }
.status-pending { background: var(--warn-bg); color: var(--warn-fg); }

/* ============== FLIGHTS ============== */

.flights-table {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.flight-row {
  display: grid;
  grid-template-columns: 70px 1fr 110px 80px;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.flight-row:last-child { border-bottom: 0; }
.flight-date { font-size: 12px; font-weight: 500; }
.flight-route { font-size: 13px; }
.flight-route small {
  color: var(--text-muted);
  font-size: 11px;
  display: block;
  margin-top: 2px;
}
.flight-line { font-size: 11px; color: var(--text-muted); font-family: monospace; }
.flight-status { font-size: 10px; text-align: right; }
.flight-status.ok { color: var(--ok-fg); }
.flight-status.warn { color: var(--accent); }

/* ============== TRANSPORT / BUDGET / TASKS ============== */

.transport-table,
.budget-table {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}
.tr-row,
.bg-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px 90px;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  align-items: center;
}
.tr-row:last-child,
.bg-row:last-child { border-bottom: 0; }
.bg-row.total { background: var(--bg); font-weight: 500; }
.tr-date,
.bg-cat {
  font-size: 12px;
  color: var(--text-muted);
}
.bg-amount { text-align: right; font-variant-numeric: tabular-nums; }
.bg-status { font-size: 10px; text-align: center; }

.tasks-list { display: grid; gap: 10px; }
.task-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--transit-line);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}
.task-item.high { border-left-color: var(--cn-line); }
.task-item.med { border-left-color: var(--accent); }
.task-item.low { border-left-color: var(--tw-line); }
.task-prio { font-size: 18px; }
.task-due {
  font-size: 11px;
  color: var(--text-soft);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ============== GLOBAL IDEA FORM ============== */

.global-form {
  background: linear-gradient(135deg, var(--surface) 0%, var(--bg) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 32px;
  margin-bottom: 32px;
}
.global-form h3 {
  font-size: 20px;
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.global-form p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.global-form .form-grid { display: grid; gap: 12px; }
.global-form .form-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.global-form select,
.global-form input,
.global-form textarea {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.global-form select { min-width: 130px; }
.global-form textarea {
  width: 100%;
  min-height: 100px;
  resize: vertical;
}
.global-form input:focus,
.global-form textarea:focus,
.global-form select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}
.global-form .submit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}
.global-form .form-status {
  font-size: 12px;
  color: var(--text-muted);
}
.global-form .form-status.success { color: var(--ok-fg); }
.global-form .form-status.error { color: var(--cn-fg); }

/* ============== PRACTICAL / CHEAT SHEET ============== */

.practical {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.practical-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  border: 1px solid var(--border);
}
.practical-title {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.practical-list {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}
.practical-list strong { color: var(--text); font-weight: 500; }
.practical-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  border-bottom: 1px dashed var(--border);
}
.practical-row:last-child { border-bottom: 0; }

/* ============== LINKS BAR ============== */

.links-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 24px;
}
.links-bar a {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.links-bar a:hover { text-decoration: underline; }

/* ============== FOOTER ============== */

footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-soft);
  margin-top: 60px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

/* ============== UTILITIES ============== */

.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: var(--z-toast);
  transition: transform 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: var(--ok-fg); }
.toast.error { background: var(--cn-fg); }

/* ============== RESPONSIVE ============== */

@media (max-width: 600px) {
  .wrap { padding: 24px 16px 60px; }
  .hero { padding: 32px 24px; }
  .flight-row { grid-template-columns: 60px 1fr; gap: 8px; }
  .flight-line, .flight-status {
    grid-column: 2;
    font-size: 11px;
  }
  .tr-row, .bg-row { grid-template-columns: 80px 1fr; gap: 4px 8px; padding: 10px 14px; }
  .tr-row > :nth-child(3),
  .tr-row > :nth-child(4),
  .bg-row > :nth-child(3),
  .bg-row > :nth-child(4) { grid-column: 2; font-size: 11px; }
  .hour-row { grid-template-columns: 50px 1fr; }
  .net-status {
    top: 8px;
    right: 8px;
    font-size: 11px;
    padding: 5px 10px;
  }
  .global-form { padding: 24px 18px; }
  .global-form .form-row { flex-direction: column; align-items: stretch; }
  .global-form select { width: 100%; }
}

@media (max-width: 400px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
}
