/* Kinda Camping — mobile-first UI with per-trip themes */

/* --- Campfire (default dark) --- */
:root,
[data-theme="campfire"] {
  --bg: #1a1d23;
  --bg-elevated: #252932;
  --bg-card: #2d323c;
  --text: #f0f2f5;
  --text-muted: #a0aec0;
  --accent: #e07a5f;
  --accent-hover: #f4a261;
  --accent-text: #1a1d23;
  --border: #3d4450;
  --success: #68d391;
  --error: #fc8181;
  --banner-bg: #3d2c29;
  --nav-bg: #252932;
  --input-bg: #1a1d23;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  --radius: 12px;
  --radius-sm: 8px;
  --header-h: 3.25rem;
  --nav-bottom-h: 4rem;
}

[data-theme="lakeside"] {
  --bg: #0f1a20;
  --bg-elevated: #162530;
  --bg-card: #1e3340;
  --text: #e8f4f8;
  --text-muted: #94b8c8;
  --accent: #2a9d8f;
  --accent-hover: #52b788;
  --accent-text: #0f1a20;
  --border: #2a4555;
  --banner-bg: #1a3540;
  --nav-bg: #162530;
  --input-bg: #0f1a20;
}

[data-theme="pine"] {
  --bg: #141c17;
  --bg-elevated: #1c2820;
  --bg-card: #243028;
  --text: #eef2eb;
  --text-muted: #a8b8a0;
  --accent: #40916c;
  --accent-hover: #52b788;
  --accent-text: #141c17;
  --border: #354535;
  --banner-bg: #1e3328;
  --nav-bg: #1c2820;
  --input-bg: #141c17;
}

[data-theme="desert"] {
  --bg: #1f1a16;
  --bg-elevated: #2a231c;
  --bg-card: #352c22;
  --text: #faf6f0;
  --text-muted: #c4b5a0;
  --accent: #e9c46a;
  --accent-hover: #f4a261;
  --accent-text: #1f1a16;
  --border: #4a4035;
  --banner-bg: #3d3020;
  --nav-bg: #2a231c;
  --input-bg: #1f1a16;
}

[data-theme="light"] {
  --bg: #f5f7fa;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --text: #1a202c;
  --text-muted: #718096;
  --accent: #3182ce;
  --accent-hover: #4299e1;
  --accent-text: #ffffff;
  --border: #e2e8f0;
  --banner-bg: #ebf4ff;
  --nav-bg: #ffffff;
  --input-bg: #ffffff;
  --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body.kc-app {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  padding: 0;
  padding-bottom: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom, 0px));
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: var(--header-h);
  padding: 0.5rem 1rem;
  padding-top: max(0.5rem, env(safe-area-inset-top));
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.header-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-link {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent) !important;
  white-space: nowrap;
}

.trip-name {
  font-size: 0.8rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: right;
  flex-shrink: 0;
}

.header-user a { font-size: 0.75rem; }

.plan-banner {
  background: var(--banner-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 1rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.plan-banner a { font-weight: 600; text-decoration: underline; }

.kc-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: 1.5rem;
}

/* Navigation — bottom bar (mobile) */
.trip-nav-bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  min-height: var(--nav-bottom-h);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--nav-bg);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.trip-nav-top { display: none; }

.trip-nav-link,
.nav-more-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 0.35rem 0.25rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.trip-nav-link.active,
.nav-more-btn.active {
  color: var(--accent);
}

.trip-nav-link.active .nav-icon,
.nav-more-btn.active .nav-icon {
  transform: scale(1.1);
}

.nav-icon {
  font-size: 1.35rem;
  line-height: 1.2;
  display: block;
}

.nav-label {
  margin-top: 0.15rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.nav-more-panel {
  position: fixed;
  bottom: calc(var(--nav-bottom-h) + env(safe-area-inset-bottom, 0px));
  left: 0;
  right: 0;
  z-index: 199;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.nav-more-link {
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}

/* Cards & sections */
.card, .section-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.card h2, .card h3, .section-block h2 {
  margin-bottom: 0.65rem;
  font-size: 1.1rem;
}

h1 { font-size: 1.35rem; margin-bottom: 0.75rem; }

/* Forms */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  margin-top: 0.75rem;
}

label:first-child { margin-top: 0; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="search"],
input[type="url"],
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 16px; /* prevents iOS zoom */
  font-family: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.25rem;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button,
.btn,
input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--accent-text);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:hover, .btn:hover { background: var(--accent-hover); }

