/* ============================================================
   style.css — rib.1111.ma
   Palette : bleu marine + vert validation + rouge erreur
   ============================================================ */

:root {
  --bg:       #f0f4f8;
  --surface:  #ffffff;
  --navy:     #0f2744;
  --navy-mid: #1e3a5f;
  --blue:     #2563eb;
  --blue-lt:  #eff6ff;
  --green:    #16a34a;
  --green-lt: #f0fdf4;
  --red:      #dc2626;
  --red-lt:   #fef2f2;
  --orange:   #d97706;
  --orange-lt:#fffbeb;
  --muted:    #64748b;
  --border:   #e2e8f0;
  --mono:     'JetBrains Mono', monospace;
  --sans:     'Inter', sans-serif;
  --radius:   10px;
  --shadow:   0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--navy);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 820px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ── */
.site-header {
  background: var(--navy);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.logo-mark {
  background: var(--blue);
  color: #fff;
  font-family: var(--mono);
  font-weight: 600;
  font-size: .8rem;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: .04em;
}
.logo-domain {
  color: #cbd5e1;
  font-size: .9rem;
  font-weight: 500;
}
nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  color: #94a3b8;
  text-decoration: none;
  font-size: .85rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background .15s, color .15s;
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,.1);
  color: #fff;
}

/* ── Hero ── */
.hero {
  padding: 40px 0 24px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
}
.hero-sub {
  color: var(--muted);
  font-size: .9rem;
  margin-top: 8px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

/* ── RIB Input Row ── */
.input-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 72px;
}
.field-group.flex2 { flex: 2; min-width: 160px; }
.field-group label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.rib-field {
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
  text-align: center;
}
.rib-field:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
  background: #fff;
}
.field-label { display: none; }

/* ── Actions ── */
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  transition: background .15s, transform .1s;
}
.btn-primary:hover  { background: #1d4ed8; }
.btn-primary:active { transform: scale(.97); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 9px 16px;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--sans);
  transition: border-color .15s, color .15s;
}
.btn-ghost:hover { border-color: var(--muted); color: var(--navy); }
.paste-hint {
  font-size: .78rem;
  color: var(--muted);
  margin-left: auto;
}

/* ── Result card ── */
.result-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.result-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  font-weight: 700;
  font-size: 1rem;
}
.result-badge .icon { font-size: 1.3rem; }
.badge-valid   { background: var(--green);  color: #fff; }
.badge-invalid { background: var(--red);    color: #fff; }
.badge-error   { background: var(--orange); color: #fff; }

.result-body {
  background: var(--surface);
  padding: 20px;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.result-item label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted);
  margin-bottom: 3px;
}
.result-item .value {
  font-size: .95rem;
  font-weight: 600;
  color: var(--navy);
}
.result-item .value.mono {
  font-family: var(--mono);
  font-size: .88rem;
}
.result-item .value.na { color: #94a3b8; font-weight: 400; }
.result-item .value.green { color: var(--green); }
.result-item .value.red   { color: var(--red); }

.iban-block {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--blue-lt);
  border-radius: 8px;
  border-left: 3px solid var(--blue);
}
.iban-block label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--blue);
  display: block;
  margin-bottom: 4px;
}
.iban-block .value {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: .04em;
  word-break: break-all;
}

