/**
 * Atlas V3 — style.css (Frontend)
 * Rôle dans la chaîne Atlas V3 :
 * - Style UI du projet
 * - Inclut les styles pour l'en-tête avec authentification
 */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #f4f9ff;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #4a90e2;
  color: #fff;
  padding: 12px 14px;
  font-size: 1.2rem;
  font-weight: 700;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.header-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.header-auth {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(225,232,237,0.9);
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  max-width: 58vw;
}

.atlas-auth-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #bbb;
  flex: 0 0 auto;
}
.atlas-auth-dot.on { background: #2ecc71; }

.atlas-auth-text {
  color: #1a1a1a;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.atlas-auth-open {
  border: 1px solid rgba(255,255,255,0.85);
  background: rgba(255,255,255,0.15);
  color: #fff;
  border-radius: 12px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.85rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

main#app {
  flex: 1;
  padding: 76px 15px 86px 15px; /* Ajusté pour la hauteur du header */
}

#chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: calc(100vh - 76px - 86px);
  padding-right: 4px;
}

.bubble {
  padding: 12px 16px;
  border-radius: 18px;
  max-width: 85%;
  font-size: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  white-space: pre-wrap;
}

.bubble.ai {
  background: #fff;
  color: #333;
  border: 1px solid #e1e8ed;
  align-self: flex-start;
}

.bubble.user {
  background: #4a90e2;
  color: #fff;
  align-self: flex-end;
}

footer {
  background: #fff;
  padding: 10px;
  display: flex;
  gap: 8px;
  border-top: 1px solid #ddd;
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 100;
}

#msg {
  flex: 1;
  padding: 12px;
  border: 1px solid #ccc;
  border-radius: 20px;
  outline: none;
  font-size: 16px;
}

#btn-send {
  background: #4a90e2;
  color: #fff;
  border: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}

/* CONTACT MODAL (conservé si nécessaire) */
.atlas-modal.hidden { display: none; }
.atlas-modal { position: fixed; inset: 0; z-index: 1000; }
.atlas-modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.atlas-modal-content {
  position: relative;
  background: white;
  width: 92%;
  max-width: 460px;
  margin: 12vh auto;
  padding: 18px;
  border-radius: 14px;
}
.atlas-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
}

/* AUTH — bar + modal (alignement mobile) */
.atlas-authbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 0 0;
}

.atlas-auth-status {
  font-size: 0.95rem;
  color: #333;
  display: flex;
  align-items: center;
  gap: 8px;
}

.atlas-auth-dot {
  width: 10px;
  height: 10px;
  border-radius: 99px;
  background: #bbb;
  flex: 0 0 auto;
}

.atlas-auth-dot.on { background: #2ecc71; }

.atlas-authbar button {
  border: 2px solid #222;
  background: #fff;
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
}

/* Auth modal form */
.atlas-auth-form {
  display: grid;
  gap: 12px;
}

.atlas-auth-form label {
  font-size: 0.95rem;
  font-weight: 700;
  color: #111;
}

.atlas-auth-form input,
.atlas-auth-form textarea,
.atlas-auth-form select {
  width: 100%;
  padding: 12px 12px;
  border: 1px solid #ccc;
  border-radius: 12px;
  font-size: 16px;
  outline: none;
}

.atlas-auth-form textarea {
  min-height: 90px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.atlas-auth-help {
  font-size: 0.92rem;
  color: #444;
  line-height: 1.25rem;
}

.atlas-auth-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-start;
}

.atlas-auth-actions button {
  background: #4a90e2;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
}

.atlas-auth-actions button.secondary {
  background: #eef3fb;
  color: #111;
  border: 1px solid #cdd9ee;
}

.atlas-auth-feedback {
  font-size: 0.95rem;
  color: #333;
}