/* ============================================================
   Pages compte client + chat — reprend la charte du site.
   ============================================================ */

.account-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.account-header {
  background:
    var(--grad-glow),
    linear-gradient(135deg, #2352d4 0%, #152f66 55%, #070c1b 100%);
  color: #fff;
  padding: 18px 0;
  border-bottom: 1px solid rgba(127, 184, 255, 0.15);
}

.account-header-inner {
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.account-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.92rem;
}

.account-nav a {
  color: rgba(255, 255, 255, 0.85);
  font-weight: 500;
  transition: color 0.2s ease;
}

.account-nav a:hover { color: #fff; }

.account-nav .nav-cta {
  padding: 9px 16px;
  background: var(--grad-primary);
  color: #fff !important;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: var(--shadow-glow);
}

.account-user {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
}

.account-logout {
  color: rgba(255, 255, 255, 0.7) !important;
  font-size: 0.85rem;
}

.account-main {
  flex: 1;
  width: min(100% - 32px, var(--container));
  margin: 0 auto;
  padding: 56px 0 80px;
}

.account-footer {
  background: #04070f;
  color: rgba(255, 255, 255, 0.55);
  padding: 24px;
  text-align: center;
  font-size: 0.85rem;
}

.account-footer a { color: #7fb8ff; }

/* ============================================================
   Carte d'authentification (signup / login)
   ============================================================ */

.auth-card {
  max-width: 460px;
  margin: 0 auto;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--grad-primary);
}

.auth-card h1 {
  font-family: var(--font-head);
  font-size: 1.6rem;
  margin: 0 0 8px;
  color: var(--color-ink);
  letter-spacing: -0.02em;
}

.auth-card .auth-subtitle {
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 26px;
}

.auth-card label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 16px;
  color: var(--color-ink);
}

.auth-card input {
  width: 100%;
  margin-top: 7px;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
          appearance: none;
}

.auth-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(61, 126, 255, 0.15);
}

.auth-card button.primary {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.97rem;
  cursor: pointer;
  box-shadow: var(--shadow-glow);
  margin-top: 6px;
}

.auth-error {
  background: #fde8e8;
  border: 1px solid #f5b5b5;
  color: #9a1f1f;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.auth-success {
  background: #e6f8ee;
  border: 1px solid #b9e1c8;
  color: #0e4d24;
  padding: 11px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.9rem;
}

.auth-switch {
  text-align: center;
  margin-top: 18px;
  color: var(--color-muted);
  font-size: 0.9rem;
}

.auth-switch a {
  color: var(--color-primary);
  font-weight: 600;
}

/* ============================================================
   Dashboard
   ============================================================ */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 32px;
}

.dash-header h1 {
  font-family: var(--font-head);
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.02em;
}

.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.dash-card {
  padding: 22px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.dash-card .label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
}

.dash-card .value {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 700;
  margin-top: 6px;
  color: var(--color-ink);
}

.dash-section h2 {
  font-family: var(--font-head);
  font-size: 1.3rem;
  margin: 0 0 14px;
}

.quote-list {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.quote-list .item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  align-items: center;
}

.quote-list .item:last-child { border-bottom: 0; }
.quote-list .item .id { font-family: var(--font-mono); color: var(--color-muted); font-size: 0.85rem; }
.quote-list .item .type { font-weight: 600; }
.quote-list .item .date { color: var(--color-muted); font-size: 0.85rem; font-family: var(--font-mono); }
.quote-list .empty { padding: 40px; text-align: center; color: var(--color-muted); }

/* ============================================================
   Chat
   ============================================================ */

.chat-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  min-height: 60vh;
}

