/* ============================================================
   Style mobile-first du coffre-fort
   ============================================================ */

:root {
  --bg:        #0f1722;
  --card:      #1a2536;
  --card-2:    #243246;
  --text:      #e7ecf3;
  --muted:     #8a98ad;
  --accent:    #4cc2ff;
  --accent-2:  #2da7e8;
  --danger:    #ff5c6c;
  --ok:        #5ad36a;
  --radius:    14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* --- Layout --- */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: 96px; /* place pour le bouton flottant */
}
.hidden { display: none !important; }

/* --- En-tête --- */
header.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
header.topbar h1 {
  font-size: 20px;
  margin: 0;
  letter-spacing: 0.5px;
}
header.topbar button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--card-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}
.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* --- Recherche --- */
.search {
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 8px 0 12px;
  z-index: 10;
}
.search input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--card-2);
  background: var(--card);
  color: var(--text);
  outline: none;
}
.search input:focus { border-color: var(--accent); }

/* --- Liste des entrées --- */
ul.entries {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
li.entry {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
li.entry .avatar {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--card-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}
li.entry .info { flex: 1; min-width: 0; }
li.entry .info .title {
  font-weight: 600;
  font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
li.entry .info .login {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
li.entry .actions { display: flex; gap: 6px; }
li.entry .actions button {
  background: var(--card-2);
  border: none;
  color: var(--text);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
}
li.entry .actions button.primary {
  background: var(--accent);
  color: #062236;
  font-weight: 600;
}

/* --- Bouton flottant + --- */
.fab {
  position: fixed;
  bottom: 24px; right: 24px;
  width: 60px; height: 60px;
  border-radius: 50%;
  background: var(--accent);
  color: #062236;
  font-size: 32px;
  border: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  z-index: 30;
}

/* --- Modales --- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  width: 100%; max-width: 460px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.modal h2 { margin: 0 0 4px; font-size: 18px; }
.modal label { font-size: 13px; color: var(--muted); }
.modal input, .modal textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-2);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.modal input:focus, .modal textarea:focus { border-color: var(--accent); }
.modal .row { display: flex; gap: 10px; }
.modal .row > * { flex: 1; }
.modal .btns {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 8px;
}
.modal button {
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
}
.modal button.ghost { background: var(--card-2); color: var(--text); }
.modal button.primary { background: var(--accent); color: #062236; }
.modal button.danger  { background: var(--danger);  color: #fff; }

/* --- Page de connexion --- */
.auth {
  min-height: 100vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px;
  gap: 16px;
}
.auth .card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  display: flex; flex-direction: column;
  gap: 12px;
}
.auth h1 { margin: 0 0 8px; font-size: 22px; text-align: center; }
.auth .tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.auth .tabs button {
  flex: 1;
  background: transparent;
  border: 1px solid var(--card-2);
  color: var(--muted);
  padding: 10px;
  border-radius: 10px;
  font-size: 14px;
}
.auth .tabs button.active {
  background: var(--accent);
  color: #062236;
  border-color: var(--accent);
  font-weight: 600;
}
.auth input {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--card-2);
  background: var(--bg); color: var(--text);
  font-size: 16px;
  outline: none;
}
.auth input:focus { border-color: var(--accent); }
.auth button.submit {
  background: var(--accent);
  color: #062236;
  font-weight: 700;
  padding: 12px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--card-2);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

/* --- État vide --- */
.empty {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
}
.empty .big { font-size: 48px; margin-bottom: 12px; }

/* --- Import --- */
.import-info {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.5;
}
.import-filename {
  font-size: 13px;
  color: var(--accent);
  margin: 6px 0 0;
  word-break: break-all;
}
.import-preview-list {
  max-height: 180px;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid var(--card-2);
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.import-preview-list .pv-item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.import-preview-list .pv-item strong { color: var(--text); }
.progress-bar-wrap {
  width: 100%;
  background: var(--bg);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.2s ease;
}
#import-progress-count, #import-progress-label {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  text-align: center;
}
#import-result-msg {
  font-size: 15px;
  text-align: center;
  margin: 8px 0 0;
}

/* --- Export --- */
.export-warning {
  background: rgba(255, 92, 108, 0.12);
  border: 1px solid rgba(255, 92, 108, 0.35);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
#export-result-msg {
  font-size: 15px;
  text-align: center;
  margin: 8px 0 0;
}
