/* ============================================================
   RoutenKnoten v0.5.111 – styles-tablet.css
   480px bis 799px: zweispaltiges Layout.

   REGEL: Alles was in dieser Ansicht anders aussehen soll,
   steht HIER. Keine Abhängigkeit zu Handy oder Desktop.
   Änderungen hier wirken sich NUR auf diesen Bereich aus.

   HINWEIS: styles-upright-tablet.css wurde hier eingearbeitet
   und kann gelöscht werden. Hochformat-Sonderfälle sind über
   orientation: portrait am Ende dieser Datei geregelt.
   ============================================================ */

@media (min-width: 480px) and (max-width: 799px) {

  /* ----------------------------------------------------------
     LAYOUT: Ansichten-Höhe
     Kein Bottom-Nav auf dem Tablet → volle Viewport-Höhe.
  ---------------------------------------------------------- */

  .view {
    height: 100vh;
  }

  .view-map,
  #map {
    height: 100vh;
  }


  /* ----------------------------------------------------------
     BOTTOM NAVIGATION: Auf dem Tablet ausblenden
  ---------------------------------------------------------- */

  .bottom-nav {
    display: none !important;
  }


  /* ----------------------------------------------------------
     STARTSEITE
     Zweispaltig: Suche + Route-Buttons, Header-Karte oben.
  ---------------------------------------------------------- */

  .sm-start {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 20px 16px;
    overflow-x: hidden;
    text-align: left;
  }

  .sm-start-card {
    padding: 28px 24px;
    margin-bottom: 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: center;
    text-align: left;
  }

  .sm-start-card h1 {
    font-size: 30px;
    margin-bottom: 4px;
  }

  .sm-search-wrap {
    width: 100%;
    margin-bottom: 24px;
  }

  .sm-search input {
    font-size: 17px;
  }

  .sm-search button {
    min-width: 78px;
  }

  /* Buttons: 2-Spalten-Flex.
     Alle vier Ecken zuerst setzen, Außenkanten danach auf 50px. */
  .sm-actions {
    width: 100%;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-content: flex-start;
    gap: 12px 8px;
    margin: 0 0 18px 0;
  }

  .sm-action {
    flex: 0 0 calc((100% - 8px) / 2) !important;
    min-width: 0;
    font-size: 16px;
    padding: 14px 22px;
    text-align: left;
    border-top-left-radius: 8px !important;
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
  }

  /* Linke Spalte: links außen rund, rechte Innenkante bleibt dezent */
  .sm-action:nth-child(odd) {
    border-top-left-radius: 50px !important;
    border-bottom-left-radius: 50px !important;
  }

  /* Rechte Spalte: rechts außen rund, linke Innenkante bleibt dezent */
  .sm-action:nth-child(even) {
    border-top-right-radius: 50px !important;
    border-bottom-right-radius: 50px !important;
  }

  .sm-action-red:nth-child(odd) {
    border-right-color: rgba(220, 38, 38, .55);
  }

  /* Wenn ein letzter Button alleine steht, volle Breite und beide Außenkanten */
  .sm-action:last-child:nth-child(odd) {
    flex-basis: 100% !important;
    border-top-left-radius: 50px !important;
    border-bottom-left-radius: 50px !important;
    border-top-right-radius: 50px !important;
    border-bottom-right-radius: 50px !important;
  }

  /* Wenn Installieren-Button ausgeblendet ist:
     Informationen und Update als Zweierreihe korrekt abrunden. */
  .sm-actions:not(:has(#installAppBtn:not(.hidden))) #appInfoBtn {
    border-top-left-radius: 50px !important;
    border-bottom-left-radius: 50px !important;
    border-top-right-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
  }

  .sm-actions:not(:has(#installAppBtn:not(.hidden))) #updateAppBtn {
    border-top-left-radius: 8px !important;
    border-bottom-left-radius: 8px !important;
    border-top-right-radius: 50px !important;
    border-bottom-right-radius: 50px !important;
  }

  .sm-actions:not(:has(#installAppBtn:not(.hidden))) #updateAppBtn:last-child:nth-child(odd) {
    flex-basis: calc((100% - 8px) / 2) !important;
  }

  /* Fußbereich */
  .sm-login {
    width: 100%;
    min-height: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    gap: 18px;
    overflow: visible;
  }

  .sm-login small {
    display: none !important;
  }

  /* Vorschaubild: flacher Ausschnitt */
  .img-preview {
    display: block !important;
    width: min(92vw, 760px) !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin: 18px auto 0 !important;
    padding: 0 !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    border: 1px solid rgba(255, 255, 255, .72) !important;
    background: rgba(255, 255, 255, .70) !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, .18) !important;
  }

  .img-preview img {
    display: block !important;
    width: 100% !important;
    height: min(120px, 18vh) !important;
    max-height: min(120px, 30vh) !important;
    object-fit: cover !important;
    object-position: center center !important;
    border-radius: 14px !important;
  }


  /* ----------------------------------------------------------
     KARTE: Mobile-Toolbar ausblenden, Desktop-Toolbar anzeigen
  ---------------------------------------------------------- */

  .mobile-map-controls,
  .mobile-map-menu {
    display: none !important;
  }

  .desktop-map-controls {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: var(--z-controls);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: center;
    max-width: 980px;
    margin: 0 auto;
    padding: 8px;
    border-radius: 26px;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: blur(10px);
    box-shadow: var(--panel-shadow);
  }

  .desktop-map-controls .chip {
    min-height: 38px;
  }


  /* ----------------------------------------------------------
     KARTE: Positions-Badge
  ---------------------------------------------------------- */

  .route-info-badge {
    top: 76px;
  }


  /* ----------------------------------------------------------
     MODUS-UMSCHALTER (Rad / Wandern)
  ---------------------------------------------------------- */

  .mode-toggle-wrap {
    margin: 0 auto 6px;
  }

  .mode-toggle-btn,
  .mobile-map-controls .mode-toggle-chip {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
  }


  /* ----------------------------------------------------------
     SHEET / DIALOG
     Zweispaltiges Layout für Infotexte und Spende.
  ---------------------------------------------------------- */

  .sheet {
    left: 50%;
    right: auto;
    bottom: 28px;
    transform: translateX(-50%);
    width: min(900px, calc(100vw - 40px));
    border-radius: 28px;
    padding: 26px;
  }

  .app-info-sheet {
    max-height: min(82vh, 780px);
  }

  .app-info-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr);
  }

  .info-hero {
    grid-template-columns: 1fr auto;
  }

  .donation-card img {
    width: min(100%, 280px);
    max-height: 280px;
  }


  /* ----------------------------------------------------------
     TOAST
     Oben zentriert (kommt aus styles.css), hier keine Änderung.
  ---------------------------------------------------------- */


  /* ----------------------------------------------------------
     NAVIGATIONS-STATUS
  ---------------------------------------------------------- */

  #navigationStatus {
    left: 24px;
    right: 24px;
    bottom: 16px;
  }


  /* ----------------------------------------------------------
     480px bis 656px: Header wie auf dem Handy
     In diesem Bereich bricht der zweispaltige Header unschön.
  ---------------------------------------------------------- */

  @media (min-width: 480px) and (max-width: 656px) {
    .sm-start {
      padding-left: 12px;
      padding-right: 12px;
      text-align: center;
    }

    .sm-start-card {
      display: block !important;
      grid-template-columns: none !important;
      padding: 22px 16px !important;
      margin-bottom: 20px !important;
      text-align: center !important;
      border-radius: 24px !important;
    }

    .sm-start-card h1 {
      font-size: 25px !important;
      line-height: 1.08 !important;
      margin: 0 0 8px !important;
      white-space: normal !important;
    }

    .sm-start-card p {
      font-size: 16px !important;
      line-height: 1.35 !important;
      white-space: normal !important;
      text-align: center !important;
    }
  }

}


