/* === Feuille de style immersive JDR === */
@import url('https://fonts.googleapis.com/css2?family=Cinzel&family=EB+Garamond&display=swap');

:root {
  --ecriture: #e8d3a7;
  --background: #2b1d0f;
  --primaire: #5e412f;
  --secondaire: #8b6f54;
  --accent: #d6bfa6;
  --table-stripe: #3e2b1a;
  --popup-bg: #f5ecd9;
  --overlay-bg: rgba(0, 0, 0, 0.7);
  --changeTheme-bg: rgba(185, 138, 92, 0.7);
  --hover-btn: #a07b5d;
  --font-title: 'Cinzel', serif;
  --font-body: 'EB Garamond', serif;
}
/* === Page d'accueil immersive === */
.home-page {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0 20px;
  background: url('/assets/dragon-sigil.jpg') no-repeat center/cover;
  color: var(--ecriture);
  text-align: center;
  overflow: hidden;
}

.home-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(46,34,25,0.7), rgba(46,34,25,0.9));
  z-index: -1;
  pointer-events: none;
}

/* Hero section */
.home-page .hero {
  position: relative;
  z-index: 1;
  margin-bottom: 50px;
}
.home-page .hero h2 {
  font-family: var(--font-title);
  font-size: 3.5rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 12px;
  opacity: 0;
  animation: fadeInDown 1s forwards 0.5s;
}
.home-page .hero .ornament {
  position: relative;
  display: inline-block;
  width: 80px;
  height: 4px;
  background: var(--accent);
  margin: 12px auto;
  opacity: 0;
  animation: fadeIn 1s forwards 0.8s;
}
.home-page .hero .ornament::before,
.home-page .hero .ornament::after {
  content: '';
  position: absolute;
  top: -8px;
  width: 20px;
  height: 20px;
  background: var(--accent);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}
.home-page .hero .ornament::before { left: -30px; transform: rotate(180deg); }
.home-page .hero .ornament::after  { right: -30px; }
.home-page .hero p {
  font-size: 1.3rem;
  margin-top: 20px;
  opacity: 0;
  animation: fadeIn 1s forwards 1.1s;
}

/* Actions (boutons et formulaire) */
.home-page .actions {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 30px;
  width: 100%;
  max-width: 960px;
  margin-bottom: 60px;
  opacity: 0;
  animation: fadeIn 1s forwards 1.4s;
}

.home-page .actions > * {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1;
}/* Bring hero and actions above the gradient overlay */


/* Boutons principaux */
.home-page .actions .btn {
  flex: 1;
  padding: 14px 20px;
  font-family: var(--font-title);
  font-size: 1.05rem;
  background: var(--secondaire);
  border: none;
  border-radius: 8px;
  color: var(--ecriture);
  box-shadow: 5px 5px 15px rgba(0,0,0,0.4), -5px -5px 15px rgba(255,255,255,0.1);
  transition: transform 0.2s, box-shadow 0.2s;
}
.home-page .actions .btn:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 8px 8px 20px rgba(0,0,0,0.5), -8px -8px 20px rgba(255,255,255,0.1);
}


/* Formulaire de sélection */
.select-form {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 500px;
}
.select-form select {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: rgba(255,255,255,0.9);
  color: #333;
  font-family: var(--font-body);
  appearance: none;
}
.select-form button {
  padding: 12px 16px;
  font-size: 1rem;
}

/* Animations clés */
@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Responsive – mobile first */
@media (max-width: 640px) {
  .home-page .hero h2 {
    font-size: 2.4rem;
  }
  .home-page .hero p {
    font-size: 1.1rem;
  }
  .home-page .actions {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .select-form {
    flex-direction: column;
  }
}


/* Base */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--font-body);
  background-color: var(--background);
  color: var(--ecriture);
  text-align: center;
}

/* Header / Footer */
header, footer {
  background-color: rgba(46, 34, 25, 0.95);
  color: var(--accent);
  padding: 20px;
  width: 100%;
  position: sticky;
  z-index: 10;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  font-family: var(--font-title);
  letter-spacing: 1px;
}
header { top: 0; }
footer { bottom: 0; padding: 10px; box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.5); }

/* Main content */
main {
  padding: 50px 20px;
  background-color: rgba(255, 248, 235, 0.05);
  border-radius: 12px;
  margin: 20px auto;
  max-width: 1200px;
}

.page-title {
  font-family: var(--font-title);
  margin-bottom: 20px;
  font-size: 2rem;
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  background-color: var(--secondaire);
  color: var(--ecriture);
  border: 2px solid var(--accent);
  border-radius: 12px;
  margin: 10px;
  cursor: pointer;
  text-decoration: none;
  font-size: 1.1rem;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.3);
  font-family: var(--font-title);
  transition: background 0.3s;
}
.btn:hover { background-color: var(--hover-btn); }
.btn-small {
  padding: 6px 10px;
  font-size: 0.85rem;
  margin: 2px;
}

/* Tables */
table, .styled-table {
  width: 95%;
  margin: 20px auto;
  border-collapse: collapse;
  color: var(--ecriture);
  background-color: rgba(94, 65, 47, 0.1);
  font-size: 0.95rem;
}
th, td {
  border: 1px solid var(--accent);
  padding: 12px;
  text-align: center;
}
th {
  background-color: var(--secondaire);
  color: var(--ecriture);
  font-family: var(--font-title);
}
tr:nth-child(even) { background-color: var(--table-stripe); }

/* Inputs, selects */
input[type="text"], input[type="number"], select {
  padding: 10px;
  margin: 10px 0;
  width: 100%;
  max-width: 300px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  font-size: 1rem;
  background-color: rgba(255, 255, 255, 0.85);
  font-family: var(--font-body);
}

