/*
 * All-in-one Rewards : pages « Mes récompenses » et « Parrainage » aux couleurs de Cinier-B.
 *
 * Ce fichier REMPLACE modules/allinone_rewards/views/css/allinone_rewards.css (surcharge thème
 * de l'asset, même chemin relatif) : le CSS d'origine du module n'est plus chargé du tout.
 * CSS brut, hors build Vite : il s'appuie sur les variables du thème (--color-brand-*,
 * --font-*) et n'est pas en @layer, il passe donc devant les utilitaires Tailwind.
 * Tout est limité aux blocs du module (#rewards_account, #rewards_sponsorship, modales).
 */

/* ── Règles fonctionnelles reprises du module (classes posées par son JS) ── */
.aior_unvisible,
.rewards .block_hidden_only_for_screen {
  display: none !important;
}

.aior_hide_button,
.aior_show_button,
span#aior_add_to_cart_available_display,
span#aior_add_to_cart_available_real {
  display: none;
}

/* ── Conteneur ── */
.rewards {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  color: var(--color-brand-tertiary);
}

.rewards p {
  margin: 0 0 12px;
}

.rewards strong,
.rewards b {
  font-weight: 600;
  color: var(--color-brand-primary);
}

/* ── Onglets (jQuery idTabs : .selected sur le lien actif) ── */
.rewards .idTabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0 32px;
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--color-brand-support);
}

.rewards .idTabs li {
  flex: none;
  width: auto;
  margin: 0;
  padding: 0;
}

.rewards .idTabs a {
  display: block;
  margin-bottom: -1px;
  padding: 14px 0 12px;
  border-bottom: 2px solid transparent;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-brand-quaternary);
  text-decoration: none;
  transition: color 0.2s ease-out, border-color 0.2s ease-out;
}

.rewards .idTabs a:hover {
  color: var(--color-brand-primary);
}

.rewards .idTabs a.selected {
  color: var(--color-brand-primary);
  border-bottom-color: var(--color-brand-primary);
}

/* ── Titres ── */
.rewards h2,
.rewards .title {
  margin: 40px 0 16px;
  font-family: var(--font-heading);
  font-size: 20px;
  line-height: 26px;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--color-brand-primary);
}

/* ── Tableaux ── */
.rewards .table {
  width: 100%;
  margin: 0 0 24px;
  border: 0;
  border-collapse: collapse;
}

.rewards .table th {
  padding: 0 16px 12px 0;
  border-bottom: 1px solid var(--color-brand-support);
  text-align: left;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-brand-quaternary);
}

.rewards .table td {
  padding: 16px 16px 16px 0;
  border-bottom: 1px solid var(--color-brand-support);
  text-align: left;
  vertical-align: middle;
  color: var(--color-brand-primary);
}

.rewards .table tr.total td {
  font-weight: 600;
}

.rewards .table td a {
  font-weight: 600;
  color: var(--color-brand-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rewards .table td a:hover {
  color: var(--color-brand-secondary);
}

/* Texte d'accueil (BO : Compte récompenses > Textes) */
#rewards_account #general_txt {
  max-width: 760px;
  padding-bottom: 32px !important;
  font-size: 16px;
  line-height: 24px;
  color: var(--color-brand-primary);
}

#rewards_account #general_txt:empty {
  display: none;
}

/* Soldes (1er tableau de « Mon compte ») : chiffres mis en avant */
#rewards_account #idTab1 > .table:first-of-type td {
  padding-top: 14px;
  font-family: var(--font-heading);
  font-size: 28px;
  line-height: 32px;
  font-weight: 500;
}

#rewards_account #min_transform,
#rewards_account #min_payment {
  margin: 0 0 24px;
}

/* ── Conversion en bon (formulaire du module, mis en ligne) ── */
#rewards_account #aior_buttons {
  margin: 0 0 8px;
}

#rewards_account #transform {
  margin: 0 0 32px;
  padding: 24px;
  border: 1px solid var(--color-brand-support);
}