/* ============================================================
   HOCHFORMAT-ANPASSUNGEN (Portrait-Modus auf Tablet)
   Nur Unterschiede zum Querformat. Ersetzt styles-upright-tablet.css.
   ============================================================ */

@media (min-width: 480px) and (max-width: 799px) and (orientation: portrait) {

  /* Startseite: im Hochformat zentriert statt linksbündig */
  .sm-start {
    text-align: center;
  }

  .sm-start-card {
    display: block;
    grid-template-columns: none;
  }

  .sm-start-card h1 {
    font-size: 28px;
  }

  .sm-search-wrap {
    width: min(100%, 680px);
  }

  .sm-search button {
    min-width: 68px;
  }

  /* Sheet: etwas schmaler im Hochformat */
  .sheet {
    width: min(700px, calc(100vw - 40px));
  }

  .app-info-sheet {
    max-height: min(82vh, 760px);
  }

  /* Info-Sheet: einspaltig im Hochformat */
  .app-info-grid {
    grid-template-columns: 1fr;
  }

  .info-hero {
    grid-template-columns: 1fr;
  }

  .donation-card img {
    width: min(100%, 260px);
    max-height: 260px;
  }

  /* Desktop-Toolbar: im Hochformat etwas schmaler */
  .desktop-map-controls {
    max-width: 760px;
  }

}
