/* Grundlayout - alles auf 100% Höhe */
html, body {
  height: 100vH;
  margin: 0;
  padding: 0;
  font-family: system-ui, sans-serif;
  background: #fff;
  color: #111;
}

.app-container {
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.app-header {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  justify-content: center;
  background: #f7f7f7;
  box-shadow: 0 2px 10px #0001;
}

.header-content {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 700px;
  gap: 1rem;
  padding: 1rem 1.2rem 1rem 1.2rem;
  position: relative;
}
#logo {
  height: 38px;
}
h1 {
  font-size: 1.28rem;
  margin: 0;
  flex: 1;  
}

/* Admin-Menü Dropdown */
.admin-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}
#admin-menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.27em 0.52em;
  border-radius: 50%;
  color: #004980;
  transition: background 0.14s, color 0.15s;
}
#admin-menu-btn:hover {
  background: #e0e8ff;
  color: #E41D37;
}
.admin-menu {
  display: none;
  position: absolute;
  top: 120%;
  right: 0;
  min-width: 170px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 4px 16px #0002;
  padding: 0.35em 0.3em;
  z-index: 30;
  flex-direction: column;
  animation: dropup-in 0.22s cubic-bezier(.4,1.4,.6,1.2);
}
.admin-dropdown.open .admin-menu {
  display: flex;
}
.admin-menu-item {
  background: none;
  border: none;
  text-align: left;
  font-size: 1.01em;
  color: #004980;
  padding: 0.47em 1.1em;
  border-radius: 7px;
  margin: 0.08em 0;
  cursor: pointer;
  transition: background 0.15s, color 0.16s;
}
.admin-menu-item:hover {
  background: #e0e8ff;
  color: #E41D37;
}

/* Hauptbereich Chat */
.chat-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-height: 0;
  background: #fff;
  box-sizing: border-box;
}

#chat-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0 1rem; /* horizontaler Abstand */
  min-height: 0;
}

#login-section {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center; /* vertikal zentrieren */
  align-items: center;
  padding: 2rem 1rem; /* etwas Luft an den Seiten */
  min-height: 100%; /* sicherstellen, dass es Platz einnimmt */
}

/* Chatverlauf */
#chat-history {
  flex: 1 1 auto;
  min-height: 200px;  
  overflow-y: auto;
  margin: 1.2em 0 0.7em 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafbfc;
  padding: 1rem;
  font-size: 1.15rem;
  box-shadow: 0 2px 10px #0002;
  transition: background 0.2s;
}

.message {
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
.message.you {
  justify-content: flex-end;
}
.message .bubble {
  max-width: 70%;
  padding: 0.5rem 1rem;
  border-radius: 18px;
  background: #e0e8ff;
  word-break: break-word;
  font-size: 1.13rem;
  box-shadow: 0 2px 8px #e41d3711, 0 1px 4px #00498011;
}
.message.bot .bubble {
  background: #f2f2f2;
}
.message img,
.message audio {
  max-width: 150px;
  max-height: 120px;
  border-radius: 8px;
  box-shadow: 0 2px 6px #00498022;
}

/* Eingabezeile mit Dropups */
#chat-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  position: relative;
  flex-shrink: 0; /* verhindert Zusammendrücken */
  margin-bottom: 5px; /* Abstand zum unteren Rand */
}
.chat-input-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px #0001;
  padding: 0.15em 0.25em;
  gap: 0.1em;
  border: 1px solid #ddd;
  position: relative;
  min-height: 46px;
}
.chat-input-bar input[type="text"] {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.15em;
  background: transparent;
  padding: 0.7em 0.4em;
  min-width: 0;
}

/* Dropup-Styling */
.dropup {
  position: relative;
  display: flex;
  align-items: center;
}
.dropup-content {
  display: none;
  position: absolute;
  bottom: 120%;
  left: 0;
  background: #fff;
  min-width: 180px;
  box-shadow: 0 8px 18px #0049801a;
  border-radius: 12px;
  z-index: 20;
  padding: 1em 0.9em;
  animation: dropup-in 0.22s cubic-bezier(.4,1.4,.6,1.2);
}
@keyframes dropup-in {
  from { transform: translateY(15px); opacity: 0;}
  to { transform: translateY(0); opacity: 1;}
}
.dropup.open .dropup-content {
  display: block;
}
.drop-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
}
.drop-label span {
  font-size: 0.96em;
  color: #333;
  margin-bottom: 0.6em;
}
.drop-hint {
  font-size: 0.86em;
  color: #777;
  margin-top: 0.4em;
}
#audio-dropup button {
  margin-right: 0.4em;
}
#audio-preview {
  display: block;
  margin-top: 0.5em;
}

