/* =========================================================
   ASSA Time Tracker — app styles
   Built on the ASSA Escalade design system
   ========================================================= */
@import url('../colors_and_type.css');

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--chalk);
  color: var(--fg-1);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  min-height: 100vh;
}

a { color: var(--mer-deep); }

/* ---------- App shell ---------- */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  background: var(--paper);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(12px);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: var(--space-6);
  padding: 14px var(--space-6);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--fg-1);
}
.brand-logo {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--chalk-warm) url('../assets/logo-club.png') center/cover no-repeat;
  flex: none;
  box-shadow: 0 0 0 1px var(--border);
}
.brand-wordmark {
  display: flex; flex-direction: column; line-height: 1; gap: 3px;
}
.brand-wordmark .b1 {
  font-family: var(--font-display); font-size: 20px;
  letter-spacing: 0.02em; text-transform: uppercase; color: var(--rock);
}
.brand-wordmark .b2 {
  font-size: 10px; font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase; color: var(--mer-deep);
}

.nav { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.nav a {
  text-decoration: none;
  font-weight: 600; font-size: 13px;
  color: var(--fg-2);
  padding: 9px 14px; border-radius: var(--radius-pill);
  display: inline-flex; align-items: center; gap: 8px;
  transition: all var(--dur-fast) var(--ease-out);
}
.nav a:hover { color: var(--rock); background: var(--neutral-100); }
.nav a.active { color: var(--rock); background: var(--neutral-100); }
.nav a .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--mer);
  opacity: 0; transition: opacity var(--dur-fast);
}
.nav a.active .dot { opacity: 1; }

/* ---------- Page header ---------- */
.page {
  flex: 1;
  max-width: 1100px; width: 100%;
  margin: 0 auto;
  padding: var(--space-10) var(--space-6) var(--space-16);
}
.page-narrow { max-width: 720px; }

.page-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase; color: var(--mer-deep);
  margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 8px;
}
.page-eyebrow::before {
  content:''; width: 24px; height: 1.5px; background: var(--mer);
}
.page-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 64px);
  line-height: 0.95;
  text-transform: uppercase;
  letter-spacing: -0.005em;
  color: var(--rock);
  margin: 0 0 var(--space-3);
}
.page-lede {
  color: var(--fg-2); font-size: 15px; max-width: 56ch; margin: 0;
}

/* ---------- Card ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  padding: var(--space-8);
}
.card + .card { margin-top: var(--space-6); }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: var(--space-6); }
.field-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-6);
}
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

.label {
  font-size: 11px; font-weight: 700;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--fg-2);
  display: flex; align-items: center; justify-content: space-between;
}
.label .req { color: var(--mer-deep); margin-left: 4px; }

.input, .select, .textarea {
  width: 100%;
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  color: var(--rock);
  background: var(--paper);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  line-height: 1.3;
  transition: border-color var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--mer);
  box-shadow: 0 0 0 3px rgba(43,168,214,0.18);
}
.select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%235F6A77' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><polyline points='1.5 1.5 6 6.5 10.5 1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 40px;
}

.input.with-suffix {
  padding-right: 56px;
}
.input-wrap { position: relative; }
.input-suffix {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  font-size: 12px; font-weight: 700; color: var(--fg-3);
  letter-spacing: 0.06em; text-transform: uppercase;
  pointer-events: none;
}

.hint {
  font-size: 12px; color: var(--fg-3); line-height: 1.4;
}

/* Inline "Autre" sub-form panel */
.inline-add {
  margin-top: 10px;
  background: var(--mer-foam);
  border: 1px dashed rgba(43,168,214,0.6);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  display: none;
  flex-direction: column; gap: 10px;
}
.inline-add.open { display: flex; }
.inline-add .ia-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--mer-deep);
}
.inline-add .ia-head svg { width: 14px; height: 14px; }

