/* Haltzugaraia – feuille de style principale */

:root {
  --rouge: #9e1b1b;
  --rouge-fonce: #7d1515;
  --vert: #1e5b3a;
  --creme: #faf6ee;
  --blanc: #ffffff;
  --texte: #2b2b2b;
  --texte-doux: #5c5c5c;
  --bordure: #e4ddd0;

  /* Polices système en attendant les polices auto-hébergées (étape 8, mode hors ligne) */
  --police-titres: Georgia, "Times New Roman", Times, serif;
  --police-texte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --rayon: 12px;
  --espace: 16px;
}

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

/* L'attribut hidden l'emporte toujours, même sur un élément stylé en flex */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--creme);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: 1.0625rem;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-family: var(--police-titres);
  color: var(--rouge);
  line-height: 1.2;
}

a {
  color: var(--vert);
}

img {
  max-width: 100%;
  height: auto;
}

/* Page d'accueil neutre (aucune information sur la maison sans lien de séjour) */
.home {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--espace);
  padding: calc(var(--espace) * 2) var(--espace);
  text-align: center;
}

.home__logo {
  width: min(320px, 80vw);
}

.home__text {
  max-width: 32rem;
  margin: 0;
  color: var(--texte-doux);
}

/* ---------- Administration ---------- */

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px var(--espace);
  padding: 12px var(--espace);
  background: var(--blanc);
  border-bottom: 3px solid var(--rouge);
}

.admin-header__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--police-titres);
  font-size: 1.25rem;
  color: var(--rouge);
  text-decoration: none;
}

.admin-nav {
  display: flex;
  gap: 4px;
  flex: 1;
}

.admin-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--texte);
  text-decoration: none;
}

.admin-nav a[aria-current="page"] {
  background: var(--creme);
  color: var(--rouge);
  font-weight: 600;
}

.admin-header__logout {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.admin-header__user {
  font-size: 0.875rem;
  color: var(--texte-doux);
}

.admin-main {
  max-width: 760px;
  margin: 0 auto;
  padding: var(--espace);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  padding: var(--espace);
  margin: 0 0 var(--espace);
}

.card--narrow {
  max-width: 420px;
  margin: 10vh auto 0;
}

.card h2,
.card h3 {
  margin-top: 0;
}

fieldset.card legend {
  font-family: var(--police-titres);
  font-size: 1.25rem;
  color: var(--rouge);
  padding: 0 4px;
}

.form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  flex: 1;
}

.field small {
  color: var(--texte-doux);
  font-weight: normal;
}

.field input,
.field select,
.field textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--blanc);
  width: 100%;
  min-height: 44px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--vert);
  outline-offset: 1px;
}

.field__error {
  color: var(--rouge);
  font-size: 0.875rem;
}

.field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--espace);
}

.field-row .field {
  min-width: 140px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--vert);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: var(--espace) 0;
}

.form-actions form {
  margin: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--vert);
  color: var(--blanc);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button--ghost {
  background: transparent;
  color: var(--vert);
  border: 1px solid var(--vert);
}

.button--danger {
  background: var(--rouge);
}

.link-button {
  border: 0;
  background: none;
  color: var(--vert);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

.alert {
  padding: 12px var(--espace);
  border-radius: 8px;
  margin: 0 0 var(--espace);
}

.alert--error {
  background: #fbe9e9;
  color: var(--rouge-fonce);
}

.alert--success {
  background: #e6f2eb;
  color: var(--vert);
}

.alert--info {
  background: #f1ede4;
}

.muted {
  color: var(--texte-doux);
}

.ok {
  color: var(--vert);
}

.pending {
  color: var(--texte-doux);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: var(--espace) 0;
  border-bottom: 1px solid var(--bordure);
}

.tabs a {
  padding: 10px 14px;
  color: var(--texte);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.tabs a[aria-current="page"] {
  border-bottom-color: var(--rouge);
  color: var(--rouge);
  font-weight: 600;
}

.stay-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stay-item {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}

.stay-item--inactive {
  opacity: 0.6;
}

.stay-item__link {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px var(--espace);
  color: inherit;
  text-decoration: none;
}

.stay-item__name {
  font-family: var(--police-titres);
  font-size: 1.2rem;
  color: var(--rouge);
}

.stay-item__meta,
.stay-item__tracking {
  font-size: 0.9rem;
  color: var(--texte-doux);
}

.stay-item__tracking {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 6px;
}

.inline-actions form {
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--creme);
  border: 1px solid var(--bordure);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--texte-doux);
}

.badge--current {
  background: #e6f2eb;
  color: var(--vert);
}

.badge--upcoming {
  background: #f1ede4;
  color: var(--texte);
}

.badge--cancelled {
  background: #fbe9e9;
  color: var(--rouge-fonce);
}

.facts {
  display: grid;
  grid-template-columns: minmax(120px, 34%) 1fr;
  gap: 8px var(--espace);
  margin: 0;
}

