/* Reset & Basis V2 */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Fließtext */
body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: Roboto, Tahoma, Verdana, Arial, Helvetica, sans-serif;
  font-size: var(--font-size-body);
  line-height: 1.5;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

/* Überschriften */
h1, h2, h3 {
  margin: 0 0 0.5em;
  line-height: 1.3;
  font-weight: 500;
  display: inline-block;
}
h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }

/* Page Titles im Content */
h1.pagetitle,
h2.pagetitle,
h3.pagetitle {
  font-weight: bold;
  background: url("/images/htag-heading-bg.png") repeat-x left bottom transparent;
  margin-bottom: 0.5em;
  display: block;
  width: 100%;
}

p { margin: 0 0 1em; line-height: 1.5; }
img { height: auto; display: inline-block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

/* Layout-Container */
.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
/*
.sidebar {
  width: 250px;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border);
  padding: 6px;
  background: var(--color-content-bg);
  overflow-y: auto;
}
*/

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #f8f8f8;
  padding: 6px;
  border-right: 1px solid #ccc;
  box-sizing: border-box;

  /* WICHTIG: Höhe fixieren, damit Scrollen funktioniert */
  height: 100vh;          /* Sidebar nimmt volle Höhe des Viewports */
  overflow-y: auto;       /* nur Sidebar scrollt */
}

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-topbar-bg);
  padding: 10px 20px;
  border-bottom: 1px solid var(--color-topbar-border);
}
.page-slogan {
  margin: 0;
  color: var(--color-topbar-text);
  font-weight: bold;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Content */
.content-wrapper {
  flex: 1;
  margin: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.content {
  max-width: 1200px;
  width: 100%;
  background: var(--color-content-bg);
  padding: 1.2rem;
  border-radius: 6px;
  box-shadow: 0 0 8px var(--shadow);
  text-align: left;
  border-top: 4px solid var(--color-content-border);
  margin-bottom: 20px;
  font-size: var(--font-size-content);
  line-height: 1.5;
}
.content.b600 { max-width: 600px; }
.content.b800 { max-width: 800px; }
.content.b960 { max-width: 960px; }

.trennline {
  background: url("/images/htag-heading-bg.png") repeat-x left bottom transparent;
  margin-bottom: 0.5em;
  display: block;
  width: 100%;
  margin-top: 2px;
  height: auto;
  min-height: 5px;
}

/* Footer */
.footer {
  width: 100%;
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  text-align: center;
  padding: 8px 0;
  margin-top: auto;
}
.footer a { color: var(--color-footer-link); }
.footer p { margin: 0; font-size: var(--font-size-footer); }

.debug {
  display: block;
  float: left;
  width: 100%;
  text-align:left;
  padding: 15px;
  margin: 0 AUTO;
  background-color: var(--color-debug-bg);
}

/* Kleine Hilfstexte */
.helptext, .helptext-small {
  font-size: var(--font-size-helptext);
  color: var(--color-helptext);
  display: block;
}

.bg-a { background-color: var(--color-bg-a); }
.bg-b { background-color: var(--color-bg-b); }

/* Text-Ausrichtung */
.r { text-align: right; }
.c { text-align: center; }
.inner-m { vertical-align: middle !important; }

/* Breitenklassen */
[class^="w"] { display: inline-block; }
.w5{width:5%}.w10{width:10%}.w15{width:15%}.w20{width:20%}.w25{width:25%}.w30{width:30%}.w33{width:33%}.w35{width:35%}
.w40{width:40%}.w45{width:45%}.w50{width:50%}.w55{width:55%}.w60{width:60%}.w65{width:65%}.w70{width:70%}.w75{width:75%}
.w80{width:80%}.w85{width:85%}.w90{width:90%}.w95{width:95%}.w100{width:100%}

/* Padding-Klassen */
.p5{padding:5px} .p10{padding:10px} .p15{padding:15px}
.p5lr{padding-left:5px;padding-right:5px}
.p10lr{padding-left:10px;padding-right:10px}
.p15lr{padding-left:15px;padding-right:15px}
.p2l{padding-left:2px}
.p3l{padding-left:3px}
.p4l{padding-left:4px}
.p5l{padding-left:5px} .p10l{padding-left:10px} .p15l{padding-left:15px}
.p25tb { padding-top: 25px;}
.p20tb { padding-top: 20px;}
.p15tb { padding-top: 15px;}

/* Tabellen-Layout */
.inner{display:table;width:100%;height:auto;}
.inner-tr{display:table-row}
.inner-td{display:table-cell;vertical-align:top; white-space: normal;
word-break: normal;
overflow-wrap: break-word;
hyphens: none;
}

/* Media Query für Mobile */
@media (max-width: 768px) {
  [class^="w"] { width: 100% !important; }
  .inner, .inner-tr, .inner-td { display: block; width: 100%; }
  .r, .c { text-align: left !important; }
}


/* Styling für die temporäre Lade-Div */
.loading-overlay {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid #ffeeba;
    color: #856404;
    text-align: center;
    font-weight: bold;
    border-radius: 4px;
}


#seitenausgabe {
  clear: both;
  margin-top: 20px;
  text-align: center;
}

.pagination-list {
  display: inline-flex;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 5px;
}

.pagination-label {
  display: block;
  padding: 4px 10px;
  background-color: #f0f0f0;
  border-radius: 3px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s;
}

.pagination-list a {
  display: block;
  padding: 4px 10px;
  background-color: #f0f0f0;
  border-radius: 3px;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s;
}

.pagination-list a:hover {
  background-color: #ffe58f;
}

.pagination-list .page-current {
  background-color: #ffe58f;
  font-weight: bold;
  cursor: default;
}


.sort-container {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sort-icons-row {
    display: inline-flex;
    gap: 2px;
}

.sort-arrow-link {
    text-decoration: none;
    line-height: 1;
    display: flex;
    align-items: center;
}

/* Icons Grundzustand */
.icon-neutral, .icon-neutral i {
    color: #000 !important;
}

/* Aktiver Pfeil */
.icon-active-green {
    color: #28a745 !important;
    opacity: 1 !important;
}

/* Hover-Effekt für die einzelnen Pfeile */
.sort-arrow-link:hover i {
    opacity: 0.5 !important;
}



/* System Metadaten (Rechtliches/Quellen) */
.tt-ki-metadata {
    margin-top: 5px;
    padding: 4px;
    border-top: 1px solid #eee;
    background: #f9f9f9;
    color: #666;
    font-size: 0.85em;
    border-radius: 4px;
}


/* Haupt-Container für die KI-Antworten */
#ki-response-target {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 10px;
    max-height: 600px;
    overflow-y: auto;
    background: #ffffff; /* --color-content-bg */
    border: 1px solid #ccc; /* --color-form-border */
    border-radius: 4px;
    margin-bottom: 25px;
    font-size: 0.95em; /* --font-size-body */
}

/* Chat-Zeilen & Bubbles - Fixe Breite 98% */
.tt-ki-chat-row { 
    width: 100%; 
    display: flex; 
    margin: 4px 0; 
}
.u-row { justify-content: flex-end; }
.ai-row { justify-content: flex-start; }

/* User Bubble: Gedecktes Schieferblau (seriös, nicht grell) */
.tt-ki-msg-u { 
    background: #4a5568; 
    color: #ffffff; 
    border: 1px solid #2d3748; 
    border-radius: 4px; 
    padding: 10px 15px; 
    width: 98%;
}

/* KI Bubble: Sanftes Hellgrau aus deinem System-Hintergrund */
.tt-ki-msg-ai { 
    background: #f0f0f0; /* --color-bg-b */
    color: #333; /* --color-text */
    border: 1px solid #ccc; /* --color-border */
    border-radius: 4px; 
    padding: 10px 15px; 
    width: 98%;
}

/* Header innerhalb der KI-Bubble */
.tt-ki-ai-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 8px; 
    border-bottom: 1px solid #eee; /* --color-border-light */
    padding-bottom: 5px;
    font-weight: bold;
    color: #444; /* --color-heading */
}