#rewards_account #transform .table,
#rewards_account #transform thead,
#rewards_account #transform tbody,
#rewards_account #transform tr,
#rewards_account #transform th,
#rewards_account #transform td {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  white-space: normal;
}

#rewards_account #transform th {
  margin-bottom: 12px;
  color: var(--color-brand-primary);
}

#rewards_account #transform td {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

#rewards_account #transform td::before {
  content: none;
}

/* ── Champs ── */
.rewards .form-control {
  width: 100%;
  margin: 0;
  padding: 13px 18px;
  border: 1px solid var(--color-brand-support);
  border-radius: 0;
  background-color: var(--color-brand-background);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  color: var(--color-brand-primary);
  outline: none;
  box-shadow: none;
  transition: border-color 0.2s ease-out;
}

.rewards .form-control:focus {
  border-color: var(--color-brand-secondary);
}

.rewards select.form-control {
  width: auto;
  min-width: 140px;
  padding-right: 48px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23424705' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  cursor: pointer;
}

.rewards textarea.form-control {
  min-height: 96px;
  resize: vertical;
}

.rewards label {
  color: var(--color-brand-primary);
}

/* Case à cocher carrée Cinier */
.rewards input[type='checkbox'] {
  position: static;
  width: 20px;
  height: 20px;
  margin: 0 8px 0 0;
  vertical-align: middle;
  appearance: none;
  border: 1px solid rgb(66 71 5 / 0.4);
  border-radius: 0;
  background: var(--color-brand-background);
  opacity: 1;
  cursor: pointer;
}

.rewards input[type='checkbox']:checked {
  border-color: var(--color-brand-secondary);
  background: var(--color-brand-secondary) url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* ── Boutons : CTA Cinier (rectangulaire, bordure 40 %, flèche) ── */
.rewards .btn,
.aior_fancyconfirm .btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 80px;
  min-height: 40px;
  margin: 0;
  padding: 14px 22px;
  border: 1px solid rgb(66 71 5 / 0.4);
  border-radius: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  letter-spacing: -0.56px;
  color: var(--color-brand-primary);
  text-decoration: none !important; /* le thème souligne les liens du contenu */
  text-transform: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.3s ease-out, border-color 0.3s ease-out, color 0.3s ease-out;
}

.rewards .btn::after,
.aior_fancyconfirm .btn-primary::after {
  content: '';
  flex: none;
  width: 24px;
  height: 24px;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3Cpolyline points='12 5 19 12 12 19'/%3E%3C/svg%3E") center / contain no-repeat;
}

.rewards .btn:hover,
.aior_fancyconfirm .btn:hover {
  border-color: var(--color-brand-primary);
  background: var(--color-brand-primary);
  color: var(--color-brand-background);
}

.rewards .form-footer {
  margin-top: 24px;
}

/* ── Parrainage ── */
#rewards_sponsorship #sponsorship_text {
  max-width: 760px;
  margin: 0 0 32px;
  font-size: 16px;
  line-height: 24px;
  color: var(--color-brand-primary);
}

#rewards_sponsorship #sponsorship_form > div:first-child {
  margin-bottom: 40px;
}

#rewards_sponsorship #sponsorship_form ul {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0 !important;
  list-style: none;
}

#rewards_sponsorship #sponsorship_form li {
  padding: 18px 22px;
  border: 1px solid var(--color-brand-support);
  list-style: none;
  color: var(--color-brand-tertiary);
}

#rewards_sponsorship .cn-rewards-share {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 20px 0 0;
  font-weight: 600;
  color: var(--color-brand-primary);
  text-decoration: none;
}

#rewards_sponsorship .cn-rewards-share:hover {
  color: var(--color-brand-secondary);
}

#rewards_sponsorship #link_to_share {
  display: inline-block;
  margin: 12px 16px 0 0 !important;
  padding: 10px 14px;
  border: 1px dashed var(--color-brand-secondary);
  background: var(--color-brand-background);
  font-family: var(--font-heading);
  font-size: 14px;
  line-height: 20px;
  color: var(--color-brand-primary);
  word-break: break-all;
}

