/* --- CONFIGURATION GLOBALE --- */
:root {
  --bg-color: #0e0e2c;
  --chat-bg: #1c1c3c;
  --neon-color: #00fff7;
  --user-color: #00c8ff;
  --text-color: #ffffff;
  --input-bg: #0a0a20;
  --font-main: 'Comic Sans MS', 'Chalkboard SE', 'Comic Neue', sans-serif;
}

/* Thème Blanc (Light Mode) */
body.light-mode {
  --bg-color: #f0f0f0;
  --chat-bg: #ffffff;
  --neon-color: #0051ff;
  --user-color: #0088cc;
  --text-color: #000000;
  --input-bg: #e0e0e0;
}

/* Thème Noir (Contrast Mode) */
body.contrast-mode {
  --bg-color: #000000;
  --chat-bg: #111111;
  --neon-color: #ffffff;
  --user-color: #bbbbbb;
  --text-color: #ffffff;
  --input-bg: #222222;
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg-color);
  color: var(--neon-color);
  font-family: var(--font-main);
  text-align: center;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; min-height: 100vh;
  transition: background-color 0.3s, color 0.3s;
}

/* --- HEADER --- */
header { padding: 1rem; }
h1 { font-size: 2.5rem; text-shadow: 0 0 15px var(--neon-color); margin: 0; }

/* --- THEME SWITCHER --- */
#theme-switcher { position: fixed; top: 10px; right: 10px; z-index: 1000; }
#theme-switcher button {
    background: rgba(0,0,0,0.5); border: 1px solid var(--neon-color);
    color: var(--neon-color); padding: 5px 10px; border-radius: 5px; cursor: pointer;
}
body.light-mode #theme-switcher button { background: rgba(255,255,255,0.5); }

/* --- INTRO & MAINTENANCE --- */
#introScreen { margin-top: 20vh; }
#introScreen button {
  padding: 1.2em 2.5em; font-size: 1.3em; background-color: var(--neon-color);
  color: var(--bg-color); border: none; border-radius: 50px; cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 255, 247, 0.4); font-family: var(--font-main); font-weight: bold;
}
#introScreen button:hover { transform: scale(1.05); }

.maintenance-content {
  background-color: var(--chat-bg); padding: 2em; margin: 2em auto; max-width: 90%; width: 600px;
  border-radius: 10px; border: 3px solid #ff4444; box-shadow: 0 0 30px rgba(255, 68, 68, 0.2);
}
.maintenance-text { font-size: 1.5em; color: #ff4444; margin-bottom: 20px; animation: pulseWarning 2s infinite; }
@keyframes pulseWarning { 0% { opacity: 0.8; } 50% { opacity: 1; text-shadow: 0 0 10px red; } 100% { opacity: 0.8; } }

.countdown-box { display: flex; justify-content: center; gap: 15px; margin-top: 20px; }
.time-block {
    display: flex; flex-direction: column; background: #000;
    padding: 10px; border-radius: 8px; border: 1px solid var(--neon-color); min-width: 70px;
}
.time-block span:first-child { font-size: 2em; font-weight: bold; color: white; }
.time-block .label { font-size: 0.8em; color: var(--neon-color); }

/* --- CHAT CONTAINER --- */
.container {
  display: none; flex-direction: column; align-items: center; flex: 1;
  width: 100%; max-width: 800px; margin: 0 auto; padding: 10px;
}

#chatBox {
  width: 100%; flex-grow: 1; background-color: var(--chat-bg);
  padding: 15px; border-radius: 15px; text-align: left; overflow-y: auto;
  max-height: 60vh; border: 1px solid #333; margin-bottom: 10px;
}

.chat-entry {
  margin-bottom: 15px; padding: 10px; border-radius: 8px;
  line-height: 1.5; font-size: 1rem; word-wrap: break-word; position: relative;
}
.chat-entry.you { background-color: rgba(0, 200, 255, 0.1); border-left: 4px solid var(--user-color); color: var(--user-color); }
.chat-entry.hank { background-color: rgba(255, 255, 255, 0.05); border-left: 4px solid var(--neon-color); color: var(--text-color); }

