/* css/trip-cost-split.css -- Group cost-split widget styles.
 *
 * Self-contained block; not threaded through tailwind.config.js because the
 * widget is a vertical slice we want to be able to ship or yank without
 * touching the rest of the design system. Colors reference the muddytires
 * palette (forest / amber / basalt / paper / trail) so the widget feels
 * native when dropped into a trip view.
 *
 * Usage: <link rel="stylesheet" href="/css/trip-cost-split.css">
 * Then a container with [data-trip-cost-split-code="ABCD1234"] auto-mounts.
 */

.cost-split-root {
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: rgb(19 28 37);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1rem;
  background: rgb(246 247 244);
  border: 1px solid rgba(23, 32, 41, 0.1);
  border-radius: 0.75rem;
}

.cost-split-h {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgb(90 102 112);
  margin: 0 0 0.5rem 0;
}

.cost-split-empty {
  color: rgb(90 102 112);
  font-style: italic;
  margin: 0;
  padding: 0.75rem 0;
}

.cost-split-warn {
  background: rgba(232, 130, 12, 0.1);
  border: 1px solid rgba(232, 130, 12, 0.4);
  color: rgb(120, 67, 6);
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.85em;
  margin: 0.5rem 0;
}

/* ---- form ---- */

.cost-split-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cost-split-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.cost-split-row-submit {
  justify-content: flex-start;
}

.cost-split-input {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(23, 32, 41, 0.15);
  border-radius: 0.5rem;
  background: white;
  font-size: 0.95rem;
  font-family: inherit;
  color: inherit;
}

.cost-split-input:focus {
  outline: none;
  border-color: rgb(46 158 63);
  box-shadow: 0 0 0 3px rgba(46, 158, 63, 0.15);
}

.cost-split-input-amount {
  max-width: 7rem;
}

.cost-split-input-desc {
  flex: 2 1 0;
}

.cost-split-btn {
  background: rgb(29 71 48);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s;
}

.cost-split-btn:hover {
  background: rgb(2 48 27);
}

.cost-split-btn:disabled {
  background: rgba(23, 32, 41, 0.4);
  cursor: default;
}

.cost-split-status {
  color: rgb(90 102 112);
  font-size: 0.85em;
}

/* ---- contribution list ---- */

.cost-split-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cost-split-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid rgba(23, 32, 41, 0.08);
  border-radius: 0.5rem;
}

.cost-split-item-amount {
  font-weight: 700;
  color: rgb(29 71 48);
  font-variant-numeric: tabular-nums;
}

.cost-split-item-member {
  font-weight: 600;
}

.cost-split-item-cat {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  background: rgba(23, 32, 41, 0.08);
  color: rgb(90 102 112);
}

.cost-split-cat-fuel { background: rgba(232, 130, 12, 0.15); color: rgb(120, 67, 6); }
.cost-split-cat-groceries { background: rgba(46, 158, 63, 0.15); color: rgb(29, 71, 48); }
.cost-split-cat-camp { background: rgba(29, 71, 48, 0.15); color: rgb(2, 48, 27); }
.cost-split-cat-food { background: rgba(232, 130, 12, 0.1); color: rgb(120, 67, 6); }
.cost-split-cat-gear { background: rgba(23, 32, 41, 0.1); color: rgb(23, 32, 41); }

.cost-split-item-desc {
  color: rgb(90 102 112);
  font-size: 0.9rem;
  flex-basis: 100%;
}

/* ---- settle view ---- */

.cost-split-settle {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cost-split-settle-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0.75rem;
  background: white;
  border: 1px solid rgba(23, 32, 41, 0.08);
  border-radius: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.cost-split-balance-list,
.cost-split-transfer-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.cost-split-balance {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 0.5rem 0.75rem;
  background: white;
  border: 1px solid rgba(23, 32, 41, 0.08);
  border-radius: 0.5rem;
}

.cost-split-balance-pos {
  border-left: 3px solid rgb(46 158 63);
}

.cost-split-balance-neg {
  border-left: 3px solid rgb(232 130 12);
}

.cost-split-balance-zero {
  border-left: 3px solid rgba(23, 32, 41, 0.2);
}

.cost-split-balance-name {
  font-weight: 600;
  min-width: 6rem;
}

.cost-split-balance-paid {
  color: rgb(90 102 112);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.cost-split-balance-amount {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.cost-split-balance-pos .cost-split-balance-amount { color: rgb(29 71 48); }
.cost-split-balance-neg .cost-split-balance-amount { color: rgb(120, 67, 6); }

.cost-split-transfer {
  padding: 0.5rem 0.75rem;
  background: rgba(46, 158, 63, 0.08);
  border: 1px solid rgba(46, 158, 63, 0.25);
  border-radius: 0.5rem;
  font-variant-numeric: tabular-nums;
}

.cost-split-transfer-amount {
  font-weight: 700;
  color: rgb(29 71 48);
  margin-left: 0.25rem;
}

@media (max-width: 480px) {
  .cost-split-input-amount {
    max-width: none;
    flex: 1 1 30%;
  }
  .cost-split-input-desc {
    flex: 1 1 100%;
  }
  .cost-split-balance-amount {
    margin-left: 0;
  }
}