#rewards_sponsorship #sponsorship_copy_btn,
#rewards_sponsorship #sponsorship_share_btn {
  margin-top: 12px;
}

#rewards_sponsorship #list_contacts_form > label {
  display: block;
  margin: 0 0 8px;
  font-weight: 600;
}

#rewards_sponsorship #list_contacts_form textarea {
  margin-bottom: 24px;
}

#rewards_sponsorship #list_contacts_form .table td:first-child {
  width: 32px;
  font-weight: 600;
  color: var(--color-brand-quaternary);
}

#rewards_sponsorship #list_contacts_form .table .form-control {
  padding: 10px 14px;
  font-size: 14px;
  line-height: 20px;
}

#rewards_sponsorship #list_contacts_form p {
  margin: 16px 0 0;
}

#rewards_sponsorship .checkbox label {
  display: inline !important;
}

#rewards_sponsorship a.rules,
#rewards_sponsorship a.mail {
  font-weight: 600;
  color: var(--color-brand-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Inscription d'un filleul : « Vous avez été parrainé » ── */
.cn-rewards-sponsored {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 24px;
  padding: 16px 20px;
  border: 1px dashed var(--color-brand-secondary);
  background: var(--color-brand-background);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--color-brand-primary);
}

.cn-rewards-sponsored svg {
  flex: none;
  color: var(--color-brand-secondary);
}

/* ── Modales fancybox du module (confirmation de conversion, conditions, e-mail) ── */
.fancybox-skin:has(.aior_fancyconfirm),
.fancybox-skin:has(.sponsorshipPopup) {
  border-radius: 0 !important;
  background: var(--color-brand-background) !important;
}

.aior_fancyconfirm {
  padding: 8px;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  color: var(--color-brand-primary);
}

.aior_fancyconfirm .aior_fancyconfirm_button {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 24px;
}

.aior_fancyconfirm .btn {
  gap: 40px;
}

/* ── Mobile et tablette : tableaux en cartes (libellés depuis data-label) ── */
@media (max-width: 899px) {
  .rewards .idTabs {
    gap: 0 20px;
  }

  .rewards .table thead {
    display: none;
  }

  .rewards .table,
  .rewards .table tbody,
  .rewards .table tr,
  .rewards .table td {
    display: block;
    width: 100%;
  }

  .rewards .table tr {
    margin: 0 0 12px;
    padding: 8px 16px;
    border: 1px solid var(--color-brand-support);
  }

  .rewards .table td {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 8px 0;
    border: 0;
    text-align: right;
  }

  .rewards .table td::before {
    content: attr(data-label);
    flex: none;
    max-width: 50%;
    text-align: left;
    font-size: 12px;
    line-height: 16px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-brand-quaternary);
  }

  .rewards .table td:not([data-label])::before {
    content: none;
  }

  #rewards_account #idTab1 > .table:first-of-type td {
    align-items: baseline;
    font-size: 20px;
    line-height: 26px;
  }

  #rewards_account #transform {
    padding: 16px;
  }

  /* Formulaire d'invitation : libellé au-dessus du champ, « Ami n° 1 » en titre de carte */
  #rewards_sponsorship #list_contacts_form .table td {
    display: block;
    text-align: left;
  }

  #rewards_sponsorship #list_contacts_form .table td::before {
    display: block;
    max-width: none;
    margin-bottom: 6px;
  }

  #rewards_sponsorship #list_contacts_form .table td:first-child {
    display: flex;
    justify-content: flex-start;
    gap: 6px;
    width: auto;
    color: var(--color-brand-primary);
  }

  #rewards_sponsorship #list_contacts_form .table td:first-child::before {
    display: inline;
    margin: 0;
    color: var(--color-brand-primary);
  }

  .rewards .btn {
    gap: 40px;
  }
}