.facts dt {
  color: var(--texte-doux);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.message-copy {
  width: 100%;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  padding: 10px 12px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--creme);
  resize: vertical;
}

.copy-field {
  display: flex;
  gap: 8px;
}

.copy-field input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.9rem;
  padding: 10px 12px;
  border: 1px solid var(--bordure);
  border-radius: 8px;
  background: var(--creme);
}

.plain {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

@media (max-width: 520px) {
  .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .facts dd {
    margin-bottom: 8px;
  }

  .admin-header__user {
    display: none;
  }
}

.admin-header__logout .button {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.9rem;
  font-weight: 500;
}

/* ---------- Page du locataire ---------- */

.g-page {
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

.g-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espace);
  padding: 12px var(--espace);
  background: var(--creme);
  border-bottom: 1px solid var(--bordure);
}

.g-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--police-titres);
  font-size: 1.3rem;
  color: var(--rouge);
  text-decoration: none;
}

/* Bandeau hors ligne */
.g-offline {
  margin: 0;
  padding: 8px var(--espace);
  background: #fff4d6;
  color: var(--texte);
  font-size: 0.9rem;
  text-align: center;
}

.g-btn--pdf {
  margin-top: 4px;
}

/* Sélecteur de langue FR · EN · ES */
.g-lang {
  display: flex;
  gap: 4px;
}

.g-lang a {
  min-width: 40px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--texte-doux);
  text-decoration: none;
}

.g-lang a[aria-current] {
  background: var(--vert);
  color: var(--blanc);
}

.g-hero__lang {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  padding: 2px;
  border-radius: 10px;
  background: rgb(255 255 255 / 0.88);
}

.g-closed-lang {
  display: flex;
  justify-content: flex-end;
  padding: 12px var(--espace) 0;
}

.g-hero {
  position: relative;
  height: min(58vh, 460px);
  min-height: 300px;
  overflow: hidden;
  background: var(--vert);
}

.g-hero__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 55%;
}

.g-hero__overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 48px var(--espace) var(--espace);
  background: linear-gradient(to top, rgb(0 0 0 / 0.72), rgb(0 0 0 / 0));
  color: var(--blanc);
}

.g-hero__logo {
  display: block;
  margin-bottom: 6px;
  border-radius: 8px;
}

.g-hero__overlay h1 {
  margin: 0;
  color: var(--blanc);
  font-size: clamp(1.8rem, 7vw, 2.6rem);
}

.g-hero__overlay p {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.g-main {
  max-width: 640px;
  margin: 0 auto;
  padding: var(--espace);
}

.g-title {
  margin: 8px 0 var(--espace);
}

.g-title--urgent {
  color: var(--rouge);
}

.g-welcome p {
  margin: 0 0 8px;
}

.g-muted {
  color: var(--texte-doux);
}

.g-small {
  font-size: 0.9rem;
}

.g-empty {
  padding: var(--espace);
  border: 1px dashed var(--bordure);
  border-radius: var(--rayon);
  color: var(--texte-doux);
  text-align: center;
}

.g-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espace);
  margin: var(--espace) 0;
  padding: 14px var(--espace);
  border-radius: var(--rayon);
  background: var(--rouge);
  color: var(--blanc);
  text-decoration: none;
}

.g-card {
  margin: 0 0 var(--espace);
  padding: var(--espace);
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}

.g-card h2 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

.g-card p {
  margin: 0 0 10px;
}

.g-card--accent {
  border-color: var(--vert);
}

.g-card__photo {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 10px;
}

.g-big {
  font-size: 1.15rem;
  font-weight: 600;
}

.g-note {
  font-size: 0.95rem;
  color: var(--texte-doux);
}

.g-ok {
  color: var(--vert);
  font-weight: 600;
  margin: 8px 0 0;
}

.g-list {
  margin: 0;
  padding-left: 1.2em;
}

.g-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.g-actions--stack {
  flex-direction: column;
}

.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--vert);
  color: var(--blanc);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.g-btn--ghost {
  background: var(--blanc);
  color: var(--vert);
  border: 2px solid var(--vert);
}

.g-form {
  margin-top: var(--espace);
  padding-top: var(--espace);
  border-top: 1px solid var(--bordure);
}

.g-card--accent .g-form,
.g-form:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.g-form label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.g-form__row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.g-form .g-form__row select {
  flex: 1 1 220px;
}

.g-form select {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--bordure);
  border-radius: 10px;
  background: var(--blanc);
  font: inherit;
}

.g-check {
  display: flex !important;
  align-items: flex-start;
  gap: 12px;
  font-weight: normal !important;
  margin-bottom: 12px;
}

.g-check input {
  width: 24px;
  height: 24px;
  flex: none;
  accent-color: var(--vert);
}

.g-box {
  margin: var(--espace) 0;
  padding: var(--espace);
  border-radius: var(--rayon);
}

.g-box--green {
  background: #e6f2eb;
  border-left: 5px solid var(--vert);
}

