html, body {
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;
}


::-webkit-scrollbar { width: 8px; background: transparent; }
::-webkit-scrollbar-thumb { background: #bbb; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #888; }

.win-scrollable {
    scrollbar-width: thin;             /* Firefox */
    scrollbar-color: #bbb transparent; /* Firefox: Balken, keine Hülle */
}

::-webkit-scrollbar-track { background: none !important; }

/* Webkit-Browser (Chrome, Safari, Edge) */
.win-scrollable::-webkit-scrollbar {
    width: 8px;
    background: transparent;           /* Die Hülle ist transparent */
}
.win-scrollable::-webkit-scrollbar-track {
    background: #fff !important;
    box-shadow: none !important;
    border: none !important;
}
.win-scrollable::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
    border: none;
}
.win-scrollable::-webkit-scrollbar-thumb:hover {
    background: #888;
}


/* Menu styles optimiert für die vereinfachte Struktur */

/* Ensure all list items behave correctly as menu items */
.menu-container li {
    position: relative;
    overflow: visible;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Ensure hover effect covers the entire menu item */
.menu-container li.group:hover,
.menu-container li:hover {
    background-image: linear-gradient(to bottom, #3BB6FE, #347DB8) !important;
    color: #fff !important;
}

/* Ensure all SVGs and spans inside menu items are properly visible */
.menu-container li > svg,
.menu-container li > span {
    z-index: 1;
    position: relative;
}

/* Ensure transitions are smooth */
.menu-container li {
    transition: background-image 0.3s ease, color 0.2s ease;
}

/* Prevent menu-container class from affecting non-menu elements */
.menu-container:not(li) {
    position: static;
}

.win-scrollable::-webkit-scrollbar {
    width: 8px;
    background: transparent !important;
}

.win-scrollable::-webkit-scrollbar-corner {
    background: transparent !important;
}
.win-scrollable::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 4px;
    border: none;
}

.win-scrollable {
    scrollbar-width: thin;
    scrollbar-color: #bbb transparent;
}

/* ===============================
   PHOTO GRID – FINAL
   =============================== */

/* Zentrales Grid-Layout */
.photo-gallery-grid {
    display: grid;
    justify-items: center;
    align-items: center;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.45s cubic-bezier(.4,0,.2,1);
    will-change: max-width, transform;
}

/* Preview: gleiches Grid, nur geschrumpft */
.preview-mode {
    max-width: 1200px !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.2rem !important;
    padding: 1rem 0 0 !important;
    overflow: visible !important;
    transform: scale(0.95);
}

/* Fullscreen: groß, zentriert, 4 Spalten (darunter 3), scrollbar */
.fullscreen-mode {
    max-width: 1200px !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.2rem !important;
    padding: 2rem 0 1rem 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    transform: scale(1);
}

/* Breakpoints */
@media (max-width: 1100px) {
    .fullscreen-mode {
        grid-template-columns: repeat(3, 1fr) !important;
        max-width: 700px !important;
    }
}
@media (max-width: 800px) {
    .fullscreen-mode,
    .preview-mode {
        grid-template-columns: repeat(2, 1fr) !important;
        max-width: 350px !important;
    }
}
@media (max-width: 500px) {
    .fullscreen-mode,
    .preview-mode {
        grid-template-columns: repeat(1, 1fr) !important;
        max-width: 180px !important;
    }
}

/* Quadratische Items */
.photo-container,
.photo-item {
    aspect-ratio: 1 / 1 !important;
    width: 100% !important;
    border: none !important;
    background: none !important;
    overflow: hidden !important;
    display: flex;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}

/* Bilder füllen das Quadrat vollständig */
.photo-container img,
.photo-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: #eee !important; /* kannst du auch entfernen */
}

.photo-gallery-grid, .photo-gallery-grid * {
    user-select: none !important;
    -webkit-user-select: none !important;
}

