/* Thèmes */
:root {
  --bg: #fff;
  --text: #000;
  --input-bg: #f0f0f0;
  --assistant-bg: #eef9ff;
  --border: #ccc;
  --accent: #007bff;
}

body[data-theme='dark'] {
  --bg: #121212;
  --text: #f0f0f0;
  --input-bg: #1e1e1e;
  --assistant-bg: #1a2a38;
  --border: #444;
  --accent: #4da6ff;
}
body[data-theme="dark"] #settings-menu {
  background-color: #222;
  color: #fff;
}
body[data-theme="dark"] #settings-menu .material-icons {
  color: #fff;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}



.hidden {
  display: none !important;
}

/* Conteneur principal centré */
#wrapper {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  padding: 0 1em;
  box-sizing: border-box;
  overflow: hidden;
}

/* Chat principal */
main {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  flex: 1;
}

#chat {
  flex: 1;
  overflow-y: auto;
  padding: 0.5em 1em;
  display: flex;
  flex-direction: column;
  gap: 1em;
  box-sizing: border-box;
}

.message {
  max-width: 80%;
  padding: 0.4em 0.8em;
  border-radius: 0.75em;
  line-height: 1.4;
}

.message.user {
  align-self: flex-end;
  background-color: var(--input-bg);
  color: var(--text);
}

.message.assistant {
  align-self: flex-start;
  background-color: var(--assistant-bg);
  color: var(--text);
}

.message pre {
  background-color: #00000022;
  padding: 0.5em;
  overflow-x: auto;
  border-radius: 6px;
  margin-top: 0.5em;
  font-size: 0.95em;
}

.copy-button {
  float: right;
  background: var(--accent);
  border: none;
  color: white;
  padding: 0.3em 0.6em;
  margin-top: 0.3em;
  border-radius: 5px;
  cursor: pointer;
}

/* Formulaire de saisie */
form {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  padding: 0.5em 0;
  background: var(--bg);
  width: 100%;
  border-top: none;
}

textarea {
  width: 100%;
  padding: 1.5em;
  border-radius: 1em;
  background: var(--input-bg);
  color: var(--text);
  resize: none;
  border:0px;
  outline:0px;
  font-size: 1.2em;
  min-height: 2em;
  max-height: 8em;
  box-sizing: border-box;
}

button, label {
  border: none;
  background: none;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4em;
  min-width: 44px;
}

.material-icons {
  font-size: 1.5em;
}

.actions {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 0.2em;
  padding: 0 0.5em;
  box-sizing: border-box;
}

.left-actions,
.right-actions {
  display: flex;
  gap: 0.4em;
  align-items: center;
}

#send-button {
  background-color: var(--accent);
  color: white;
  border-radius: 2em;
  padding: 0.4em 1em;
}

.image-preview {
  max-width: 60px;
  max-height: 60px;
  object-fit: contain;
  background-color: #888;
  display: block;
  border-radius: 4px;
}

.recording {
  color: red;
}

#drop-mask {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  backdrop-filter: blur(5px);
  background: rgba(0,0,0,0.2);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
  text-align: center;
}

#drop-mask.visible {
  display: flex;
}

.drop-content span {
  font-size: 64px;
  margin-bottom: 12px;
}

#attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 0.5em;
}

.attachment-item {
  width: 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  border: none;
  font-size: 12px;
  position: relative;
  justify-content: center;
}

.attachment-item img.attachment-preview {
  width: 60px;
  height: 60px;
  object-fit: contain;
  background-color: #888;
  border-radius: 4px;
  padding: 2px;
}

.attachment-item .material-icons.attachment-icon {
  font-size: 36px;
  color: var(--accent-color, #555);
  line-height: 60px;
  height: 60px;
  background: var(--input-bg);
  border-radius: 6px;
  padding: 4px;
}

.attachment-item .attachment-name {
  max-width: 100%;
  font-size: 11px;
  text-align: center;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-top: 4px;
  background: none;
  color: var(--text);
}

.attachment-item .attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  padding: 2px;
  z-index: 1;
  color: white;
}

.attachment-item .attachment-remove:hover {
  background: rgba(0, 0, 0, 0.8);
  color: red;
}
/* overlay */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#loading-overlay.hidden {
  display: none;
}

/* spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 5px solid #ddd;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* menu settings */

#header-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 1000;
  width: 100%;
  pointer-events: none;
}

#settings-button {
  pointer-events: auto;
}

/* Ajustement du menu de paramètres */
#settings-menu {
  width: 300px;
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  background-color: var(--bg);
  color: var(--text);
  position: absolute;
  top: 50px;
  right: 10px;
  z-index: 999;
}

.settings-label {
  font-weight: bold;
  margin-bottom: 0.5rem;
  display: block;
  text-align: left;
}

.settings-group {
  margin-bottom: 1rem;
}

.settings-group .settings-label {
  font-weight: bold;
  margin-bottom: 0.5rem;
  display: block;
  text-align: left;
}

/* Options alignées sur une ligne et espacées correctement */
.option-row {
  display: flex;
  gap: 0.5rem;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

/* Boutons de thème et puissance */
.option-button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.6rem;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  width: 90px;
}

.option-button span.material-icons {
  font-size: 1.2rem;
}

.option-button span.label {
  font-size: 0.9rem;
}

.option-button.active {
  background-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .option-button.active {
  background-color: rgba(255, 255, 255, 0.1);
}
