/* ═══════════════════════════════════════════════════════════════════════════
   WEB VERSION – Overrides für den Browser-Einsatz
   Wird nach styles.css geladen und überschreibt Extension-spezifische Werte
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── CSS Custom Property für Schriftgröße (ersetzt body.zoom) ────────────── */
:root {
  --ui-scale: 1.08;
}

/* ── Reset Extension-Dimensionen ─────────────────────────────────────────── */
html, body {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  /* overflow: auto statt hidden → kein Clipping bei Schriftgrößen-Änderung */
  overflow: auto;
  font-size: calc(15px * var(--ui-scale));
}

body {
  display: flex;
  flex-direction: column;
  /* Body-Overflow verhindert unnötige Scrollbars im Normalzustand */
  overflow: hidden;
}

/* Desktop: Body darf nicht scrollen, Main-Layout übernimmt Scrolling */
@media (min-width: 1025px) {
  body { overflow: hidden; }
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.header {
  padding: 0 28px;
  height: 58px;
  flex-shrink: 0;
}

.header-icon {
  width: 40px;
  height: 40px;
  font-size: 20px;
}

.header-title {
  font-size: calc(16px * var(--ui-scale));
}

.header-subtitle {
  font-size: calc(11px * var(--ui-scale));
}

.header-icon img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

/* ── Haupt-Layout: Vollbreite ─────────────────────────────────────────────── */
.main-layout {
  flex: 1;
  min-height: 0;
  max-width: 100%;
}

/* ── Linkes Panel ─────────────────────────────────────────────────────────── */
.left-panel {
  min-width: 0;
}

/* ── Rechtes Panel: Breiter ───────────────────────────────────────────────── */
.right-panel {
  width: 360px;
  padding: 16px 18px;
}

.right-title {
  font-size: calc(11px * var(--ui-scale));
}

/* ── Tabs: Größer ─────────────────────────────────────────────────────────── */
.tabs {
  height: 46px;
}

.tab {
  padding: 12px 14px;
  font-size: calc(12px * var(--ui-scale));
  letter-spacing: 0.3px;
}

/* ── Content / Sections ───────────────────────────────────────────────────── */
.content {
  padding: 18px 22px;
}

.section {
  padding: 14px 0;
}

.section-label {
  font-size: calc(10px * var(--ui-scale));
  margin-bottom: 12px;
}

.field-label {
  font-size: calc(12px * var(--ui-scale));
  margin-bottom: 5px;
}

/* ── Selects & Inputs ─────────────────────────────────────────────────────── */
select {
  font-size: calc(13px * var(--ui-scale));
  padding: 9px 32px 9px 12px;
  height: 38px;
}

.api-key-input {
  font-size: calc(13px * var(--ui-scale));
  padding: 9px 12px;
}

/* ── Grid ─────────────────────────────────────────────────────────────────── */
.grid-2 {
  gap: 14px;
}

/* ── Chips ────────────────────────────────────────────────────────────────── */
.chip {
  font-size: calc(12px * var(--ui-scale));
  padding: 6px 12px;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-reset {
  font-size: calc(12px * var(--ui-scale));
  padding: 7px 14px;
}

.btn-promptbase {
  font-size: calc(12px * var(--ui-scale));
  padding: 7px 14px;
}

.btn-copy {
  font-size: calc(13px * var(--ui-scale));
  padding: 10px 16px;
}

.btn-ki-assistent {
  font-size: calc(12px * var(--ui-scale));
  padding: 9px 12px;
}

/* ── Prompt-Box ───────────────────────────────────────────────────────────── */
.prompt-box {
  font-size: calc(13px * var(--ui-scale));
  line-height: 1.65;
}

.prompt-char-count {
  font-size: calc(11px * var(--ui-scale));
}

/* ── Overlays: Breiter auf großen Screens ─────────────────────────────────── */
.overlay-box {
  width: 520px;
  max-width: 90vw;
}

.ki-overlay-box {
  width: 700px;
  max-width: 92vw;
}

.ki-text-input {
  min-height: 120px;
  font-size: calc(13px * var(--ui-scale));
}

.edit-textarea {
  min-height: 200px;
  font-size: calc(13px * var(--ui-scale));
}

/* ── Person-Switcher ──────────────────────────────────────────────────────── */
.person-appearance-grid {
  gap: 12px;
}

/* ── Divider ──────────────────────────────────────────────────────────────── */
.divider {
  margin: 4px 0;
}

/* ── Scrollbar Web-Look ───────────────────────────────────────────────────── */
.content::-webkit-scrollbar { width: 5px; }

/* ── Hover-Effekte nur auf Desktop ───────────────────────────────────────── */
@media (hover: hover) {
  select:hover        { border-color: rgba(200,169,110,0.5); }
  .chip:hover         { opacity: 1; }
}

/* ── Favicon-Icon im Header (wenn SVG vorhanden) ─────────────────────────── */
.header-icon-img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Desktop: > 1024px – Zweispaltig ─────────────────────────────────────── */
@media (max-width: 1100px) and (min-width: 1025px) {
  .right-panel {
    width: 300px;
    padding: 14px;
  }

  .header {
    padding: 0 18px;
  }
}

/* ── Tablet & Mobile: ≤ 1024px – Einspaltig, Prompt unten ───────────────── */
@media (max-width: 1024px) {

  /* Scrollen wieder erlauben */
  html, body {
    overflow: auto;
    height: auto;
    min-height: 100vh;
  }

  /* ── Header: einzeilig, kompakt ── */
  .header {
    padding: 0 12px;
    height: 50px;
    flex-wrap: nowrap;
    gap: 0;
  }

  .header-left {
    gap: 7px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }

  .header-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
  }

  .header-icon img {
    width: 24px;
    height: 24px;
  }

  /* Titel + Subtitle auf Mobile komplett ausblenden */
  .header-title,
  .header-subtitle {
    display: none;
  }

  .header-actions {
    gap: 6px;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }

  /* Nicht benötigte Header-Elemente auf Mobile ausblenden */
  #btn-promptbase-header,
  #btn-reset {
    display: none;
  }

  /* Sprach-Flags etwas kleiner */
  .icon-flag {
    width: 18px;
    height: 18px;
  }

  .btn-lang {
    padding: 3px 4px;
  }

  /* ── Layout: Vertikal stapeln ── */
  .main-layout {
    flex-direction: column;
    overflow: visible;
    height: auto;
    min-height: unset;
  }

  /* ── Linkes Panel: Vollbreite, Höhe automatisch ── */
  .left-panel {
    overflow: visible;
    border-right: none;
    border-bottom: 1px solid var(--border);
    height: auto;
    min-height: unset;
  }

  /* ── Tabs: Horizontal scrollbar ── */
  .tabs {
    height: 42px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }

  /* Spezifität erhöhen um styles.css .tabs .tab { flex:1 } zu überschreiben */
  .tabs .tab {
    flex: 0 0 auto;
    padding: 0 14px;
    height: 42px;
    gap: 5px;
  }

  /* Inaktive Tabs: nur Icon */
  .tabs .tab:not(.active) span[data-i18n] {
    display: none;
  }

  /* Aktiver Tab: Icon + Name */
  .tabs .tab.active span[data-i18n] {
    display: inline;
  }

  .tab-icon {
    width: 15px;
    height: 15px;
  }

  /* ── Mobile-Aktionsleiste ── */
  .mobile-actions-bar {
    display: flex;
    gap: 8px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    flex-shrink: 0;
  }

  .mobile-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: calc(11px * var(--ui-scale));
    font-weight: 500;
    letter-spacing: 0.2px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
  }

  .mobile-action-btn:active {
    border-color: var(--accent);
    color: var(--accent);
  }

  /* ── Content: Kein fester Overflow mehr ── */
  .content {
    overflow: visible;
    height: auto;
    max-height: none;
    padding: 14px 16px;
  }

  /* ── Rechtes Panel: Volle Breite unter dem linken Panel ── */
  .right-panel {
    width: 100%;
    padding: 16px;
    border-top: 1px solid var(--border);
  }

  /* ── Prompt-Box-Bereich auf Mobile ── */
  .prompt-box {
    min-height: 160px;
    max-height: 300px;
    overflow-y: auto;
  }

  /* ── Grid: Einspaltig auf Mobile ── */
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* ── Chips: Etwas kleiner ── */
  .chip {
    font-size: calc(11px * var(--ui-scale));
    padding: 5px 10px;
  }

  /* ── Sections ── */
  .section {
    padding: 10px 0;
  }

  /* ── Overlays: Fast volle Breite ── */
  .overlay-box {
    width: 96vw;
    max-width: 96vw;
    max-height: 90vh;
    overflow-y: auto;
  }

  .ki-overlay-box {
    width: 96vw;
    max-width: 96vw;
    max-height: 90vh;
    overflow-y: auto;
  }

  .ki-text-input {
    min-height: 90px;
    font-size: calc(13px * var(--ui-scale));
  }

  .edit-textarea {
    min-height: 140px;
    font-size: calc(13px * var(--ui-scale));
  }

  /* ── KI-Overlay: Tabs und Panels anpassen ── */
  .ki-tabs {
    gap: 4px;
  }

  .btn-ki-mode {
    font-size: calc(10px * var(--ui-scale));
    padding: 6px 8px;
    gap: 4px;
  }

  .btn-ki-mode .icon-sm {
    display: none;  /* Nur Text auf sehr kleinen Screens */
  }

  /* ── Overlay Titel ── */
  .overlay-title {
    font-size: calc(13px * var(--ui-scale));
  }

  /* ── Einstellungen-Overlay ── */
  .settings-section {
    padding: 10px 0;
  }

  /* ── Select Felder ── */
  select {
    height: 40px;
    font-size: calc(13px * var(--ui-scale));
  }

  /* ── KI-Assistent Button ── */
  .btn-ki-assistent {
    font-size: calc(11px * var(--ui-scale));
    padding: 8px 10px;
    width: 100%;
    justify-content: center;
  }

  /* ── Prompt-Aktionen ── */
  .prompt-actions {
    flex-wrap: wrap;
    gap: 6px;
  }

  .btn-copy {
    flex: 1;
    justify-content: center;
  }

  /* ── Person-Switcher ── */
  .person-appearance-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  /* ── right-title auf Mobile sichbar ── */
  .right-header {
    margin-bottom: 10px;
  }
}

/* ── Tablet-Override: Header-Titel auf 641–1024px wieder einblenden ─────── */
@media (min-width: 641px) and (max-width: 1024px) {
  .header-title {
    display: block;
    font-size: calc(14px * var(--ui-scale));
  }
  .header-subtitle {
    display: none;
  }
  /* Header-Icon wieder etwas größer */
  .header-icon {
    width: 34px;
    height: 34px;
  }
  .header-icon img {
    width: 30px;
    height: 30px;
  }
  /* Promptbase im Header auf Tablet ausblenden */
  #btn-promptbase-header {
    display: none;
  }
}

/* ── Sehr kleines Smartphone: ≤ 380px ────────────────────────────────────── */
@media (max-width: 380px) {
  .header-title {
    font-size: calc(11px * var(--ui-scale));
  }

  .header-actions {
    gap: 4px;
  }

  .tab {
    padding: 8px 10px;
    font-size: calc(10px * var(--ui-scale));
  }

  .tab-icon {
    display: none;  /* Nur Text auf sehr kleinen Screens */
  }

  .tab span {
    display: inline;
  }
}