/* Status chips inside inline-add (radio) */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--paper);
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg-1);
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease-out);
}
.chip:hover { border-color: var(--rock); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--neutral-400);
}
.chip[data-active="true"] {
  background: var(--rock); color: #fff; border-color: var(--rock);
}
.chip[data-active="true"] .chip-dot { background: #fff; }
.chip[data-status="bureau"]    .chip-dot { background: var(--mer-deep); }
.chip[data-status="ca"]        .chip-dot { background: var(--sunset); }
.chip[data-status="encadrant"] .chip-dot { background: var(--mer); }
.chip[data-status="autre"]     .chip-dot { background: var(--neutral-400); }

/* ---------- Status pill (in tables) ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; line-height: 1.4;
  white-space: nowrap;
}
.pill::before {
  content:''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}
.pill-bureau    { background: var(--mer-foam); color: var(--mer-deep); }
.pill-ca        { background: #FFE3D8;        color: #B8421A; }
.pill-encadrant { background: #E6F4FB;        color: #1A82AB; }
.pill-autre     { background: var(--neutral-100); color: var(--neutral-600); }

/* ---------- Button ---------- */
.btn {
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
  line-height: 1; white-space: nowrap;
  transition: all var(--dur-base) var(--ease-out);
}
.btn:active { transform: scale(0.985); transition-duration: var(--dur-fast); }
.btn-md { padding: 14px 22px; font-size: 12px; }
.btn-sm { padding: 9px 14px; font-size: 11px; }
.btn-lg { padding: 18px 28px; font-size: 13px; }
.btn-primary { background: var(--mer); color: #fff; }
.btn-primary:hover { background: var(--mer-deep); box-shadow: var(--shadow-blue); transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--rock); border-color: var(--rock); }
.btn-secondary:hover { background: var(--rock); color: #fff; }
.btn-ghost { background: transparent; color: var(--fg-2); padding: 9px 12px; font-size: 11px; }
.btn-ghost:hover { color: var(--rock); background: var(--neutral-100); }

.form-actions {
  display: flex; align-items: center; gap: var(--space-4);
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--divider);
}
.form-actions .spacer { flex: 1; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed; right: var(--space-6); bottom: var(--space-6);
  display: flex; flex-direction: column; gap: 10px;
  z-index: 50; pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--rock); color: #fff;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-3);
  font-size: 14px; font-weight: 500;
  max-width: 380px;
  animation: toast-in var(--dur-base) var(--ease-out);
}
.toast.success { background: linear-gradient(135deg, #2BA8D6 0%, #1A82AB 100%); }
.toast .t-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.toast .t-icon svg { width: 16px; height: 16px; }
@keyframes toast-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

/* ---------- Table ---------- */
.table-wrap {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.table-toolbar {
  display: flex; align-items: center; gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--divider);
  background: var(--surface-2);
}
.table-toolbar .spacer { flex: 1; }
.table-toolbar .summary {
  display: flex; gap: var(--space-6); align-items: baseline;
}
.summary-item .num {
  font-family: var(--font-display);
  font-size: 22px; color: var(--rock);
  letter-spacing: 0.01em;
}
.summary-item .lbl {
  display: block; font-size: 10px; font-weight: 700;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--fg-3);
}

.table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.table thead th {
  text-align: left;
  font-size: 11px; font-weight: 700;
  letter-spacing: var(--tracking-eyebrow); text-transform: uppercase;
  color: var(--fg-2);
  padding: 12px var(--space-5);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.table thead th.sortable { cursor: pointer; }
.table thead th.sortable:hover { color: var(--rock); }
.table thead th .sort-ico {
  display: inline-flex; align-items: center; margin-left: 6px;
  color: var(--neutral-400);
}
.table thead th[data-sort="asc"]  .sort-ico,
.table thead th[data-sort="desc"] .sort-ico { color: var(--mer-deep); }
.table thead th[data-sort="desc"] .sort-ico svg { transform: rotate(180deg); }

.table tbody td {
  padding: 14px var(--space-5);
  border-bottom: 1px solid var(--divider);
  color: var(--fg-1);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface-2); }
.table .td-date   { font-variant-numeric: tabular-nums; color: var(--fg-2); white-space: nowrap; }
.table .td-date strong { color: var(--rock); font-weight: 600; }
.table .td-name   { font-weight: 600; }
.table .td-action { color: var(--fg-1); }
.table .row-comment {
  margin-top: 3px;
  font-size: 12px;
  color: var(--fg-2);
  line-height: 1.35;
  max-width: 42ch;
}
.table .row-comment::before {
  content: '“';
  color: var(--neutral-300);
  font-family: var(--font-display);
  margin-right: 2px;
}
.table .row-comment::after { content: '”'; color: var(--neutral-300); font-family: var(--font-display); margin-left: 2px; }
.table .td-time   { font-family: var(--font-mono); font-weight: 500; color: var(--rock); white-space: nowrap; }
.table .td-val    {
  font-family: var(--font-mono); font-weight: 600; color: var(--rock);
  white-space: nowrap; text-align: right;
}
.table th.num, .table td.num { text-align: right; }

.empty {
  padding: var(--space-16) var(--space-6);
  text-align: center; color: var(--fg-3);
}
.empty .ico {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--neutral-100);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: var(--space-4);
}
.empty p { margin: 6px 0; }

/* ---------- Filter row ---------- */
.filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.filter-input {
  font-family: var(--font-sans);
  font-size: 13px;
  border: 1px solid var(--border-strong);
  background: var(--paper);
  border-radius: var(--radius-pill);
  padding: 8px 14px 8px 36px;
  width: 240px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235F6A77' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 14px 14px;
}
.filter-input:focus { outline: none; border-color: var(--mer); box-shadow: 0 0 0 3px rgba(43,168,214,0.18); }

.filter-select {
  font-family: var(--font-sans);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--paper);
  border-radius: var(--radius-pill);
  padding: 8px 32px 8px 14px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%235F6A77' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'><polyline points='1.5 1.5 6 6.5 10.5 1.5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 10px 7px;
  cursor: pointer;
}

/* ---------- Footer ---------- */
.app-foot {
  border-top: 1px solid var(--border);
  padding: var(--space-6);
  color: var(--fg-3); font-size: 12px;
  text-align: center;
}
.app-foot a { color: var(--fg-2); }
