/* Palette :
   --paper   #EDEDE4  fond, papier légèrement vert-gris
   --ink     #21302E  texte principal, encre profonde
   --ink-60  #55645F  texte secondaire
   --line    #D7D6C9  lignes / bordures
   --amber   #B9762F  accent notes audio / enregistrement
   --sage    #5F7A5A  accent rappels / succès
   --card    #F7F6F0  fond des cartes
*/

:root {
  --paper: #EDEDE4;
  --ink: #21302E;
  --ink-60: #55645F;
  --line: #D7D6C9;
  --amber: #B9762F;
  --sage: #5F7A5A;
  --card: #F7F6F0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2 {
  font-family: 'Source Serif 4', serif;
  font-weight: 600;
  margin: 0;
}

/* ---------- Auth pages ---------- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 40px;
  width: min(90vw, 360px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-card h1 { font-size: 28px; }
.auth-card .hint { color: var(--ink-60); margin: -8px 0 0; font-size: 14px; }
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-60);
}
.auth-card input {
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: white;
  color: var(--ink);
}
.error { color: #A23E3E; font-size: 14px; margin: 0; }

/* ---------- Layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--paper);
  z-index: 5;
}
.brand { font-size: 22px; letter-spacing: 0.2px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  border: none;
  background: transparent;
  color: var(--ink-60);
  font-family: inherit;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
}
.tab.active { background: var(--card); color: var(--ink); border: 1px solid var(--line); }
.logout { color: var(--ink-60); text-decoration: none; font-size: 14px; }
.logout:hover { color: var(--ink); }

main { max-width: 720px; margin: 0 auto; padding: 24px 20px 120px; }

.status-banner {
  background: #FBEFDD;
  border: 1px solid var(--amber);
  color: #6B4A1E;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.pending-tag {
  background: var(--amber);
  color: white;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
}

.note-card.pending { opacity: 0.85; }

.view { display: none; }
.view.active { display: block; }

.search-row { margin-bottom: 20px; }
#search {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 16px;
  background: var(--card);
  color: var(--ink);
}

.notes-list { display: flex; flex-direction: column; gap: 12px; }

.note-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink-60);
  border-radius: 4px;
  padding: 16px 18px;
}
.note-card.type-audio { border-left-color: var(--amber); }
.note-card.type-text { border-left-color: var(--sage); }

.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-60);
  margin-bottom: 8px;
}
.note-content {
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 15px;
}
.note-card audio { width: 100%; margin-top: 8px; }
.note-summary {
  font-size: 13px;
  color: var(--ink-60);
  margin-top: 6px;
  font-style: italic;
}
.note-actions { display: flex; gap: 10px; margin-top: 10px; }
.note-actions button {
  border: none;
  background: none;
  color: var(--ink-60);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}
.note-actions button:hover { color: var(--ink); }

.empty-state {
  text-align: center;
  color: var(--ink-60);
  padding: 60px 20px;
  font-size: 15px;
}

/* ---------- Recap ---------- */
.recap-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.recap-header h2 { flex: 1; font-size: 22px; }

/* ---------- Floating buttons ---------- */
.fab {
  position: fixed;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: white;
  box-shadow: 0 3px 10px rgba(0,0,0,0.18);
}
.fab-text { bottom: 92px; background: var(--sage); }
.fab-audio { bottom: 24px; background: var(--amber); }

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: none;
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost {
  background: none;
  border: 1px solid var(--line);
  color: var(--ink-60);
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}

/* ---------- Dialogs ---------- */
dialog {
  border: none;
  border-radius: 8px;
  padding: 24px;
  width: min(90vw, 480px);
  background: var(--card);
  color: var(--ink);
}
dialog::backdrop { background: rgba(33, 48, 46, 0.35); }
dialog h2 { margin-bottom: 16px; font-size: 20px; }
#text-content {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  font-family: inherit;
  font-size: 15px;
  resize: vertical;
  background: white;
  color: var(--ink);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }

.audio-recorder { display: flex; flex-direction: column; gap: 14px; }
.rec-indicator { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--ink-60); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.rec-indicator.live .rec-dot { background: #A23E3E; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.hint-label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-60); }
.hint-label input {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: white;
  color: var(--ink);
}
#rec-audio-preview { width: 100%; }

@media (max-width: 480px) {
  .topbar { padding: 16px; gap: 12px; }
  .brand { font-size: 18px; }
  .tab { font-size: 13px; padding: 6px 10px; }
}