.photo-gallery-grid ::selection,
.photo-gallery-grid ::-moz-selection {
    background: transparent !important;
    color: inherit !important;
}

.photo-gallery-grid img { -webkit-user-drag: none !important; }

/* Keine sichtbaren Scrollbars im Preview-Modus */
.preview-mode::-webkit-scrollbar,
.preview-mode::-webkit-scrollbar-thumb {
    display: none !important;
    background: transparent !important;
}

/* ===== FOLDER GRID ===== */

.folder-gallery-grid {
    display: grid;
    justify-items: center;
    align-items: center;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.45s cubic-bezier(.4,0,.2,1);
}

.folder-container,
.folder-item {
    aspect-ratio: 1 / 1;
    width: 100%;
    overflow: hidden;
    position: relative;
}

.folder-container img {
    object-fit: contain;
}

/* ===== Finder-Style Folder selection ===== */

.folder-selected .icon-wrapper {
    background: #e5e5e5;          /* hellgrauer Hintergrund */
    border-radius: .75rem;
}

.folder-selected span {
    background: #007aff;          /* macOS Blau */
    color: #fff;
}

/* --- Folder-Grid 3 × 3 --- */
.folder-gallery-grid.preview-mode,
.folder-gallery-grid.fullscreen-mode {
    grid-template-columns: repeat(3, 1fr) !important;   /* 3 pro Reihe */
    max-width: 750px !important;                         /* passt für 3 Spalten */
    gap: 1rem !important;
}

/* Labels dürfen NICHT abgeschnitten werden */
.folder-item { overflow: visible !important; }

/* -- kompakter Finder-Select -- */
.folder-selected .icon-wrapper {
    background: #e5e5e5;
    border-radius: .75rem;
}
.close-button { position: relative; }
.close-button svg {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;             /* exakt zentriert */
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    pointer-events: none;  /* Klick geht ans Eltern-Element */
}
.close-button:hover svg { display: block; }


/* Video-Thumbnails im Grid wie Fotos */
.photo-container video,
.photo-item video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: #000 !important;
}

/* Cupertino-Style Button für die Foto-Controls */
.cupertino-btn{
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 44px;        /* große Klickfläche */
    min-height: 36px;
    padding: 6px 10px;

    border-radius: 12px;
    background: rgba(243,244,246,.50);      /* hellgrau */
    border: 1px solid rgba(0,0,0,.08);
    box-shadow:
            0 1px 2px rgba(0,0,0,.08),
            0 8px 20px rgba(0,0,0,.06);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    color: #111;
    transition: background .15s ease, box-shadow .2s ease, transform .1s ease, border-color .15s ease;
}

.cupertino-btn:hover{
    background: rgba(255,255,255,.95);
    border-color: rgba(0,0,0,.12);
    box-shadow:
            0 2px 6px rgba(0,0,0,.12),
            0 10px 24px rgba(0,0,0,.10);
}

.cupertino-btn:active{
    box-shadow:
            0 1px 2px rgba(0,0,0,.08),
            0 6px 12px rgba(0,0,0,.08);
}

.cupertino-btn svg{
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2.5;
    display: block;
    pointer-events: none;
}

.photo-ctl{ opacity: 0; pointer-events: none; transition: opacity .2s linear; }
.photo-ctl.show{ opacity: 1; pointer-events: auto; }

/* === Video-Thumbnail Overlays === */
.video-thumb { position: relative; }

.thumb-center-play,
.thumb-dl {
    opacity: 0;
    transition: opacity .2s linear;
}

.video-thumb:hover .thumb-center-play,
.video-thumb:hover .thumb-dl {
    opacity: 1;
}

/* Play zentriert */
.thumb-center-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;              /* klick geht an die Kachel */
}

