/* style.css */

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;          /* verhindert Seiten-Scroll */
}

body {
  font-family: sans-serif;
  color: #eee;
  background: url('/assets/img/knowledge_base_dark.jpg') no-repeat center center fixed;
  background-size: cover;
}

/* Chat-Container: bis max. 800px, mit je 40px Abstand oben/unten */
.chat-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 800px;
  margin: 40px auto;
  height: calc(100vh - 80px);
  background: rgba(31, 34, 39, 0.6);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Header: Logo ausblenden und Text anzeigen */
.header {
  position: relative;
  padding: 16px;
  background: rgba(35, 38, 43, 0.9);
  text-align: center;
  font-size: 1.5rem;
  color: #ff8c00;
}
.header .logo {
  display: none;
}
.header::before {
  content: 'wegscheider KI - WegBot';
  font-weight: bold;
}

/* Nachrichtenbereich */
.messages {
  flex: 1;                   /* wächst, um Platz zu füllen */
  padding: 16px;
  overflow-y: auto;
  background: transparent;
}

/* Jeder Chat-Bubble im Rahmen */
.message {
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid rgba(51,54,59,0.9);
  background: rgba(49, 52, 57, 1);
  border-radius: 4px;
  display: block;
  width: auto;
  max-width: 80%;
}

/* Bot-Antworten & System-Nachrichten: linksbündig */
.message.system,
.message.assistant {
  background: rgba(49, 52, 57, 1);
  margin-right: auto;
  margin-left: 0;
}

/* Eigene Nachrichten: rechtsbündig und helleres Orange */
.message.user {
  background: rgba(151, 151, 151, 0.3);
  margin-left: auto;
  margin-right: 0;
}

/* Links in Antworten in Button-Farbe */
.message a {
  color: #ff8c00;
  text-decoration: underline;
}

/* Eingabebereich */
.input-area {
  display: flex;
  padding: 16px;
  background: rgba(35, 38, 43, 0.9);
}
#input {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 4px 0 0 4px;
  background: rgba(44, 47, 51, 0.9);
  color: #eee;
}
#send {
  padding: 0 24px;
  border: none;
  background: #ff8c00;
  color: #222;
  border-radius: 0 4px 4px 0;
  cursor: pointer;
}

/* verhindert automatisches Reinzoomen auf iOS */
.input-area input,
.input-area input::placeholder {
  font-size: 16px;
}


/* Steuerleiste unten */
.controls {
  display: flex;
  justify-content: space-around;
  padding: 12px;
  background: rgba(35, 38, 43, 0.9);
}
.controls button {
  background: rgba(51, 54, 59, 0.9);
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  color: #eee;
}

/* Footer: bleibt sichtbar unter den Controls */
.footer {
  text-align: center;
  color: #fff;
  padding: 12px 0;
  background: rgba(31, 34, 39, 0.8);
  border-top: 1px solid rgba(51,54,59,0.8);
}
.footer-text {
  font-size: 0.9rem;
}
.footer-links {
  margin-top: 6px;
}
.footer-links a {
  color: #fff;
  margin: 0 8px;
  text-decoration: none;
  font-size: 0.85rem;
}
.footer-links a:hover {
  text-decoration: underline;
}

/* ===== Haftungs-Modal ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal {
  background: #1f2227;
  padding: 24px;
  border-radius: 8px;
  width: 90%;
  max-width: 750px;
  color: #eee;
  box-shadow: 0 4px 12px rgba(0,0,0,0.6); 
}
.modal h2 {
  margin-top: 0;
  color: #ff8c00;
}
.modal-content {
  max-height: 60vh;
  overflow-y: auto;
  margin-bottom: 16px;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Links im Haftungs-Modal weiß färben */
.modal-content a {
  color: #fff;
  text-decoration: underline;
}
.modal-content a:hover {
  color: #ff8c00;
  text-decoration: underline;
}

.modal-buttons {
  text-align: right;
}
.modal-buttons button {
  margin-left: 8px;
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid #888;
  background: transparent;
  color: #eee;
  cursor: pointer;
  font-size: 0.9rem;
}
.modal-buttons button:hover {
  background: rgba(255,255,255,0.1);
}
.modal-buttons .btn-confirm {
  background: #ff8c00;
  border-color: #ff8c00;
  color: #222;
}
.modal-buttons .btn-confirm:hover {
  background: #e07b00;
}

/* ===== Responsive Anpassungen ===== */
@media (max-width: 600px) {
  .chat-container {
    margin: 20px;
    height: calc(100vh - 40px);
  }
  .header {
    font-size: 1.2rem;
    padding: 12px;
  }
  .messages {
    padding: 12px;
  }
  .message {
    margin-bottom: 8px;
  }
  .input-area {
    flex-direction: column;
    padding: 12px;
  }
  #input {
    border-radius: 4px;
    margin-bottom: 8px;
  }
  #send {
    width: 100%;
    border-radius: 4px;
    padding: 12px 0;
  }
  .controls {
    flex-direction: column;
    padding: 8px;
  }
  .controls button {
    width: 100%;
    margin: 4px 0;
  }
  .modal {
    width: 95%;
    max-width: 90%;
  }
}
/* ===== Mobile-Optimierung: randloser Full-Width Chat auf kleinen Screens ===== */
@media (max-width: 600px) {
  .chat-container {
    margin: 0;               /* kein Außenabstand mehr */
    width: 100%;             /* volle Breite */
    max-width: 100%;         /* keine Breiten-Beschränkung */
    border-radius: 0;        /* eckenlos */
    height: 100vh;           /* volle Bildschirmhöhe */
  }

  /* damit der Hintergrund hinter dem Header bis ans obere Ende reicht */
  html, body {
    overflow: hidden;        /* Hauptseiten-Scroll unterbinden */
  }
}


/* Quellen unter der Bot-Antwort */
.message.sources {
  width: 60%;
  margin-right: auto;
  font-size: 0.85rem;
  color: #ccc;
}
.message.sources ul {
  margin: 4px 0 0 16px;
  padding: 0;
}
.message.sources li {
  margin-bottom: 4px;
}
.message.sources a {
  color: #ff8c00;
  text-decoration: underline;
}
/* Produkt-Auswahl als breites Select-Feld */
#productModal .modal-content {
  padding: 0;
}
#productModal select#productSelect {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  background: rgba(44, 47, 51, 0.9);
  color: #eee;
  box-sizing: border-box;
}
#productModal .modal-buttons {
  text-align: right;
  margin-top: 12px;
}
#productModal .btn-confirm {
  padding: 8px 14px;
  border-radius: 4px;
  border: 1px solid #ff8c00;
  background: #ff8c00;
  color: #222;
  cursor: pointer;
}
#productModal .btn-confirm:hover {
  background: #e07b00;
}
#productModal .modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 10%;
}
#productModal input,
#productModal select#productSelect {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 4px;
  background: rgba(44, 47, 51, 0.9);
  color: #eee;
  font-size: 1rem;
  box-sizing: border-box;
}