/* ── Disclaimer ── */
.disclaimer {
  font-size: .78rem;
  color: var(--muted);
  text-align: center;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* ── App banner ── */
.app-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--navy);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.app-banner-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #fff;
}
.app-banner-text strong { font-size: .95rem; }
.app-banner-text span   { font-size: .82rem; color: #94a3b8; }
.btn-store {
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  padding: 9px 20px;
  border-radius: 8px;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background .15s;
}
.btn-store:hover { background: #1d4ed8; }

/* ── Footer ── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 16px 0;
  margin-top: auto;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--muted);
}
.site-footer a { color: var(--blue); text-decoration: none; }

/* ── Bulk / table pages ── */
.page-title { padding: 32px 0 8px; }
.page-title h1 { font-size: 1.5rem; font-weight: 700; }
.page-title p  { color: var(--muted); font-size: .875rem; margin-top: 6px; }

.textarea-rib {
  width: 100%;
  font-family: var(--mono);
  font-size: .9rem;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  resize: vertical;
  min-height: 140px;
  color: var(--navy);
  transition: border-color .15s;
}
.textarea-rib:focus { outline: none; border-color: var(--blue); background: #fff; }

.stats-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.stat-pill {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 600;
}
.stat-pill.valid   { background: var(--green-lt);  color: var(--green); }
.stat-pill.invalid { background: var(--red-lt);    color: var(--red); }
.stat-pill.total   { background: var(--blue-lt);   color: var(--blue); }

.result-table-wrap { overflow-x: auto; border-radius: var(--radius); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  background: var(--surface);
}
thead th {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 10px 14px;
  text-align: left;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody td { padding: 9px 14px; vertical-align: middle; }
tbody tr.row-valid   td:first-child { border-left: 3px solid var(--green); }
tbody tr.row-invalid td:first-child { border-left: 3px solid var(--red); }
.badge-sm {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-sm.valid   { background: var(--green-lt); color: var(--green); }
.badge-sm.invalid { background: var(--red-lt);   color: var(--red); }

/* ── File upload ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload-zone:hover { border-color: var(--blue); background: var(--blue-lt); }
.upload-zone input { display: none; }
.upload-icon { font-size: 2rem; margin-bottom: 10px; }
.upload-zone p { color: var(--muted); font-size: .875rem; }
.upload-zone strong { color: var(--blue); }

/* ── Responsive ── */
@media (max-width: 600px) {
  .input-row { flex-direction: column; }
  .field-group, .field-group.flex2 { min-width: 100%; }
  .rib-field { text-align: left; }
  .paste-hint { display: none; }
  .action-row { flex-direction: column; align-items: stretch; }
  .btn-primary, .btn-ghost { text-align: center; }

  /* La nav du header cède la place à la barre d'onglets fixe en bas
     (plus accessible au pouce, et cohérente avec l'usage "app installée"). */
  .site-header nav { display: none; }

  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
}

/* ── Barre d'onglets mobile ── */
.tabbar {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 200;
  background: var(--navy);
  border-top: 1px solid rgba(255,255,255,.08);
  padding-bottom: env(safe-area-inset-bottom);
}
@media (max-width: 600px) {
  .tabbar { display: flex; }
}
.tabbar-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 9px 4px 8px;
  text-decoration: none;
  color: #94a3b8;
  font-size: .68rem;
  font-weight: 600;
}
.tabbar-link .tabbar-icon { font-size: 1.15rem; line-height: 1; }
.tabbar-link.active { color: #fff; }
.tabbar-link.active .tabbar-icon { transform: translateY(-1px); }

/* ── Bandeau d'installation iOS / Android ── */
.install-banner {
  display: none;
  position: fixed;
  left: 12px; right: 12px;
  bottom: 12px;
  z-index: 300;
  background: var(--navy);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.25);
  padding: 14px 14px 14px 16px;
  align-items: center;
  gap: 12px;
  animation: install-banner-in .35s ease-out;
}
.install-banner.show { display: flex; }
@media (max-width: 600px) {
  .install-banner { bottom: calc(60px + env(safe-area-inset-bottom) + 10px); }
}
@keyframes install-banner-in {
  from { transform: translateY(12px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.install-banner-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}
.install-banner-text { flex: 1; min-width: 0; }
.install-banner-text strong { display: block; font-size: .86rem; }
.install-banner-text span { display: block; font-size: .76rem; color: #94a3b8; margin-top: 2px; line-height: 1.4; }
.install-banner-text .step-icon { display: inline-block; padding: 0 2px; }
.install-banner-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.install-banner-btn {
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 7px 12px;
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--sans);
  white-space: nowrap;
}
.install-banner-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 6px;
}
.install-banner-close:hover { color: #fff; }

@media (prefers-reduced-motion: reduce) {
  .install-banner { animation: none; }
}