/**************************************************
 * VAC – Mobile Overrides
 * Lade diese Datei NACH der Desktop-CSS.
 **************************************************/

/* Mobile Design Tokens */
@media (max-width: 768px) {
  :root{
    --mobile-gap: 12px;
    --mobile-pad: 12px;
    --card-h: 220px;   /* mobile Card-Höhe */
    --title-h: 40px;   /* Titel-Zeilenhöhe (2 Zeilen) */
  }

  /* Basis */
  html, body{
    height: 100%;
    overflow: hidden;             /* wir managen Scroll im Content */
    -webkit-tap-highlight-color: transparent;
  }

  body{
    font-size: 15px;
    line-height: 1.35;
  }

  /* Layout: Sidebar oben, Content darunter */
  .main-content{
    flex-direction: column;
    height: 100dvh;               /* sichere Viewport-Höhe auf Mobile */
    margin-top: 72px;             /* Platz für deine Navbar/Head */
    overflow: hidden;
  }

  /* Sidebar wird zu „Folder-Leiste“ (oben) */
  .sidebar{
    flex: 0 0 auto;
    padding: var(--mobile-pad);
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.1);
    background-position: center top;
    background-size: cover;
  }

  .sidebar h2{
    margin: 0 0 8px;
    font-size: 16px;
  }

  .folder-list-container{
    max-height: 34vh;             /* begrenzen, damit Content drunter Platz hat */
    padding-bottom: 8px;
    overflow: auto;
  }

  /* Content scrollt eigenständig */
  .content#contentArea{
    flex: 1 1 auto;
    padding: var(--mobile-pad);
    overflow: auto;
    scroll-behavior: smooth;
  }

  /* Header + SortBar kompakt & sticky */
  #headerContainer{
    gap: 10px;
  }

  #sortBar{
    position: sticky;
    top: 0;
    z-index: 5;
    margin: 8px 0 12px;
    padding: 8px 6px;
    background: linear-gradient(135deg, rgba(0,0,0,.35), rgba(0,0,0,.15));
    backdrop-filter: blur(4px);
    border-radius: 10px;
  }

  #sortSelect{
    min-width: 0;
    width: 100%;
    font-size: 14px;
    padding: 10px 12px;
  }

  /* Grid: 2 Spalten auf Phones im Querformat/größere Phones */
  #contentList.video-grid,
  #contentList{
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--mobile-gap);
    padding-bottom: 18px;         /* Bodenabstand */
  }

  /* Spacer gegen Footer-Overlap */
  #contentList::after{
    content: "";
    grid-column: 1 / -1;
    height: 88px;
    pointer-events: none;
  }

  /* Cards: kompakter, gleiche Höhe */
  .card{
    height: var(--card-h);
    padding: 10px;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    box-sizing: border-box;
  }

  /* Media-Bereich (Video oder Folder-Icon) füllt Rest */
  .card > video,
  .card > .folder-thumbnail{
    flex: 1 1 auto;
    width: 100%;
    height: calc(var(--card-h) - var(--title-h) - 20px); /* 20px ~ vert. Padding */
    object-fit: contain;          /* nichts abschneiden */
    border-radius: 10px;
    display: block;
  }

  .video-thumbnail{
    aspect-ratio: 16 / 9;
    object-fit: cover;
  }

  .folder-thumbnail{
    margin: 0 auto;               /* mittig */
    background-position: center;
    background-repeat: no-repeat;
    background-size: contain;
  }

  /* Titelbereich: immer gleich hoch & mittig */
  .video-name,
  .folder-name{
    margin-top: 8px;
    min-height: var(--title-h);
    font-size: 13px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-align: center;
  }

  /* Buttons: Touch-Ziele größer */
  .delete-button{
    width: 22px;
    height: 22px;
    top: 8px;
    right: 8px;
  }

  .pip-button{
    width: 36px;
    height: 36px;
    bottom: 8px;
    right: 8px;
  }

  .card-btnwrap{
    bottom: 8px;
    right: 8px;
    gap: 6px;
  }

  /* Tree kompakter */
  .treeview li{
    margin: 4px 0;
    padding-left: 20px;
  }
  .folder{
    padding: 8px 10px 8px 36px;
  }
  .folder-icon{
    width: 20px;
    height: 20px;
  }
  .toggle{
    width: 14px;
    height: 14px;
  }

  /* Login/Modals an Mobile anpassen */
  .login-modal{
    padding: 12px;
  }
  .login-box{
    width: 92%;
    max-width: 380px;
    padding: 20px;
  }
  .login-box input{
    font-size: 16px;              /* bessere Tastatur/AutoFill */
    padding: 12px;
  }
  .login-box button{
    padding: 12px;
  }

  .modal{
    padding: 12px;
  }
  .modal-content{
    width: 92%;
    max-width: 360px;
    margin-top: 20vh;
    padding: 16px;
  }

  /* Upload UI: progress bar kleiner */
  #progressContainer{
    width: calc(100% - 24px);
    left: 12px;
    right: 12px;
    transform: none;
    bottom: 12px;
  }
  #progressBar{
    height: 28px;
  }
  #raptor{
    width: 28px;
    height: 28px;
  }
  .coin{
    width: 22px;
    height: 22px;
    top: 3px;
  }

  /* Wasserzeichen kleiner */
  .watermark img{
    max-width: 160px;
  }
}

/* Sehr kleine Phones / Portrait */
@media (max-width: 480px){
  :root{
    --card-h: 200px;
    --title-h: 38px;
  }

  /* 1 Spalte */
  #contentList.video-grid,
  #contentList{
    grid-template-columns: 1fr !important;
    gap: 10px;
  }

  /* Überschriften kleiner */
  h2, h3{
    font-size: 18px;
  }

  /* SortSelect full-width */
  #sortSelect{
    font-size: 13px;
    padding: 10px;
  }

  /* Sidebar-Liste etwas niedriger */
  .folder-list-container{
    max-height: 30vh;
  }
}
