/* Ajustements par-dessus Pico CSS */

/* ---- Thème noir et or ----
   Le site est toujours sombre (data-theme="dark" sur <html>) ; l'or remplace le bleu de Pico. */
:root[data-theme="dark"] {
  --or: #d4af37;
  --or-clair: #e6c65c;
  --or-rgb: 212 175 55;
  --encre-sur-or: #14110a;

  --pico-background-color: #0b0b0b;
  --pico-color: #ece6d6;
  --pico-h1-color: #f3ead2;
  --pico-h2-color: #f3ead2;
  --pico-h3-color: #f3ead2;
  --pico-h4-color: var(--or);
  --pico-muted-color: #a39d8c;
  --pico-muted-border-color: #2a2720;

  --pico-card-background-color: #151412;
  --pico-card-sectioning-background-color: #1c1a16;
  --pico-card-box-shadow: 0 0 0 1px #2a2720;

  --pico-primary: var(--or);
  --pico-primary-background: var(--or);
  --pico-primary-border: var(--or);
  --pico-primary-underline: rgb(var(--or-rgb) / 0.5);
  --pico-primary-hover: var(--or-clair);
  --pico-primary-hover-background: var(--or-clair);
  --pico-primary-hover-border: var(--or-clair);
  --pico-primary-hover-underline: var(--or-clair);
  --pico-primary-focus: rgb(var(--or-rgb) / 0.4);
  --pico-primary-inverse: var(--encre-sur-or);

  --pico-contrast: #ece6d6;
  --pico-contrast-background: #ece6d6;
  --pico-contrast-border: #ece6d6;
  --pico-contrast-hover-background: #ffffff;
  --pico-contrast-inverse: #0b0b0b;

  --pico-form-element-background-color: #151412;
  --pico-form-element-border-color: #3a362c;
  --pico-form-element-focus-color: var(--or);
  --pico-form-element-active-border-color: var(--or);

  --pico-table-border-color: #2a2720;
  --pico-table-row-stripped-background-color: #131210;
}

body {
  background-color: var(--pico-background-color);
}

.marque strong {
  color: var(--or);
  letter-spacing: 0.04em;
}

/* Respecte l'encoche et la barre d'accueil de l'iPhone en mode application */
body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: env(safe-area-inset-bottom);
}

.marque {
  text-decoration: none;
}

.deconnexion {
  margin: 0;
}

.deconnexion button {
  margin: 0;
  padding: 0.35rem 0.75rem;
}

/* ---- Accueil ---- */
.salutation {
  margin-bottom: 1.5rem;
}

.salutation p {
  color: var(--pico-muted-color);
}

/* Module actif : grande carte, liseré doré, résumé en direct et raccourcis */
.module {
  border-top: 3px solid var(--or);
}

.module-tete {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--pico-h1-color);
  text-decoration: none;
  font-size: 1.35rem;
  font-weight: 600;
}

.module-tete:hover .module-fleche {
  transform: translateX(4px);
}

.module-fleche {
  margin-left: auto;
  color: var(--or);
  transition: transform 0.15s;
}

.module-resume {
  margin: 1rem 0 0;
  padding: 0;
}

.module-resume li {
  list-style: none;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--pico-muted-border-color);
}

.module-resume li:last-child {
  border-bottom: none;
}

.module-raccourcis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.module-raccourcis a {
  margin: 0;
}

/* Modules à venir : petites tuiles discrètes */
.section-bientot {
  margin-top: 2rem;
  font-size: 1rem;
  color: var(--pico-muted-color);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.bientot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.75rem;
}

.tuile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem;
  border: 1px dashed var(--pico-muted-border-color);
  border-radius: var(--pico-border-radius);
  color: var(--pico-muted-color);
}

.tuile .emoji {
  font-size: 1.4rem;
  filter: grayscale(0.6);
}

.tuile strong {
  color: var(--pico-color);
}

/* Pages de connexion : formulaire centré, largeur réduite */
.focus {
  max-width: 28rem;
  margin: 2rem auto;
}

/* Messages de confirmation et d'erreur */
.message {
  margin-bottom: 1rem;
  border-left: 0.3rem solid var(--pico-primary);
}

.message.error {
  border-left-color: var(--pico-del-color);
}

/* ---- Module Mails ---- */
.barre-synchro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.barre-synchro form,
.barre-synchro button {
  margin: 0;
}

.barre-synchro button {
  width: auto;
  padding: 0.35rem 0.9rem;
}

.point-du-matin {
  border-left: 3px solid var(--or);
}