/* Icon-Buttons */
.icon-btn {
  background: none;
  border: none;
  color: #004980;
  font-size: 1.33em;
  cursor: pointer;
  padding: 0.37em;
  border-radius: 50%;
  margin-left: 0.04em;
  transition: background 0.14s, color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.icon-btn:hover {
  background: #e0e8ff;
  color: #E41D37;
}

/* Login / Passwort ändern */
#login-section h2 {
  margin-bottom: 1em;
}
input[type="text"], input[type="password"] {
  font-size: 1rem;
  padding: 0.45em;
  border-radius: 8px;
  border: 1px solid #ccc;
  margin-bottom: 0.6em;
  width: 100%;
  box-sizing: border-box;
  background: #fff; /* explizit gesetzt! */
  color: #111;      /* dunkel */
}
#login-btn, #pwchange-confirm, #pwchange-cancel {
  margin-top: 0.7em;
  font-size: 1em;
  padding: 0.38em 1.4em;
  border-radius: 8px;
  border: none;
  background: linear-gradient(90deg, #E41D37 0%, #004980 100%);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 1px 6px #e41d3744, 0 1px 6px #00498022;
  font-weight: 500;
  transition: filter 0.16s, box-shadow 0.22s;
}
#login-btn:hover, #pwchange-confirm:hover, #pwchange-cancel:hover {
  filter: brightness(1.07) saturate(1.2);
  box-shadow: 0 2px 12px #00498044, 0 2px 10px #e41d3730;
}
.error {
  color: #c00;
  margin-top: 0.5rem;
}

/* Passwort ändern Overlay */
#pwchange-section {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 12px #00498011;
  padding: 1.2em 1.1em 1em 1.1em;
  position: absolute;
  left: 50%;
  top: 10vh;
  transform: translateX(-50%);
  z-index: 25;
  max-width: 330px;
}

/* Mobile Anpassung */
@media (max-width: 700px) {
  .header-content, #login-section, #chat-section {
    max-width: 99vw;
    padding: 0.3em 0.2em;
  }
  #chat-history {
    min-height: 120px;
    padding: 0.6em;
    font-size: 0.97rem;
  }
  .chat-input-bar {
    min-height: 38px;
    padding: 0.08em 0.05em;
    font-size: 1em;
  }
  .admin-menu {
    min-width: 135px;
  }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  html, body, .app-main, .chat-main {
    background: #151822;
    color: #fff;
  }
  .app-header, .header-content {
    background: #22283a;
    color: #fff;
  }
  #chat-history {
    background: #22283a;
    border-color: #22283a;
    color: #fff;
  }
  .message .bubble {
    background: #223370;
    color: #fff;
  }
  .message.bot .bubble {
    background: #363d56;
  }
  input[type="text"], input[type="password"] {
    background: #ebecef;
    color: #5e5b5b;
    border-color: #363d56;
  }
  #login-btn, #pwchange-confirm, #pwchange-cancel {
    background: linear-gradient(90deg, #E41D37 0%, #004980 100%);
    color: #fff;
  }
  .icon-btn, #admin-menu-btn {
    background: #22283a;
    color: #E41D37;
    border-color: #004980;
  }
  .icon-btn:hover, #admin-menu-btn:hover {
    background: #004980;
    color: #fff;
    border-color: #E41D37;
  }
  .dropup-content, .admin-menu, #pwchange-section {
    background: #1a2032;
    color: #fff;
  }
}

/* Kleinere Anpassungen */
button {
  margin-top: 0;
}

.typing .bubble {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  min-width: 50px;
  padding: 0.4rem 0.8rem;
  height: 1.8em;
}

.dot {
  width: 8px;
  height: 8px;
  background: #999;
  border-radius: 50%;
  animation: typing-bounce 1.2s infinite ease-in-out;
  opacity: 0.6;
}

.dot:nth-child(2) {
  animation-delay: 0.2s;
}
.dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.6; }
  40% { transform: scale(1.2); opacity: 1; }
}


