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

:root {
  --couleur: #1a73e8;
  --fond: #ffffff;
  --fond-carte: #ffffff;
  --fond-input: #ffffff;
  --gris-clair: #f5f5f5;
  --gris: #e0e0e0;
  --texte: #222222;
  --texte-doux: #666666;
  --rayon: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--fond);
  color: var(--texte);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 100%;
  max-width: 540px;
}

#btn-theme {
  position: absolute;
  top: 0;
  right: 0;
  background: none;
  border: 1.5px solid var(--gris);
  border-radius: 50%;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--texte-doux);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s;
}

#btn-theme:hover {
  border-color: var(--couleur);
  color: var(--couleur);
}

.header-identite {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

#logo-entreprise {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 3rem;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}

header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--couleur);
  line-height: 1.2;
}

header p {
  color: var(--texte-doux);
  font-size: 0.85rem;
  margin: 0;
}

.carte {
  background: var(--fond-carte);
  border: 2px solid var(--gris);
  border-radius: var(--rayon);
  padding: 2rem;
  width: 100%;
  max-width: 540px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}

/* Zone de dépôt */
.zone-depot {
  border: 2px dashed var(--gris);
  border-radius: var(--rayon);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  margin-bottom: 1.5rem;
}

.zone-depot:hover,
.zone-depot.survol {
  border-color: var(--couleur);
  background: var(--fond-depot-hover, #f0f6ff);
}

.zone-depot .icone {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.zone-depot p {
  color: var(--texte-doux);
  font-size: 0.95rem;
}

.zone-depot strong {
  color: var(--couleur);
  cursor: pointer;
}

/* Liste des fichiers sélectionnés */
.liste-fichiers {
  margin-bottom: 1.5rem;
}

.fichier-item {
  display: grid;
  grid-template-columns: 1fr 6rem auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--gris-clair);
  border-radius: 8px;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.fichier-item .nom {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fichier-item .taille {
  color: var(--texte-doux);
  font-size: 0.8rem;
  white-space: nowrap;
  text-align: right;
}

.fichier-item .supprimer {
  background: none;
  border: none;
  color: var(--texte-doux);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0 0.25rem;
}

/* Champs texte */
.champ {
  margin-bottom: 1rem;
}

.champ label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--texte-doux);
}

.champ input,
.champ textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--gris);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  resize: vertical;
  background: var(--fond-input);
  color: var(--texte);
}

.champ input:focus,
.champ textarea:focus {
  outline: none;
  border-color: var(--couleur);
}

/* Boutons */
.btn {
  display: inline-block;
  width: 100%;
  padding: 0.8rem;
  background: var(--couleur);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s;
}

.btn:hover {
  background: color-mix(in srgb, var(--couleur) 80%, black);
}

.btn:disabled {
  background: var(--gris);
  cursor: not-allowed;
}

.btn-secondaire {
  background: transparent;
  color: var(--couleur);
  border: 1.5px solid var(--couleur);
}

.btn-secondaire:hover {
  background: #f0f6ff;
}

/* Barre de progression */
.progression {
  margin-top: 1rem;
  display: none;
}

.progression-barre {
  height: 6px;
  background: var(--gris);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progression-barre-inner {
  height: 100%;
  background: var(--couleur);
  border-radius: 999px;
  width: 0%;
  transition: width 0.3s;
}

.progression-texte {
  font-size: 0.85rem;
  color: var(--texte-doux);
  text-align: center;
}

/* Résultat lien */
.resultat {
  display: none;
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: #f0f6ff;
  border-radius: var(--rayon);
  text-align: center;
}

.resultat p {
  font-size: 0.9rem;
  color: var(--texte-doux);
  margin-bottom: 0.75rem;
}

.resultat .lien {
  display: flex;
  gap: 0.5rem;
}

.resultat .lien input {
  flex: 1;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--gris);
  border-radius: 8px;
  font-size: 0.85rem;
  background: var(--fond-input);
  color: var(--texte);
}