/* Code-Block Design: Dunkelblau (#1e2125) mit passendem Rahmen */
.tt-ki-code-wrapper { 
    background: #ffffff; 
    border: 1px solid #1e2125; 
    border-radius: 4px; 
    margin: 5px 0; 
    overflow: hidden; 
}

.tt-ki-code-header { 
    background: #1e2125; 
    color: #ffffff; 
    padding: 6px 12px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-weight: bold;
    font-size: 0.8em; /* --font-size-breadcrumb-nav */
}

.tt-ki-code-wrapper pre { 
    background: #ffffff !important; 
    margin: 0; 
    padding: 5px; 
    overflow-x: auto; 
    font-family: 'Consolas', 'Monaco', monospace; 
    line-height: 1.5; 
    color: #24292e;
}

/* --- SYNTAX HIGHLIGHTING (Statischer Farb-Output) --- */
.hl-comment  { color: #6a737d; font-style: italic; }

.hl-function { color: #6f42c1; }
.hl-string   { color: #032f62; }
.hl-num      { color: #005cc5; }
.hl-var      { color: #ff7514; } /* --color-notice (Orange) */
.hl-tag      { color: #22863a; }
.hl-sql      { color: #005cc5; font-weight: bold; }
.hl-key      { color: #005cc5; font-weight: bold; }

/* Ergänzung für Bash-Kommandos und C++ Typen */
.hl-keyword { color: #d73a49; font-weight: bold; } 
.hl-esc     { color: #e19400; } 
.hl-cmd     { color: #22863a; font-weight: bold; }

/* Inline Code innerhalb von Fließtext */
.tt-ki-inline-code { 
    background: #f0f0f0; 
    color: #c62828; /* --color-status-error-text */
    padding: 2px 5px; 
    border-radius: 4px; 
    font-family: monospace; 
	
}

/* Standard Buttons */
.tt-ki-copy-all, .tt-ki-copy-btn {
    background: #333; /* --color-btn-bg */
    color: #fff; /* --color-btn-text */
    border: 1px solid #333;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.8em;
    transition: all 0.2s;
    display: inline-flex; 
    align-items: center;
    gap: 6px;
}

.tt-ki-copy-all:hover, .tt-ki-copy-btn:hover {
    background: #4da3ff; /* --color-btn-hover-bg */
    color: #fff;
}

/* Spezial-Style für den Button im dunkelblauen Code-Header */
.tt-ki-code-header .tt-ki-copy-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 2px 8px;
    font-size: 0.75em;
    border-radius: 2px;
}

/* --- NEU: ERFOLGS-FEEDBACK --- */
.tt-ki-copy-btn.copy-success {
    background: #27ae60 !important; 
    border-color: #27ae60 !important;
    color: #fff !important;
}

.copy-label {
    font-size: 0.9em;
    font-weight: normal;
    animation: fadeInLabel 0.2s ease forwards;
}

@keyframes fadeInLabel {
    from { opacity: 0; transform: translateX(-5px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Thinking / Lade-Status */
.tt-ki-status-thinking {
    color: #666; /* --color-helptext */
    font-style: italic;
    display: flex;
    align-items: center;
    gap: 8px;
}


.tt-ki-answer {
    line-height: 1.5;
    word-wrap: break-word;
    color: inherit; /* Passt sich dem Textfluss an */
    font-size: 1rem;
}

/* Verhindert Abstände durch das strikte <br>-Limit */
.tt-ki-answer br {
    display: block;
    content: "";
    margin-top: 5px;
}

.tt-ki-answer em {
    font-size: 0.85em;
    color: #888;
    display: block;
    margin-top: 4px; /* Kleiner Abstand nach oben */
}

.tt-ki-answer br + br {
    /*display: none; /* Verhindert doppelte <br> falls doch mal welche durchschlüpfen */
}

#debug br + br { display: block; }