.btn-secondary, button.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text);
  border: 1px solid var(--border);
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
  margin-top: 0.5rem;
}

.inline-form input { flex: 1; min-width: 120px; }

/* Tables — scroll on mobile */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.75rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  padding: 0.6rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; }

/* Theme picker */
.theme-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  margin: 0.75rem 0 1rem;
}

.theme-option {
  position: relative;
  cursor: pointer;
}

.theme-option input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.theme-swatch {
  display: block;
  padding: 0.85rem 0.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  transition: border-color 0.15s;
}

.theme-option input:checked + .theme-swatch {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.theme-dot {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  margin-bottom: 0.35rem;
}

.theme-label { font-weight: 600; font-size: 0.9rem; display: block; }
.theme-desc { font-size: 0.75rem; color: var(--text-muted); }

/* Misc */
.success { color: var(--success); }
.error { color: var(--error); }
.light-text, .text-muted { color: var(--text-muted); font-size: 0.9rem; }

.site-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.invite-url-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 1rem 0;
}

@media (min-width: 480px) {
  .invite-url-box { flex-direction: row; }
}

.invite-url-box input { flex: 1; margin: 0; }

.invite-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.qr-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.pricing-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.pricing-card .price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0.5rem 0;
}

/* Tour overlay */
.kc-tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  padding-bottom: calc(var(--nav-bottom-h) + 1rem);
}

.kc-tour-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 1.1rem;
  border-radius: var(--radius);
  max-width: 420px;
  width: 100%;
}

.kc-tour-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.kc-tour-highlight {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Login / join cards */
.invite-card, .card.login-card {
  max-width: 420px;
  margin: 1.5rem auto;
}

/* Desktop: top nav, no bottom bar */
@media (min-width: 768px) {
  body.kc-app {
    padding-bottom: 0;
  }

  .trip-nav-bottom,
  .nav-more-panel,
  .nav-more-btn {
    display: none !important;
  }

  .trip-nav-top {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem;
    margin-bottom: 1rem;
    background: var(--nav-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .trip-nav-top .trip-nav-link {
    flex-direction: row;
    flex: 0 0 auto;
    gap: 0.35rem;
    padding: 0.5rem 0.85rem;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
  }

  .trip-nav-top .trip-nav-link.active {
    background: var(--accent);
    color: var(--accent-text);
  }

  .trip-nav-top .nav-icon { font-size: 1rem; }
  .trip-nav-top .nav-label { margin: 0; }

  .kc-main { padding: 1.25rem 1.5rem 2rem; }
}

/* Trip admin user management */
.admin-panel { border-color: var(--accent); }
.admin-panel-lead { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.9rem; }
.admin-flash { padding: 0.65rem; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.admin-flash-error { background: rgba(252, 129, 129, 0.15); border: 1px solid var(--error); color: var(--error); }
.admin-flash-ok { background: rgba(104, 211, 145, 0.15); border: 1px solid var(--success); color: var(--success); }
.admin-user-list { display: flex; flex-direction: column; gap: 1rem; }
.admin-user-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.admin-user-card-head { margin-bottom: 0.75rem; padding-bottom: 0.65rem; border-bottom: 1px solid var(--border); }
.admin-user-login { font-size: 0.85rem; color: var(--text-muted); font-family: ui-monospace, monospace; }
.admin-block { display: flex; flex-direction: column; gap: 0.65rem; margin-bottom: 0.85rem; }
.admin-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.admin-btn { min-height: 44px; margin: 0; }
.admin-btn-primary { background: var(--success); color: #fff; width: 100%; }
.admin-btn-ghost { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.admin-toolbar { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.45rem; margin-bottom: 0.85rem; }
.admin-toolbar form { margin: 0; }
.admin-toolbar button { width: 100%; min-height: 44px; font-size: 0.85rem; }
.admin-chip { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.admin-chip.is-on { border-color: var(--success); color: var(--success); }
.admin-chip.is-off { border-color: var(--error); color: var(--error); }
.admin-chip.is-admin { border-color: var(--accent); color: var(--accent); }
.admin-chip-danger { border-color: var(--error); color: var(--error); }
.admin-password-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.admin-password-row input { flex: 1 1 120px; min-width: 0; }
@media (min-width: 480px) { .admin-toolbar { grid-template-columns: repeat(4, 1fr); } }