/* Elements riches */
.chat-entry strong { color: #ffcc00; font-weight: bold; }
.chat-entry table { width: 100%; border-collapse: collapse; margin-top: 10px; color: inherit; }
.chat-entry th, .chat-entry td { border: 1px solid var(--neon-color); padding: 8px; text-align: left; font-size: 0.9em; }
.chat-entry th { background-color: rgba(0, 255, 247, 0.2); }
.generated-image { max-width: 100%; border-radius: 10px; margin-top: 10px; border: 2px solid var(--neon-color); }

/* Actions Message */
.msg-actions { display: flex; gap: 10px; margin-top: 8px; justify-content: flex-end; }
.msg-action-btn {
    background: transparent; border: 1px solid var(--neon-color); color: var(--neon-color);
    border-radius: 5px; cursor: pointer; font-size: 0.8rem; padding: 2px 6px; opacity: 0.6;
}
.msg-action-btn:hover { opacity: 1; background: rgba(0,255,247,0.1); }

/* --- NOUVELLE BARRE INPUT --- */
.input-area {
    display: flex; width: 100%; gap: 10px; align-items: flex-end;
    padding: 10px; background: rgba(0,0,0,0.2); border-radius: 20px;
}
.input-wrapper {
    flex-grow: 1; display: flex; align-items: flex-end;
    background-color: var(--input-bg); border: 2px solid #333;
    border-radius: 15px; transition: border-color 0.3s;
}
.input-wrapper:focus-within { border-color: var(--neon-color); }

textarea {
    flex-grow: 1; padding: 12px; font-size: 1rem; border: none;
    background-color: transparent; color: var(--text-color);
    resize: none; font-family: var(--font-main); outline: none;
    min-height: 50px; max-height: 150px;
}

button#micBtn {
    height: 48px; width: 40px; background: transparent; border: none;
    color: var(--neon-color); font-size: 1.2rem; cursor: pointer;
    margin-right: 5px; opacity: 0.7;
}
button#micBtn:hover { opacity: 1; transform: scale(1.1); }
button#micBtn.listening { color: #ff4444; animation: pulseMic 1s infinite; opacity: 1; }

button#callBtn {
    height: 50px; width: 50px; border-radius: 50%; border: none;
    background-color: #25D366; color: white; font-size: 1.5rem;
    cursor: pointer; box-shadow: 0 0 10px rgba(37, 211, 102, 0.5); transition: transform 0.2s;
}
button#callBtn:hover { transform: scale(1.1); box-shadow: 0 0 15px rgba(37, 211, 102, 0.8); }
button#callBtn.active-call { background-color: #ff4444; animation: pulseMic 1s infinite; }

button#sendBtn {
    padding: 0 20px; height: 50px; font-size: 1rem; background-color: var(--neon-color);
    color: var(--bg-color); border: none; border-radius: 15px; cursor: pointer; font-weight: bold;
}

@keyframes pulseMic { 0% {transform: scale(1);} 50% {transform: scale(1.1);} 100% {transform: scale(1);} }

/* --- CONTROLS & FOOTER --- */
.controls { display: flex; justify-content: space-between; width: 100%; margin-top: 10px; align-items: center; }
.clear-btn { background-color: #ff4444; color: white; padding: 5px 10px; font-size: 0.8em; border-radius: 5px; }

.loader-animation span {
  display: inline-block; width: 10px; height: 10px; background-color: var(--neon-color);
  border-radius: 50%; margin: 0 3px; animation: bounce 1.4s infinite ease-in-out both;
}
.loader-animation span:nth-child(1) { animation-delay: -0.32s; }
.loader-animation span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

footer { padding: 20px; font-size: 0.8em; color: #666; }

#version-container { position: fixed; bottom: 10px; left: 10px; text-align: left; z-index: 1000; font-size: 0.8rem; }
.ver-text { color: var(--neon-color); opacity: 0.7; margin-bottom: 5px; }
.credit-btn { background: transparent; border: 1px solid var(--neon-color); color: var(--neon-color); padding: 2px 8px; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }
#credits-popup {
    position: absolute; bottom: 40px; left: 0; background: var(--chat-bg);
    border: 2px solid var(--neon-color); padding: 10px; border-radius: 8px;
    width: 200px; color: var(--text-color); box-shadow: 0 0 15px rgba(0,0,0,0.5);
}

@media (max-width: 600px) {
  h1 { font-size: 2em; }
  .container { width: 100%; padding: 5px; }
  #chatBox { height: 60vh; padding: 10px; }
  textarea { font-size: 16px; }
  .countdown-box { gap: 5px; }
  .time-block { min-width: 50px; padding: 5px; }
  .time-block span:first-child { font-size: 1.5em; }
  #version-container { bottom: 5px; left: 5px; font-size: 0.7em; }
  #theme-switcher { top: 5px; right: 5px; }
}