.resultat .lien button {
  padding: 0.6rem 1rem;
  background: var(--couleur);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* Bouton "Annuler l'envoi" — affiché sous la barre de progression */
.btn-annuler {
  display: none;
  margin: 0.8rem auto 0;
  padding: 0.5rem 1.2rem;
  width: fit-content;
  background: none;
  border: 1px solid #c62828;
  color: #c62828;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-annuler:hover    { background: rgba(198, 40, 40, 0.08); }
.btn-annuler:disabled { opacity: 0.5; cursor: default; }

/* Bouton "Générer" un mot de passe */
.btn-generer {
  padding: 0.6rem 1rem;
  background: var(--gris-clair);
  color: var(--texte);
  border: 1.5px solid var(--gris);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  white-space: nowrap;
}
.btn-generer:hover { background: var(--gris); }
.btn-generer:disabled { opacity: 0.5; cursor: default; }

/* Sélecteur de durée d'expiration */
.select-expiration {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1.5px solid var(--gris);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--fond-input);
  color: var(--texte);
  cursor: pointer;
}
.select-expiration:focus { outline: none; border-color: var(--bleu); }
.select-expiration:disabled { opacity: 0.5; cursor: default; }

/* Messages d'erreur */
.erreur {
  display: none;
  padding: 0.75rem 1rem;
  background: #fdecea;
  color: #c62828;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* Bulle d'info */
.info-bulle {
  display: inline-block;
  color: var(--couleur);
  cursor: default;
  font-size: 0.85rem;
  font-weight: bold;
  position: relative;
}

.info-bulle::after {
  content: attr(data-bulle);
  display: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(100% + 6px);
  background: #333;
  color: #fff;
  font-size: 0.78rem;
  font-weight: normal;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  white-space: normal;
  width: 220px;
  line-height: 1.4;
  z-index: 10;
  pointer-events: none;
}

.info-bulle:hover::after {
  display: block;
}

/* Tooltip sombre pour les cellules de tableau (journal d'audit) */
.detail-audit {
  position: relative;
  cursor: default;
}

.detail-audit span {
  display: block;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#tooltip-audit {
  display: none;
  position: fixed;
  background: #333;
  color: #fff;
  font-size: 0.78rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  white-space: normal;
  width: 260px;
  line-height: 1.4;
  z-index: 9999;
  pointer-events: none;
}

/* Zone multi-destinataires */
.destinataire-ligne {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  align-items: center;
}

.destinataire-ligne .input-destinataire {
  flex: 1;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--gris);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
  background: var(--fond-input);
  color: var(--texte);
}

.destinataire-ligne .input-destinataire:focus {
  outline: none;
  border-color: var(--couleur);
}

.btn-retirer-dest {
  background: none;
  border: none;
  color: var(--texte-doux);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.4rem;
  line-height: 1;
}

.btn-retirer-dest:hover {
  color: #c62828;
}

.btn-ajouter-dest {
  background: none;
  border: none;
  color: var(--couleur);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-top: 0.2rem;
  text-decoration: underline;
}

.btn-ajouter-dest:disabled {
  display: none;
}

.champ-copie {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--texte-doux);
  margin-top: 0.6rem;
  cursor: pointer;
  font-weight: normal;
}

.champ-copie input[type="checkbox"] {
  width: auto;
  cursor: pointer;
}

/* Bouton de déconnexion */
.btn-deconnexion {
  background: none;
  border: none;
  color: var(--texte-doux);
  cursor: pointer;
  font-size: 0.9rem;
  text-decoration: underline;
  padding: 0;
}

.btn-deconnexion:hover {
  color: var(--texte);
}

/* Bouton Se connecter avec Microsoft */
.btn-o365 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--fond-carte);
  border: 1px solid var(--gris-clair);
  border-radius: 8px;
  color: var(--texte);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
}

.btn-o365:hover {
  background: var(--fond-depot-hover);
  border-color: var(--gris);
}

/* Bouton Se connecter avec Google */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  background: var(--fond-carte);
  border: 1px solid var(--gris-clair);
  border-radius: 8px;
  color: var(--texte);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  box-sizing: border-box;
}

.btn-google:hover {
  background: var(--fond-depot-hover);
  border-color: var(--gris);
}

/* Lien de navigation */
.nav-lien {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.9rem;
  color: var(--texte-doux);
}

.nav-lien a {
  color: var(--couleur);
  text-decoration: none;
  font-weight: 600;
}

/* Page téléchargement */
.liste-telechargement {
  list-style: none;
}

.liste-telechargement li {
  display: grid;
  grid-template-columns: 1fr 6rem auto;
  align-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--gris);
  gap: 0.75rem;
}

.liste-telechargement li:last-child {
  border-bottom: none;
}

.liste-telechargement .nom-fichier {
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liste-telechargement .taille-fichier {
  font-size: 0.8rem;
  color: var(--texte-doux);
  white-space: nowrap;
  text-align: right;
}

.liste-telechargement .btn-dl {
  padding: 0.3rem 0.6rem;
  background: var(--couleur);
  color: #fff;
  border: none;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.85rem;
  white-space: nowrap;
  cursor: pointer;
}

.btn-dl-tout {
  display: block;
  width: fit-content;
  margin: 0 auto 1.25rem auto;
  padding: 0.6rem 1.4rem;
  background: var(--couleur);
  color: #fff;
  border: none;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.expediteur-info {
  font-size: 0.88rem;
  color: var(--texte-doux);
  margin-bottom: 1.25rem;
}

.expiration {
  font-size: 0.82rem;
  color: var(--texte-doux);
  text-align: center;
  margin-top: 1rem;
}

/* Responsive */
@media (max-width: 600px) {
  .carte {
    padding: 1.25rem;
  }
}
