/* SRG Wissensplattform - zentrales Mobile-Stylesheet.
   Wird via <link rel="stylesheet" href="mobile.css"> geladen.
   Hamburger-Button + Overlay werden zur Laufzeit von auth-ui.js injiziert. */

/* Defaults: auf Desktop unsichtbar */
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

/* iOS Safari & moderne Browser: dvh statt vh wenn moeglich (vermeidet Tastatur-Sprung). */
@supports (height: 100dvh) {
  body { height: 100dvh; }
  .app { height: 100dvh; }
  .sidebar { height: 100dvh; }
}

/* ============ Phone + kleines Tablet (<= 768px) ============ */
@media (max-width: 768px) {

  /* App-Layout: Sidebar wird Off-Canvas */
  .sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    z-index: 100;
    width: 270px;
    min-width: 270px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  /* Hamburger sichtbar */
  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px;
  }

  /* Header (Inhaltsseiten + Admin) */
  .header-inner { padding: 10px 14px; gap: 8px; flex-wrap: wrap; }
  .header-title { font-size: 15px; line-height: 1.2; }
  .header-desc { font-size: 11px; line-height: 1.25; }
  .header-btn {
    padding: 6px 11px;
    font-size: 11px;
    border-radius: 6px;
  }
  .header h1 { font-size: 16px; }
  .header { padding: 12px 14px; }
  .header-nav { gap: 6px !important; }

  /* User-Chip im Header */
  #srg-user-chip {
    font-size: 11px !important;
    padding: 5px 10px !important;
    margin-left: auto;
  }

  /* Content & Wrap */
  .content { padding: 14px !important; }
  .wrap { padding: 0; }

  /* Welcome-Block */
  .welcome { padding: 0 4px; max-width: 100%; }
  .welcome-icon { width: 64px; height: 64px; font-size: 30px; margin-bottom: 14px; }
  .welcome h2 { font-size: 19px; line-height: 1.25; text-align: center; }
  .welcome .sub, .welcome .subtitle { font-size: 13px; text-align: center; }
  .welcome .hint { font-size: 11px; margin-bottom: 18px; }

  /* Beispiel-Buttons: 1 Spalte */
  .examples { grid-template-columns: 1fr !important; max-width: 100% !important; }
  .example-btn { font-size: 12.5px; padding: 11px 13px; }

  /* Input-Bar */
  .input-bar { padding: 10px 12px 14px !important; }
  .input-inner { gap: 8px; }
  #inputField, .input-field {
    padding: 10px 14px !important;
    font-size: 14px !important;
  }
  #sendBtn, .send-btn {
    width: 42px !important;
    height: 42px !important;
    font-size: 18px !important;
  }
  .input-hint { font-size: 10px; margin-top: 6px; }

  /* Chat-Bubbles */
  .msg { gap: 8px; margin-bottom: 12px; }
  .avatar { width: 32px; height: 32px; min-width: 32px; }
  .avatar.user { font-size: 14px; }
  .avatar.bot { font-size: 9px; }
  .bubble {
    max-width: 88% !important;
    font-size: 13.5px;
    padding: 12px 14px;
    line-height: 1.55;
  }

  /* ----- Admin-Bereich ----- */
  .tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .tab { flex-shrink: 0; padding: 10px 14px; font-size: 13px; }

  .card { padding: 14px 16px !important; }
  .card h2 { font-size: 15px; }

  /* Tabellen horizontal scrollen */
  .card > table,
  .card table {
    display: block;
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  table { font-size: 12px; min-width: 540px; }
  th, td { padding: 8px 6px; }

  /* Form-Rows einspaltig */
  .row { grid-template-columns: 1fr !important; }
  .checkbox-grid { grid-template-columns: repeat(2, 1fr) !important; }

  /* Modale */
  .modal {
    padding: 18px;
    border-radius: 10px;
    max-height: 92vh;
    max-height: 92dvh;
  }
  .modal h3 { font-size: 16px; margin-bottom: 12px; }
  .modal-bg { padding: 14px !important; }

  /* Norm-Status / Listen-Boxen falls vorhanden */
  .area-tags { gap: 3px; }
  .area-tag { font-size: 10px; padding: 2px 6px; }
}

/* ============ Sehr kleine Phones / Auth-Cards (<= 480px) ============ */
@media (max-width: 480px) {

  /* Login/Forgot/Reset/Change-Password Cards */
  body { padding: 12px !important; }
  .card {
    padding: 24px 20px 22px;
    border-radius: 12px;
  }
  .brand-logo { width: 54px; height: 54px; font-size: 16px; }
  .brand h1 { font-size: 18px; }
  .brand p { font-size: 11px; }
  .field input,
  .field input[type=text],
  .field input[type=password],
  .field input[type=email] {
    padding: 11px 12px;
    font-size: 14px;
  }
  .btn { padding: 12px; font-size: 13px; }

  /* Header noch enger */
  .header-inner { padding: 8px 12px; }
  .header-title { font-size: 14px; }
  .header-desc { display: none; }
  .header-btn { padding: 5px 9px; font-size: 10px; }
  .content { padding: 10px !important; }

  /* Welcome ganz klein */
  .welcome-icon { width: 56px; height: 56px; font-size: 26px; }
  .welcome h2 { font-size: 17px; }
  .example-btn { font-size: 12px; padding: 10px 12px; }
}

/* ============ Touch-Targets (alle Touch-Geraete) ============ */
@media (hover: none) and (pointer: coarse) {
  .nav-item { padding: 13px 16px; }
  .example-btn { min-height: 48px; }
  .header-btn, .btn, .btn-small { min-height: 36px; }
}

/* ============ Tablet/Landscape (769-1024px) ============ */
@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar { width: 230px; min-width: 230px; }
  .examples { grid-template-columns: 1fr 1fr; }
  .content { padding: 18px; }
}