/* Play-Pill größer */
.thumb-play-pill{
    width: 56px;              /* vorher 42px */
    height: 56px;             /* vorher 42px */
    border-radius: 9999px;
    background: rgba(243,244,246,.92);
    border: 1px solid rgba(0,0,0,.08);
    box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 20px rgba(0,0,0,.06);
    display: flex; align-items: center; justify-content: center;
}
/* Dreieck größer */
.thumb-play-pill svg{
    width: 24px;              /* vorher 18px */
    height: 24px;             /* vorher 18px */
    color: #111;
}
/* Download unten rechts – kleine Cupertino-Pill */
.thumb-dl{
    position: absolute; right: 8px; bottom: 8px;
    min-width: 32px; min-height: 28px; padding: 4px 6px;
    border-radius: 10px;
}
.thumb-dl svg { width: 16px; height: 16px; }

.window-move{
    transition:
            left  0.25s cubic-bezier(.25,1,.5,1),
            top   0.25s cubic-bezier(.25,1,.5,1);
    will-change: left, top;
}

.window-move.no-anim{ transition: none !important; }

/* Größere Folder-Preview wie bei Photos/Videos */
.folder-gallery-grid.preview-mode {
    max-width: 1200px !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 1.2rem !important;
    transform: scale(0.95); /* analog zu .preview-mode */
}

/* ===== MUSIC GRID (Cover wie BTS) ===== */
.music-item { overflow: visible !important; }
.music-item .icon-wrapper {
    background: #fff;               /* weißer Hintergrund */
    box-shadow: none;
    border-radius: .75rem;
}
.music-item img { background: #fff !important; } /* überschreibt #eee der Photo-Images */
.music-label { white-space: nowrap; max-width: 90%; text-overflow: ellipsis; overflow: hidden; }

/* Auswahl wie Finder */
.track-selected .icon-wrapper { background: #e5e5e5; }
.track-selected .music-label { background: #007aff; color: #fff; border-radius: .25rem; padding: 0 .25rem; }

.audio-thumb .thumb-dl { right: 28px; bottom: 28px; }
.resizing, .resizing * { cursor: nwse-resize !important; }


@@ Videos-Grid: kein Extra-Padding im Preview/Fullscreen @@
.photo-gallery-grid.videos-grid.preview-mode,
.photo-gallery-grid.videos-grid.fullscreen-mode {
    padding: 0 !important;
}

/* Scrollbars verbergen, Scroll bleibt aktiv */
.win-scrollable,
.photo-gallery-grid.preview-mode,
.photo-gallery-grid.fullscreen-mode {
    scrollbar-width: none !important;          /* Firefox */
    -ms-overflow-style: none !important;       /* IE/Edge */
}
.win-scrollable::-webkit-scrollbar,
.photo-gallery-grid.preview-mode::-webkit-scrollbar,
.photo-gallery-grid.fullscreen-mode::-webkit-scrollbar {
    width: 0 !important;                       /* Chrome/Safari */
    height: 0 !important;
}

.preview-mode,
.fullscreen-mode {
    content-visibility: auto;
    contain-intrinsic-size: 800px 600px;
}

/* BTS: ein Ordner mittig */
.folder-gallery-grid.center-single {
    grid-template-columns: 1fr !important;
    max-width: 220px !important;
}

/* Folder-Header bricht nicht */
table thead th { white-space: nowrap; }

/* Download-Link in Tabelle grau, nicht blau */
table a { color: #6B7280; text-decoration: none; }
table a:hover { text-decoration: underline; }

/* Mobile sheets */
.mobile-sheet { -webkit-overflow-scrolling: touch; }

@media (pointer: coarse), (max-width: 900px) {
    /* Fallback, falls JS-Bindung noch nicht greift */
    .menu-container { width: 100% !important; }
}

/* Mobile viewer/list smoothing */
.mobile-sheet, [x-ref="photoCarousel"] { -webkit-overflow-scrolling: touch; }

/* Mobile photo carousel improvements */
[x-ref="photoCarousel"] {
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory; /* Verhindert horizontales Überschießen beim Foto-Swipe */
}