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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: #222;
  background: #f5f5f3;
}

body {
  display: flex;
  flex-direction: column;
}

header.site-header {
  background: #1a2b1a;
  color: white;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 16px;
  min-height: 56px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  z-index: 10;
  row-gap: 8px;
  position: sticky;
  top: 0;
}

header.site-header .site-title {
  font-weight: bold;
  font-size: 17px;
  margin-right: 24px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-logo {
  height: 32px;
  width: auto;
  display: block;
}

nav.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

nav.site-nav a {
  color: #ddd;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}

nav.site-nav a:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

nav.site-nav a.active {
  background: #ff3300;
  color: white;
}

main {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

main.page-content {
  padding: 40px;
  overflow-y: auto;
}

main.map-frame {
  padding: 0;
}

main.map-frame iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.hero {
  max-width: 760px;
  margin: 0 auto;
}

.hero h1 {
  font-size: 28px;
  margin-bottom: 12px;
  color: #1a2b1a;
}

.hero p {
  font-size: 15px;
  line-height: 1.6;
  color: #444;
  margin-bottom: 12px;
}

.card-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.card-links a {
  display: block;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 18px;
  text-decoration: none;
  color: #222;
  transition: box-shadow 0.15s, transform 0.15s;
}

.card-links a:hover {
  box-shadow: 0 3px 10px rgba(0,0,0,0.12);
  transform: translateY(-2px);
}

.card-links a .card-title {
  font-weight: bold;
  font-size: 15px;
  margin-bottom: 6px;
  color: #ff3300;
}

.card-links a .card-desc {
  font-size: 13px;
  color: #666;
}

/* ===================================================================
   Widget "Administration" unique, insere dans l'en-tete (admin-auth.js)
   =================================================================== */
.admin-widget {
  margin-left: auto;
  position: relative;
}

.admin-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.admin-toggle-btn {
  background: rgba(255,255,255,0.08);
  color: #ddd;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.admin-toggle-btn:hover {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.admin-toggle-btn.connected {
  background: #4a7a2a;
  border-color: #4a7a2a;
  color: #fff;
}

.admin-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  color: #222;
  border-radius: 8px;
  padding: 14px;
  width: 230px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  z-index: 100;
}

.admin-popover form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-popover input[type="password"] {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #D3D1C7;
  /* 16px minimum : en dessous, Safari iOS zoome automatiquement sur le
     champ au focus (meme avec le zoom desactive dans le viewport), ce qui
     peut faire sortir le bouton "Se connecter" et le message de l'ecran. */
  font-size: 16px;
}

.admin-popover button {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #D3D1C7;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  /* Les <button> n'heritent pas toujours de la couleur de texte du parent
     (ils utilisent un rendu natif par defaut selon le navigateur/OS) : sans
     ceci, le texte peut devenir invisible (ex: blanc sur blanc) sur
     certains mobiles, donnant l'impression d'un bouton vide. */
  color: #222;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}

.admin-msg {
  font-size: 12px;
  color: #5F5E5A;
  margin-top: 8px;
  line-height: 1.4;
}

.admin-msg-error {
  color: #A32D2D;
}

.admin-hint {
  color: #8a8a86;
  font-size: 11px;
}

#rcsc-admin-connected-block button {
  margin-top: 4px;
  width: 100%;
}

/* ===================================================================
   Encadre "Message important", modifiable par l'administrateur
   (page d'accueil)
   =================================================================== */
.important-message {
  position: relative;
  background: #FFF4E5;
  border-left: 6px solid #ff3300;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.important-message-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.important-message-icon {
  font-size: 16px;
}

.important-message-title {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #ff3300;
}

.important-message-edit-btn {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #ffb088;
  background: #fff;
  color: #ff3300;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.important-message-edit-btn:hover {
  background: #ffe6da;
}

.important-message-text {
  font-weight: 700;
  font-size: 15px;
  color: #6B2E00;
  line-height: 1.5;
  white-space: pre-wrap;
}

.important-message-text.empty {
  font-weight: 400;
  font-style: italic;
  color: #8a5a30;
}

.important-message-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.rt-btn {
  min-width: 30px;
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid #D3D1C7;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.rt-btn:hover {
  background: #f0eee8;
}

.rt-clear {
  font-size: 11px;
  font-weight: 400;
  margin-left: auto;
}

.rt-color {
  width: 30px;
  height: 28px;
  padding: 0;
  border: 1px solid #D3D1C7;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
}

.important-message-input {
  width: 100%;
  min-height: 70px;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #D3D1C7;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  background: #fff;
  box-sizing: border-box;
}

.important-message-input:focus {
  outline: 2px solid #ffb088;
  outline-offset: 1px;
}

.important-message-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.important-message-actions button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #D3D1C7;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

#important-message-save-btn {
  background: #ff3300;
  border-color: #ff3300;
  color: #fff;
}

#important-message-clear-btn {
  color: #A32D2D;
}

/* ===================================================================
   Encadre "Statut du massif de l'Arbois" (page d'accueil)
   =================================================================== */
.arbois-status-box {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.arbois-status-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.arbois-status-title {
  font-weight: 700;
  font-size: 14px;
  color: #1a2b1a;
}

.arbois-status-refresh-btn {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #ddd;
  background: #f5f5f3;
  color: #444;
  font-size: 12px;
  cursor: pointer;
}

.arbois-status-refresh-btn:hover {
  background: #ececea;
}

.arbois-status-rows {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 14px;
  margin-bottom: 8px;
}

.arbois-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.arbois-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.arbois-green { background: #2e7d32; }
.arbois-red { background: #c62828; }
.arbois-unknown { background: #9e9e9e; }

.arbois-status-updated {
  font-size: 11px;
  color: #777;
}

.arbois-status-updated a {
  color: #1976d2;
  text-decoration: none;
}

@media (max-width: 640px) {
  header.site-header {
    padding: 10px 12px;
  }
  header.site-header .site-title {
    font-size: 15px;
    margin-right: 16px;
  }
  .site-logo {
    height: 24px;
  }
  nav.site-nav a {
    padding: 6px 10px;
    font-size: 13px;
  }
  main.page-content {
    padding: 20px 16px;
  }
  .hero h1 {
    font-size: 22px;
  }
  .hero p {
    font-size: 14px;
  }
  .card-links {
    grid-template-columns: 1fr;
  }
  .admin-widget {
    margin-left: 0;
    width: 100%;
  }
  .admin-toggle-btn {
    width: 100%;
  }
  .admin-popover {
    right: auto;
    left: 0;
    width: 100%;
    box-sizing: border-box;
  }
}