.chat-sidebar {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.chat-sidebar h2 {
  font-family: var(--font-head);
  font-size: 1rem;
  margin: 0;
  padding: 16px 18px;
  background: var(--color-ink);
  color: #fff;
}

.chat-sidebar .conv {
  display: block;
  padding: 14px 18px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  position: relative;
}

.chat-sidebar .conv:hover { background: var(--color-surface-2); }
.chat-sidebar .conv.active { background: rgba(61, 126, 255, 0.08); border-left: 3px solid var(--color-primary); }

.chat-sidebar .conv strong { display: block; font-weight: 600; }
.chat-sidebar .conv .meta { font-size: 0.82rem; color: var(--color-muted); margin-top: 2px; font-family: var(--font-mono); }

.chat-sidebar .conv .unread {
  position: absolute;
  right: 14px; top: 16px;
  min-width: 22px; height: 22px;
  padding: 0 7px;
  display: inline-grid;
  place-items: center;
  background: var(--color-accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
}

.chat-sidebar .empty { padding: 30px; text-align: center; color: var(--color-muted); font-size: 0.9rem; }

.chat-main {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-height: 60vh;
}

.chat-header {
  padding: 16px 22px;
  background: var(--color-ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-header h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.05rem;
}

.chat-header .who {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font-mono);
}

.chat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
}

.chat-status .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10b981;
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

.chat-messages {
  flex: 1;
  padding: 22px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--color-surface-2);
  -webkit-overflow-scrolling: touch;
}

.chat-msg {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 0.94rem;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  position: relative;
}

.chat-msg .ts {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  opacity: 0.7;
}

.chat-msg.me {
  align-self: flex-end;
  background: var(--grad-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg.them {
  align-self: flex-start;
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}

.chat-msg.system {
  align-self: center;
  background: transparent;
  color: var(--color-muted);
  font-size: 0.82rem;
  font-family: var(--font-mono);
  border: 0;
}

.chat-day {
  align-self: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-muted);
  padding: 4px 12px;
  background: rgba(13, 19, 33, 0.06);
  border-radius: 999px;
  margin: 6px 0;
}

.chat-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--color-muted);
}

.chat-composer {
  border-top: 1px solid var(--color-border);
  padding: 14px 16px;
  display: flex;
  gap: 10px;
  align-items: flex-end;
  background: var(--color-surface);
}

.chat-composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  padding: 11px 14px;
  border: 1px solid var(--color-border-strong);
  border-radius: 16px;
  font: inherit;
  font-size: 16px;
  resize: none;
  font-family: inherit;
}

.chat-composer textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(61, 126, 255, 0.15);
}

.chat-composer button {
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-glow);
}

.chat-composer button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Pièces jointes dans les bulles */
.chat-attaches {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-attach {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  font-size: 0.85rem;
  text-decoration: none;
  color: inherit;
}

.chat-msg.them .chat-attach {
  background: #f0f3fa;
  border-color: #e4e8f0;
  color: var(--color-text);
}

.chat-attach .size {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  opacity: 0.7;
  margin-left: 4px;
}

.chat-attach:hover { filter: brightness(1.06); }

/* Composer : zone de fichiers sélectionnés + bouton trombone */
.chat-picked {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 8px;
  font-size: 0.85rem;
}

.chat-picked .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(61, 126, 255, 0.1);
  color: var(--color-primary-dark);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.chat-picked .chip .size { opacity: 0.7; }

.chat-picked .chip button {
  border: 0;
  background: rgba(61, 126, 255, 0.15);
  color: var(--color-primary-dark);
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  font-size: 14px;
  padding: 0;
}

.chat-composer .file-pick {
  flex-shrink: 0;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--color-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.chat-composer .file-pick:hover {
  background: rgba(61, 126, 255, 0.08);
  color: var(--color-primary);
}

.chat-composer input[type="file"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}

.chat-composer {
  position: relative;
  flex-wrap: wrap;
}

/* Indicateur "en train d'écrire" */
.chat-typing-bubble {
  padding: 12px 16px;
  min-width: 60px;
}

.chat-typing-bubble .dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.chat-typing-bubble .dots i {
  width: 7px;
  height: 7px;
  background: var(--color-muted);
  border-radius: 50%;
  display: inline-block;
  animation: typingBlink 1.2s infinite ease-in-out;
}

.chat-typing-bubble .dots i:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-bubble .dots i:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBlink {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50%      { transform: translateY(-3px); opacity: 1; }
}

@media (max-width: 800px) {
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { max-height: 220px; overflow-y: auto; }
}
