/* Styles globaux partagés par toutes les pages. Les mises en page propres à une page
   sont dans les fichiers .razor.css (CSS isolé). */

html, body {
  margin: 0;
  background: var(--cn-bg);
  color: var(--cn-text);
  font-family: var(--cn-font);
  -webkit-font-smoothing: antialiased;
}

body {
  overflow-x: hidden;
}

a {
  color: var(--cn-green);
}

a:hover {
  color: var(--cn-green-dark);
}

/* Focus visible partout (accessibilité clavier). */
:focus-visible {
  outline: 3px solid var(--cn-green);
  outline-offset: 2px;
}

.cn-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Structure ---- */

.cn-page {
  max-width: var(--cn-page-max);
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  padding: 28px var(--cn-gutter);
}

.cn-two-cols {
  display: flex;
  flex-wrap: wrap;
  gap: 28px;
  align-items: flex-start;
}

.cn-main-col {
  flex: 1 1 560px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.cn-side-col {
  flex: 0 1 380px;
  width: 100%;
  max-width: 380px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (max-width: 960px) {
  .cn-side-col {
    max-width: none;
    flex-basis: 100%;
  }
}

.cn-card {
  background: var(--cn-surface);
  border: 1px solid var(--cn-border);
  border-radius: var(--cn-radius-md);
  padding: 24px;
  box-sizing: border-box;
  min-width: 0;
}

.cn-card--lg {
  border-radius: var(--cn-radius-lg);
}

.cn-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.cn-stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cn-row-between {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 12px;
}

.cn-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 600px) {
  .cn-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- Typographie ---- */

.cn-h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.02em;
  text-wrap: balance;
}

.cn-h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.cn-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cn-text-muted);
}

.cn-muted {
  color: var(--cn-text-muted);
}

.cn-small {
  font-size: 13px;
}

.cn-xsmall {
  font-size: 12px;
}

.cn-mono {
  font-family: var(--cn-font-mono);
  font-weight: 500;
}

.cn-back-link {
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--cn-touch);
  margin-bottom: 6px;
}

/* ---- Lignes de montants ---- */

.cn-amounts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
}

.cn-amount-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.cn-amount-row > :first-child {
  color: var(--cn-text-muted);
}

.cn-amount-total {
  font-weight: 600;
  padding-top: 10px;
  border-top: 1px solid var(--cn-border);
}

.cn-amount-total > :first-child {
  color: var(--cn-text);
}

.cn-total-box {
  background: var(--cn-green-pale);
  border-radius: var(--cn-radius);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  color: var(--cn-green-dark);
}

/* ---- Bandeaux ---- */

.cn-notice {
  border-radius: var(--cn-radius);
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.5;
}

.cn-notice--warn {
  background: var(--cn-warn-bg);
  color: #7A4A00;
}

.cn-notice--info {
  background: var(--cn-green-pale);
  color: var(--cn-green-dark);
}

/* ---- Statut en ligne (attente, chargement) ---- */

.cn-wait-row {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 15px;
  line-height: 1.5;
}

/* ---- Choix en cartes (mode de réception, type d'annonce, rôle) ---- */

.cn-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 600px) {
  .cn-choice-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.cn-choice {
  text-align: left;
  min-height: 76px;
  padding: 14px 16px;
  border-radius: var(--cn-radius);
  border: 1px solid var(--cn-border-input);
  background: var(--cn-surface);
  font: inherit;
  color: var(--cn-text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cn-choice b {
  font-size: 15px;
}

.cn-choice span {
  font-size: 13px;
  color: var(--cn-text-muted);
}

.cn-choice[aria-pressed="true"] {
  border: 2px solid var(--cn-green);
  background: var(--cn-green-pale);
  padding: 13px 15px;
}

.cn-choice[aria-pressed="true"] b {
  color: var(--cn-green);
}

.cn-choice[aria-pressed="true"] span {
  color: var(--cn-text-body);
}

/* ---- Onglets de filtre (listes) ---- */

.cn-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cn-tab {
  min-height: var(--cn-touch);
  padding: 0 16px;
  border-radius: var(--cn-radius-pill);
  border: 1px solid var(--cn-border-input);
  background: var(--cn-surface);
  color: var(--cn-text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cn-tab[aria-pressed="true"] {
  border-color: var(--cn-green);
  background: var(--cn-green);
  color: #fff;
}

.cn-tab .cn-tab-count {
  font-size: 12px;
  opacity: .8;
}

/* ---- Vignette produit ---- */

.cn-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--cn-radius);
  background: var(--cn-green-pale);
  flex: none;
  object-fit: cover;
}

/* ---- Tableaux : défilement horizontal sur petit écran ---- */

.cn-table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.cn-table-scroll table {
  min-width: 560px;
}

/* ---- MudBlazor : ajustements au design ---- */

.mud-button-root {
  min-height: var(--cn-touch);
}

.mud-input-control .mud-input-outlined-border {
  border-color: var(--cn-border-input);
}

.cn-btn-pay.mud-button-filled {
  background-color: var(--cn-pay);
  color: #fff;
}

.cn-btn-pay.mud-button-filled:hover {
  background-color: #94420F;
}

/* ---- Démarrage et erreur Blazor ---- */

.cn-boot {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--cn-text-muted);
  font-family: var(--cn-font);
}

#blazor-error-ui {
  background: var(--cn-error-bg);
  color: var(--cn-error-ink);
  bottom: 0;
  box-shadow: var(--cn-shadow);
  display: none;
  left: 0;
  padding: 12px 20px;
  position: fixed;
  width: 100%;
  box-sizing: border-box;
  z-index: 2000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 16px;
  top: 8px;
  background: none;
  border: 0;
  font-size: 22px;
  color: inherit;
  min-width: var(--cn-touch);
  min-height: var(--cn-touch);
}

/* Vietnamien : Poppins n'a pas tous les accents (ư, ơ, ạ…), on passe à Be Vietnam Pro (chargée par App.razor). */
html[lang="vi"] {
  --cn-font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mud-typography-default-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-h1-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-h2-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-h3-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-h4-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-h5-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-h6-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-subtitle1-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-subtitle2-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-body1-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-body2-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-input-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-button-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-caption-family: 'Be Vietnam Pro', system-ui, sans-serif;
  --mud-typography-overline-family: 'Be Vietnam Pro', system-ui, sans-serif;
}
