/* Reset de base */
* {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  box-sizing: border-box;
}

/* Fond global */
body {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  margin: 0;
  padding: 20px;
}

/* Conteneur principal */
.container {
  max-width: 1200px;
  margin: 0 auto;
  background: #000;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  color: #fff;
}

/* ===== HEADER ===== */

.header-left {
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 34px 36px;
  margin: -30px -30px 26px -30px;
  border-radius: 16px 16px 0 0;
  background: linear-gradient(135deg, #5f72ff 0%, #8f5eff 100%);
  position: relative; /* pour le lang-switcher en absolute */
}

/* Logo */
.header-logo {
  width: 200px;
  max-width: 45%;
  flex-shrink: 0;
  filter: drop-shadow(0 10px 22px rgba(0,0,0,0.35));
}

/* Texte du header */
.header-text {
  text-align: left;
}

.header-text h1 {
  margin: 0 0 6px;
  font-size: 2.1em;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.header-text h2 {
  margin: 0;
  font-size: 1.05em;
  font-weight: 500;
  opacity: 0.9;
}

.header-text h3 {
  margin: 6px 0 0;
  font-size: 0.95em;
  font-weight: 400;
  opacity: 0.9;
}

/* ===== Language switcher ===== */

.lang-switcher {
  position: absolute;
  top: 16px;
  right: 16px;
}

.lang-switcher button {
  all: unset;
  box-sizing: border-box;
  cursor: pointer;
}

/* bouton principal */
.lang-switcher .lang-current {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 6px 16px !important;
  border-radius: 999px !important;
  border: 1px solid rgba(255,255,255,0.4) !important;
  background: rgba(0,0,0,0.18) !important;
  color: #fff !important;
  font-size: 14px !important;
  line-height: 1 !important;
}

/* Drapeau bouton principal */
.lang-current .lang-flag {
  position: static;
  display: inline-block;
  width: 18px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
  margin: 0;
  flex-shrink: 0;
}

/* Texte */
.lang-current .lang-label {
  display: inline-block;
}

/* Flèche */
.lang-current .lang-arrow {
  font-size: 10px;
  opacity: 0.8;
  margin-left: 2px;
}

/* Dropdown */
.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 2px;
  background: rgba(3, 3, 8, 0.7);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.45);
  padding: 6px;
  min-width: 160px;
  z-index: 50;
  opacity: 0;
  transform: translateY(-4px);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.lang-dropdown.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* boutons internes */
.lang-dropdown button {
  all: unset;
  box-sizing: border-box;
  width: 100%;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 8px 12px !important;
  color: #fff !important;
  font-size: 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
  line-height: 1.3 !important;
}

.lang-dropdown button:hover {
  background: rgba(255,255,255,0.12);
}

.lang-dropdown img.lang-flag {
  display: inline-block !important;
  position: static !important;
  width: 18px !important;
  height: 12px !important;
  object-fit: cover !important;
  border-radius: 2px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

.lang-dropdown button span {
  display: inline-block !important;
}

/* ===== Cartes / contenu ===== */

.card {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 18px;
  display: flex;
  flex-direction: column;
  position: relative;
}

#statusBadge {
  align-self: flex-start;
  margin-bottom: 10px;
}

.row-between {
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  display:inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.16);
  font-size: 0.9em;
}

/* ===== Formulaire de login ===== */

#loginForm {
  width: 100%;
}

#loginFieldset {
  width: 100%;
  border: 0;
  padding: 0;
  margin: 0;
}

.login-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.login-grid .field {
  width: 100%;
}

.login-grid input {
  width: 100%;
  padding: 12px;
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  font-size: 16px;
  background: rgba(0,0,0,0.35);
  color: #fff;
  outline: none;
}

.login-grid input::placeholder {
  color: rgba(255,255,255,0.55);
}

/* Boutons / actions */

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 14px;
}

button {
  background: #28a745;
  color: white;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
}

button:hover {
  background: #218838;
}

.secondary {
  background: #6c757d;
}

.secondary:hover {
  background: #5a6268;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Messages */

.hint {
  margin-top: 10px;
  opacity: 0.85;
  font-size: 0.95em;
  text-align: center;
}

.error-msg {
  margin-top: 8px;
  color: #ff6b6b;
  text-align: center;
  font-size: 0.9em;
  min-height: 18px;
}

/* Spinner de mise à jour */

#updateSpinner {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0,0,0,0.65);
  z-index: 10;
  pointer-events: all;
}

#updateSpinner.show {
  display: flex;
}

.spinner {
  border: 4px solid #333;
  border-top: 4px solid #28a745;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px auto;
}

#loginCard.is-updating {
  filter: blur(0.2px);
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== Responsive ===== */

@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .container {
    padding: 18px;
    border-radius: 10px;
  }

  .header-left {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    margin: -18px -18px 20px -18px;
  }

  .header-logo {
    width: 150px;
    max-width: 60%;
  }

  .header-text h1 {
    font-size: 2.4rem;
  }

  .header-text h2 {
    font-size: 1.3rem;
  }

  .header-text h3 {
    font-size: 0.95rem;
  }

  /* le lang switcher reste en haut à droite mais plus proche du bord */
  .lang-switcher {
    top: 10px;
    right: 10px;
  }

  .login-grid {
    grid-template-columns: 1fr;
  }

  .actions {
    width: 100%;
    justify-content: stretch;
  }

  .actions button {
    width: 100%;
  }
}

/* Exemple pour d'autres grilles éventuelles */
@media (max-width: 900px) {
  .compare-grid { grid-template-columns: 1fr; }
  .cmp-select { min-width: 180px; flex: 1; }
}
