/* =====================================================
   Visit Siliana — Authentification (boutons, modale, admin)
   Utilise les variables de style.css (--forest-*, --gold-*, ...)
   ===================================================== */

/* ---------- Boutons du header ---------- */
.auth-bar { display: flex; align-items: center; gap: 8px; }

.auth-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 8px 16px; border-radius: 999px;
  font-family: var(--font); font-size: .86rem; font-weight: 700; line-height: 1;
  white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: var(--transition);
}
/* Sur le hero (header transparent) */
.auth-btn--ghost { background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,.7); }
.auth-btn--ghost:hover { background: #fff; color: var(--forest-700); }
.auth-btn--solid { background: var(--gold-500); color: #3a2a05; border: 1.5px solid var(--gold-500); }
.auth-btn--solid:hover { background: var(--gold-400); transform: translateY(-2px); }
/* Header "scrolled" (fond blanc) */
#header.scrolled .auth-btn--ghost { color: var(--text); border-color: var(--border); }
#header.scrolled .auth-btn--ghost:hover { background: var(--forest-600); color: #fff; border-color: var(--forest-600); }

/* Utilisateur connecté */
.auth-user { display: inline-flex; align-items: center; gap: 8px; color: #fff; font-size: .9rem; font-weight: 600; }
#header.scrolled .auth-user { color: var(--text); }
.auth-user-name { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-role { padding: 3px 10px; border-radius: 999px; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.auth-role--admin { background: var(--gold-500); color: #3a2a05; }
.auth-role--user { background: var(--forest-100); color: var(--forest-700); }

@media (max-width: 768px) {
  .auth-bar { gap: 5px; }
  .auth-btn { padding: 7px 11px; font-size: .74rem; }
  .auth-user-name { display: none; }
}
@media (max-width: 400px) {
  .auth-btn { padding: 6px 9px; font-size: .68rem; }
  .auth-role { display: none; }
}

/* ---------- Modale ---------- */
body.auth-open { overflow: hidden; }
.auth-modal {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(15,21,18,.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  animation: authFade .2s ease;
}
.auth-modal[hidden] { display: none; }
@keyframes authFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes authRise { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }

.auth-modal__box {
  position: relative; width: 100%; max-width: 410px; max-height: 92vh; overflow-y: auto;
  background: var(--paper, #fff); color: var(--text); border-radius: var(--radius-lg);
  padding: 36px 32px 28px; box-shadow: var(--shadow-xl);
  animation: authRise .3s cubic-bezier(.2,.8,.2,1);
}
.auth-modal__close {
  position: absolute; top: 12px; inset-inline-end: 14px;
  width: 36px; height: 36px; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-light); font-size: 1.6rem; line-height: 1; cursor: pointer;
  transition: var(--transition);
}
.auth-modal__close:hover { background: var(--forest-100); color: var(--forest-700); }
.auth-modal__title { font-family: var(--font-display); font-size: 1.6rem; color: var(--forest-800); margin: 0 0 22px; }

.auth-field { margin-bottom: 14px; }
.auth-field[hidden] { display: none; }
.auth-field label { display: block; margin-bottom: 6px; font-size: .84rem; font-weight: 600; color: var(--text-light); }
.auth-field input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: .96rem; color: var(--text); background: #fff; transition: var(--transition);
}
.auth-field input:focus { outline: none; border-color: var(--forest-500, var(--forest-600)); box-shadow: 0 0 0 4px rgba(28,83,64,.12); }

.auth-error { min-height: 1.2em; margin: 4px 0 12px; font-size: .85rem; font-weight: 600; color: #b3261e; }
.auth-submit {
  width: 100%; padding: 13px; border: 0; border-radius: 999px; cursor: pointer;
  font-family: var(--font); font-size: .98rem; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--forest-600), var(--forest-700));
  box-shadow: 0 8px 22px rgba(28,83,64,.28); transition: var(--transition);
}
.auth-submit:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(28,83,64,.36); }
.auth-submit:disabled { opacity: .6; cursor: wait; transform: none; }

.auth-switch { margin: 18px 0 0; text-align: center; font-size: .88rem; color: var(--text-light); }
.auth-switch button { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--forest-600); cursor: pointer; text-decoration: underline; }

/* ---------- Page admin ---------- */
.admin-page { background: var(--bg-light, #faf7f0); min-height: 100vh; }
.admin-top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; background: var(--forest-800); color: #fff;
}
.admin-top a.admin-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; text-decoration: none; }
.admin-top img { height: 38px; width: auto; }
.admin-top .auth-user { color: #fff; }

.admin-main { max-width: 980px; margin: 0 auto; padding: 36px 20px 60px; }
.admin-main h1 { font-family: var(--font-display); font-size: 2rem; color: var(--forest-800); margin: 0 0 6px; }
.admin-main > p { margin: 0 0 26px; color: var(--text-light); }

.admin-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 28px; }
.admin-stat { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.admin-stat strong { display: block; font-size: 1.9rem; color: var(--forest-700); font-family: var(--font-display); }
.admin-stat span { font-size: .84rem; color: var(--text-light); }

.admin-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.admin-table th, .admin-table td { padding: 14px 18px; text-align: start; font-size: .92rem; border-bottom: 1px solid var(--border); }
.admin-table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--bg-light, #faf7f0); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-del { padding: 6px 12px; border: 1.5px solid #e6b8b4; border-radius: 999px; background: #fff; color: #b3261e; font: 700 .78rem var(--font); cursor: pointer; transition: var(--transition); }
.admin-del:hover { background: #b3261e; color: #fff; border-color: #b3261e; }
.admin-empty { padding: 28px; text-align: center; color: var(--text-muted); }

.admin-denied { max-width: 440px; margin: 18vh auto; padding: 0 20px; text-align: center; }
.admin-denied h1 { font-family: var(--font-display); color: var(--forest-800); }
.admin-denied .auth-btn { margin-top: 10px; }
.admin-denied .auth-btn--ghost { color: var(--forest-700); border-color: var(--forest-600); }

/* ---------- Mot de passe oublié ---------- */
.auth-link { border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--forest-600); cursor: pointer; text-decoration: underline; }
.auth-link[hidden] { display: none; }
.auth-link--forgot { display: block; margin: -4px 0 6px; font-size: .84rem; text-align: end; width: 100%; }
.auth-info { margin: -10px 0 18px; font-size: .88rem; line-height: 1.5; color: var(--text-light); white-space: pre-line; }
.auth-info:empty { display: none; }
.auth-switch .auth-link { text-decoration: underline; }