.g-box h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: var(--vert);
}

.g-box ul {
  margin: 0;
  padding-left: 1.2em;
}

.g-card .g-calls {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.g-call {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 84px;
  padding: 10px;
  border: 2px solid var(--rouge);
  border-radius: var(--rayon);
  color: var(--rouge);
  text-align: center;
  text-decoration: none;
}

.g-call--main {
  background: var(--rouge);
  color: var(--blanc);
}

.g-call__number {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.1;
}

.g-call__label {
  font-size: 0.85rem;
}

.g-urgent {
  position: fixed;
  right: var(--espace);
  bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--rouge);
  color: var(--blanc);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.25);
}

.g-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--blanc);
  border-top: 1px solid var(--bordure);
}

.g-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  color: var(--texte-doux);
  font-size: 0.8rem;
  text-decoration: none;
}

.g-nav a[aria-current="page"] {
  color: var(--rouge);
  font-weight: 700;
}

.g-closed h1 {
  margin: 0;
}

.g-closed .g-btn {
  margin: 4px 0;
}

/* Guide en volets dépliables */
.g-accordion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.g-fold {
  background: var(--blanc);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
}

.g-fold summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--espace);
  min-height: 56px;
  padding: 12px var(--espace);
  font-family: var(--police-titres);
  font-size: 1.2rem;
  color: var(--rouge);
  cursor: pointer;
  list-style: none;
}

.g-fold summary::-webkit-details-marker {
  display: none;
}

.g-fold summary::after {
  content: "+";
  font-family: var(--police-texte);
  font-size: 1.5rem;
  color: var(--vert);
}

.g-fold[open] summary::after {
  content: "−";
}

.g-fold__body {
  padding: 0 var(--espace) var(--espace);
}

.g-fold__body > :first-child {
  margin-top: 0;
}

.g-fold__body ul,
.g-fold__body ol,
.g-card ul,
.g-card ol {
  padding-left: 1.3em;
}

.g-fold__body li,
.g-card li {
  margin-bottom: 4px;
}

.g-wifi {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--espace);
  margin-bottom: 12px;
}

.g-wifi__qr svg {
  width: 160px;
  height: 160px;
  background: var(--blanc);
}

.g-wifi__facts {
  margin: 0;
}

.g-wifi__facts dt {
  color: var(--texte-doux);
  font-size: 0.9rem;
}

.g-wifi__facts dd {
  margin: 0 0 8px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

/* Administration du contenu */
.content-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 0;
  border-bottom: 1px solid var(--bordure);
}

.badge--todo {
  background: #fff4d6;
  border-color: #e9c46a;
  color: #7a5b00;
}

.content-photo {
  max-width: 280px;
  border-radius: 8px;
  display: block;
  margin-bottom: 8px;
}

.content-preview {
  border-left: 3px solid var(--bordure);
  padding-left: 12px;
}

.field textarea {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.95rem;
}

/* Galerie de photos d'une rubrique */
.g-gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 12px;
}

.g-gallery--single {
  grid-template-columns: 1fr;
}

.g-gallery figure {
  margin: 0;
}

.g-gallery img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  background: var(--creme);
}

.g-gallery--single img {
  aspect-ratio: auto;
}

.g-gallery figcaption {
  margin-top: 4px;
  font-size: 0.85rem;
  line-height: 1.35;
  color: var(--texte-doux);
}

/* Photos dans l'éditeur de contenu */
.photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--espace);
  padding: 12px 0;
  border-bottom: 1px solid var(--bordure);
}

.photo-row__img {
  width: 140px;
  height: 105px;
  object-fit: cover;
  border-radius: 8px;
}

.photo-row__fields {
  flex: 1;
  min-width: 220px;
}

.photo-row__position {
  max-width: 120px;
}

/* Checklist de départ et signalement */
.g-progress {
  margin: 4px 0 12px;
  font-weight: 700;
  color: var(--vert);
}

.g-thanks {
  margin-top: 12px;
  padding: 12px var(--espace);
  border-radius: 10px;
  background: #e6f2eb;
}

.g-thanks p {
  margin: 0 0 8px;
}

.g-error {
  color: var(--rouge-fonce);
  font-weight: 600;
}

.g-form--report textarea,
.g-form--report input[type="file"] {
  display: block;
  width: 100%;
  margin-bottom: 12px;
  font: inherit;
}

.g-form--report textarea {
  padding: 10px;
  border: 1px solid var(--bordure);
  border-radius: 10px;
}

/* Signalements (administration) */
.report {
  padding: 12px 0;
  border-bottom: 1px solid var(--bordure);
}

.report:last-child {
  border-bottom: 0;
}

.report__meta {
  margin: 0 0 4px;
  font-size: 0.9rem;
  color: var(--texte-doux);
}

.report__body p {
  margin: 0 0 6px;
}

.report__photo {
  display: block;
  max-width: 260px;
  border-radius: 8px;
}

.backup-list {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.8;
}