/* Theme switch */
.changeTheme {
  cursor: pointer;
  width: 200px;
  height: 50px;
  background: var(--changeTheme-bg);
  color: var(--ecriture);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  border-radius: 8px;
  font-family: var(--font-title);
  border: 2px solid var(--accent);
  margin: 20px auto;
}

/* Popup & Overlay - base state */
.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-bg);
  z-index: 999;
}
.popup {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--popup-bg);
  padding: 30px;
  border: 5px double var(--primaire);
  border-radius: 12px;
  z-index: 1000;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.6);
  color: var(--primaire);
  font-family: var(--font-body);
}

/* Popup & Overlay - visible state */
.overlay.active {
  display: block;
}
.popup.open {
  display: block;
}

/* Light theme override */ */
:root.light-theme {
  --ecriture: #1a1a1a;
  --background: #f8f8f8;
  --primaire: #c8b29d;
  --secondaire: #a48973;
  --accent: #947661;
  --table-stripe: #f2f0eb;
  --popup-bg: #ffffff;
  --overlay-bg: rgba(0, 0, 0, 0.3);
  --changeTheme-bg: rgba(0, 0, 0, 0.1);
  --hover-btn: #b59a85;
}
/* Login form styling */
.form-container {
  max-width: 400px;
  margin: 40px auto;
  padding: 30px;
  background: rgba(255,248,235,0.1);
  border-radius: 10px;
  box-shadow: 0 0 15px rgba(0,0,0,0.3);
}

/* --- Alignement des champs du login --- */
.login-form {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 10px 20px;
  align-items: center;
  justify-content: center;
}

.login-form label {
  /* labels à droite */
  text-align: right;
  font-family: var(--font-title);
  color: var(--accent);
}
.login-form input {
  /* inputs côté droit, pleine largeur de leur colonne */
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background-color: rgba(255,255,255,0.9);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.error-message {
  color: #e05c5c;
  font-weight: bold;
  margin-bottom: 15px;
}


/* ==== Styles de la page de connexion ==== */

/* Fond immersive */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px); /* header + footer height */
  
}

/* Carte de connexion */
.login-card {
  background: rgba(46, 34, 25, 0.85);
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.7);
  max-width: 360px;
  width: 100%;
  color: var(--ecriture);
  font-family: var(--font-body);
}

/* Titres */
.login-title {
  font-family: var(--font-title);
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--accent);
}
.login-subtitle {
  font-size: 0.95rem;
  margin-bottom: 20px;
  opacity: 0.8;
}

/* Messages d’erreur */
.error-message {
  background: #e05c5c;
  padding: 8px;
  border-radius: 6px;
  margin-bottom: 15px;
  color: #fff;
  font-weight: bold;
  text-align: center;
}

/* Formulaire en grille */
.login-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
}

/* Labels stylés */
.login-form label {
  text-align: left;
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: var(--accent);
}

/* Champs */
.login-form input {
  padding: 12px 16px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  font-size: 1rem;
  background: rgba(255,255,255,0.9);
  color: #333;
  transition: border-color 0.3s ease;
}
.login-form input:focus {
  outline: none;
  border-color: var(--hover-btn);
}

/* Icône œil */
.password-wrapper {
  position: relative;
}
.password-wrapper input {
  width: 100%;
}
.toggle-visibility {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--accent);
}

/* Bouton connexion */
.login-btn {
  margin-top: 10px;
  width: 100%;
  font-size: 1.1rem;
}

/* Ligne des liens */
.links-row {
  margin-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.link-forgot {
  color: var(--ecriture);
  text-decoration: underline;
  font-size: 0.85rem;
}
/* === Inventory Grid in Popups === */
.popup .inventory-grid {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.popup ul li {
  background: rgba(94, 65, 47, 0.1);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.popup ul li input[type="number"] {
  width: 50px;
  margin: 0 5px;
}

.popup ul li button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  color: var(--accent);
}
/* === Inventory Grid in Popups (only inventory) === */
.popup .inventory-grid {
  list-style: none;
  margin: 20px 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.popup .inventory-grid li {
  background: rgba(94, 65, 47, 0.1);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.popup .inventory-grid li:hover {
  background: rgba(94, 65, 47, 0.2);
  box-shadow: 0 0 10px rgba(0,0,0,0.3);
  transform: translateY(-2px);
}
/* === Inventory Item Text Clamp & Layout === */
.popup .inventory-grid li {
  display: flex;
  flex-direction: column;
  max-height: 180px;
  position: relative;
}
.popup .inventory-grid li span {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.popup .inventory-grid li input,
.popup .inventory-grid li button {
  flex: 0 0 auto;
  margin-top: 6px;
}
.popup .inventory-grid li:hover span {
  /* Optionally expand to show full text on hover */
  -webkit-line-clamp: unset;
}

.popup .inventory-grid li input[type="number"] {
  width: 80px;
  padding: 8px;
  font-size: 1rem;
}
/* === Header layout === */
.site-header {
  background-color: rgba(46, 34, 25, 0.95);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
}

.site-title {
  font-family: var(--font-title);
  color: var(--accent);
  font-size: 1.8rem;
}

.user-actions {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info {
  font-size: 0.9rem;
  color: var(--ecriture);
}

.logout-btn {
  background-color: var(--secondaire);
  color: var(--ecriture);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 6px 12px;
  font-family: var(--font-title);
  transition: background 0.3s;
}

.logout-btn:hover {
  background-color: var(--hover-btn);
}

.theme-switch {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  gap: 4px;
  align-items: center;
  color: var(--ecriture);
}