.groupe-mails summary {
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.mail {
  margin-bottom: 0.75rem;
  padding: 0.9rem 1rem;
}

.mail p {
  margin: 0.35rem 0;
  color: var(--pico-muted-color);
}

.mail-tete,
.mail-pied {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.mail-tete small {
  color: var(--pico-muted-color);
  white-space: nowrap;
}

.mail-expediteur {
  font-size: 0.9rem;
}

.mail.non-lu .mail-sujet {
  color: var(--pico-h1-color);
}

.pastille {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background-color: var(--or);
  vertical-align: middle;
}

.mail-pied {
  font-size: 0.85rem;
}

.echeance {
  color: var(--or);
  font-weight: 600;
}

.deconnecter-gmail {
  margin-top: 2rem;
}

.deconnecter-gmail button {
  width: auto;
}

.erreur {
  color: var(--pico-del-color);
}

/* ---- Module Gabriel ---- */

/* Onglets du module : barre « pilule », l'onglet actif rempli d'or.
   Sur téléphone la barre défile horizontalement, sans barre de défilement visible. */
nav.onglets {
  display: flex;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 0.3rem;
  margin-bottom: 1.5rem;
  background-color: var(--pico-card-background-color);
  border: 1px solid var(--pico-muted-border-color);
  border-radius: 999px;
  overflow-x: auto;
  scrollbar-width: none;
}

nav.onglets::-webkit-scrollbar {
  display: none;
}

nav.onglets a {
  flex: 1 0 auto;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  color: var(--pico-muted-color);
  font-size: 0.95rem;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}

nav.onglets a:hover {
  color: var(--pico-color);
  background-color: rgb(var(--or-rgb) / 0.08);
}

nav.onglets a[aria-current="page"] {
  background-color: var(--or);
  color: var(--encre-sur-or);
  font-weight: 600;
}

.bouton-principal {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
}

/* Tableau de bord : une carte par ligne, ou deux côte à côte (pipi et selle) */
.ligne {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ligne.deux {
  grid-template-columns: 1fr 1fr;
}

.ligne article {
  margin: 0;
}

.grand {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

/* Boutons de saisie : gros et alignés en grille, faciles à toucher la nuit */
.boutons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.75rem;
}

.boutons button {
  margin: 0;
  padding: 1rem 0.5rem;
}

/* Choix à toucher (quantité, pipi, selle) : la case native est masquée, l'étiquette sert de bouton */
.choix {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.choix.deux {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
  .choix {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* Pico donne aux étiquettes de cases une largeur ajustée au texte : on force la pleine largeur */
.choix label {
  position: relative;
  width: 100%;
  margin: 0;
}

.choix input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}

.choix span {
  display: block;
  padding: 0.9rem 0.5rem;
  text-align: center;
  border: 1px solid var(--pico-primary);
  border-radius: var(--pico-border-radius);
  color: var(--pico-primary);
  cursor: pointer;
  user-select: none;
}

.choix input:checked + span {
  background-color: var(--pico-primary);
  color: var(--pico-primary-inverse);
  font-weight: 600;
}

.choix input:focus-visible + span {
  outline: 2px solid var(--pico-primary);
  outline-offset: 2px;
}

/* Sommeil : le formulaire « déjà terminée » est séparé des boutons immédiats par un filet */
.sommeil details {
  margin: 1.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--pico-muted-border-color);
}

.sommeil details[open] summary {
  margin-bottom: 1rem;
}

.quantite-libre {
  margin-top: 1rem;
  margin-bottom: 0;
}

.navigation-periode {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.navigation-periode h2 {
  margin: 0;
  font-size: 1.2rem;
}

.navigation-periode a {
  font-size: 1.5rem;
  text-decoration: none;
  padding: 0 0.5rem;
}

.resume {
  margin-top: 1rem;
}

.note-jour textarea {
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
}

.note-pied {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.note-pied button {
  margin: 0;
  width: auto;
}

.journee .entree {
  display: inline-block;
  margin-right: 0.75rem;
}

.journee tr.dort th,
.journee tr.dort td {
  background-color: color-mix(in srgb, var(--pico-primary) 12%, transparent);
}

/* Grille de la semaine : compacte pour tenir sur un téléphone */
.grille-semaine {
  font-size: 0.8rem;
}

.grille-semaine th,
.grille-semaine td {
  padding: 0.25rem 0.35rem;
  text-align: center;
  white-space: nowrap;
}

.grille-semaine td.bu {
  background-color: rgb(var(--or-rgb) / var(--intensite));
  font-weight: 600;
}

/* Sur l'or soutenu, le texte passe en noir pour rester lisible */
.grille-semaine td.bu.fonce {
  color: var(--encre-sur-or);
}

.aliments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 0.25rem 1rem;
  margin-bottom: 1rem;
}

.aliments label {
  margin: 0;
}

.focus img {
  display: block;
  margin: 1rem auto;
  background: #fff;
  padding: 0.5rem;
}
