/* =====================================================
   TELECHIZAPP — Telechizapp
   Dark-theme, mobile-first, Outfit + JetBrains Mono
   ===================================================== */

:root {
  --bg:         #0e0f14;
  --bg-surface: #16181f;
  --bg-elevated:#1e2029;
  --border:     #2a2c38;
  --border-subtle: #232530;
  --text:       #e8eaf0;
  --text-muted: #7a7f96;
  --text-subtle:#555870;
  --accent:     #6c8bff;
  --accent-dim: #2d3a70;
  --positive:   #4ade80;
  --negative:   #f87171;
  --danger:     #ef4444;
  --danger-dim: #3d1515;
  --success:    #22c55e;
  --success-dim:#0f2e1c;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 4px 24px rgba(0,0,0,0.4);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, button, textarea { font-family: inherit; }

/* ── Mono ── */
.mono { font-family: 'JetBrains Mono', monospace; letter-spacing: -0.02em; }

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}
.nav-links { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { font-size: 0.875rem; color: var(--text-muted); }
.nav-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}
.nav-link:hover { color: var(--text); background: var(--bg-elevated); text-decoration: none; }
.nav-link--admin { color: var(--accent); }

/* ── Language switcher ── */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}
.lang-btn {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.lang-btn:hover { color: var(--text); text-decoration: none; }
.lang-btn--active {
  background: var(--accent);
  color: #fff;
}
.lang-switcher--login {
  margin-top: 1.25rem;
  justify-content: center;
  background: transparent;
  border: none;
}

/* ── Main ── */
.main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.page-header__actions { display: flex; gap: 0.5rem; align-items: center; }
.page-title { font-size: 1.6rem; font-weight: 700; }
.page-subtitle { font-size: 0.875rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── Section title ── */
.section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.75rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: filter 0.15s, background 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.1); text-decoration: none; }
.btn--primary   { background: var(--accent); color: #fff; }
.btn--ghost     { background: var(--bg-elevated); color: var(--text-muted); border: 1px solid var(--border); }
.btn--danger    { background: var(--danger); color: #fff; }
.btn--full      { width: 100%; justify-content: center; padding: 0.7rem 1rem; font-size: 1rem; }
.btn--tiny      { padding: 0.2rem 0.55rem; font-size: 0.78rem; }

/* ── Card ── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* ── Alert ── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}
.alert--error   { background: var(--danger-dim);  color: #fca5a5; border: 1px solid #7f1d1d; }
.alert--success { background: var(--success-dim); color: #86efac; border: 1px solid #14532d; }

/* ── Auth page ── */
.auth-page {
  min-height: calc(100vh - 56px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.auth-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  text-align: center;
}
.auth-logo  { font-size: 2.5rem; margin-bottom: 0.5rem; }
.auth-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; }
.auth-subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1.75rem; }

/* ── Form ── */
.auth-form  { text-align: left; }
.form       { display: flex; flex-direction: column; gap: 1rem; }
.form--inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; min-width: 140px; }
.form-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); }
.form-hint  { font-size: 0.8rem; color: var(--text-subtle); margin-top: -0.2rem; }
.form-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
}
.form-input:focus { border-color: var(--accent); }
.form-input--sm { padding: 0.4rem 0.6rem; font-size: 0.85rem; }
.form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  outline: none;
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a7f96' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}
.form-select:focus { border-color: var(--accent); }

/* ── Checkbox grid ── */
.checkbox-grid { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.35rem; }
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.checkbox-item:hover { border-color: var(--border); }
.checkbox-item--self { border-color: var(--accent-dim); }
.checkbox-item input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox-item__name  { font-size: 0.9rem; font-weight: 500; flex: 1; }
.checkbox-item__phone { font-size: 0.8rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }

/* ── Trips grid ── */
.trips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.trip-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: border-color 0.15s, transform 0.1s;
}
.trip-card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; color: var(--text); }
.trip-card__name  { font-size: 1.05rem; font-weight: 600; }
.trip-card__stats { display: flex; justify-content: space-between; align-items: center; }
.trip-card__count { font-size: 0.8rem; color: var(--text-muted); }
.trip-card__total { font-size: 1rem; font-weight: 600; color: var(--accent); }
.trip-card__date  { font-size: 0.75rem; color: var(--text-subtle); }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state__text { margin-bottom: 1.25rem; font-size: 1.05rem; }

/* ── Summary grid (trip detail) ── */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 2rem;
}
@media (max-width: 600px) {
  .summary-grid { grid-template-columns: 1fr; }
}

/* ── Panel ── */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.panel--settlements { border-color: var(--accent-dim); }
.panel-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

/* ── Settlements list ── */
.settlements-list { display: flex; flex-direction: column; gap: 0.75rem; }
.settlement-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.settlement-from { font-weight: 600; color: var(--negative); }
.settlement-arrow { color: var(--text-subtle); }
.settlement-to   { font-weight: 600; color: var(--positive); }
.settlement-amount { font-weight: 700; font-size: 1.05rem; margin-left: auto; }

/* ── Balances list ── */
.balances-list { display: flex; flex-direction: column; gap: 0.75rem; }
.balance-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.balance-name   { font-weight: 600; min-width: 80px; }
.balance-details { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.balance-detail  { font-size: 0.8rem; color: var(--text-muted); }
.balance-net     { font-weight: 700; font-size: 1rem; }
.no-data { color: var(--text-muted); font-size: 0.9rem; }

/* ── Color helpers ── */
.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* ── Expenses section ── */
.expenses-section { margin-top: 1.5rem; }
.expense-list { display: flex; flex-direction: column; gap: 0.75rem; }
.expense-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
}
.expense-item__main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.35rem;
}
.expense-item__desc   { font-weight: 600; font-size: 0.95rem; }
.expense-item__amount { font-weight: 700; font-size: 1rem; color: var(--text); white-space: nowrap; }
.expense-item__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.expense-item__split { color: var(--text-subtle); }

/* ── Admin sections ── */
.admin-section { margin-bottom: 2.5rem; }

/* ── Table ── */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th, .data-table td {
  padding: 0.65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
}
.data-table th {
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-elevated); }
.actions-cell { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── Badge ── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge--admin { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* ── Inline details/summary (edit row) ── */
.inline-details summary { list-style: none; cursor: pointer; }
.inline-details summary::-webkit-details-marker { display: none; }
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.inline-form .form-input { max-width: 160px; }

/* ── Mobile adjustments ── */
@media (max-width: 480px) {
  .page-title { font-size: 1.3rem; }
  .main { padding: 1rem 0.875rem 3rem; }
  .form-row { grid-template-columns: 1fr; }
  .auth-card { padding: 1.75rem 1.25rem; }
  .summary-grid { gap: 0.75rem; }
  .balance-details { gap: 0.5rem; }
  .expense-item__meta { gap: 0.5rem; }
}
