/* VR Kino - Clean Stylesheet */
:root {
    --bg: #0f0f0f;
    --bg2: #1a1a1a;
    --bg3: #252525;
    --fg: #fff;
    --fg2: #aaa;
    --fg3: #666;
    --accent: #e50914;
    --accent2: #f40612;
    --success: #46d369;
    --header: 56px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--fg); }
#app { height: 100%; display: flex; flex-direction: column; }

/* Header */
.header {
    height: var(--header);
    padding: 0 12px;
    padding-top: var(--safe-top);
    background: var(--bg2);
    border-bottom: 1px solid #333;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    flex-shrink: 0;
}
.logo { font-size: 1.1rem; font-weight: 600; flex: 1; }
.header-actions { display: flex; gap: 4px; }
#selectModeBtn.active { background: var(--accent); }
#selectModeBtn.active svg { fill: white; }

/* Batch Selection Toolbar */
.batch-toolbar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg2);
    border-top: 1px solid #333;
    padding: 12px 16px;
    padding-bottom: calc(12px + var(--safe-bottom));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 150;
    transform: translateY(0);
    transition: transform 0.3s;
}
.batch-toolbar.hidden { transform: translateY(100%); }
#batchCount { font-size: 0.9rem; color: var(--fg2); white-space: nowrap; }
.batch-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.batch-btn {
    padding: 8px 14px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 8px;
    color: var(--fg);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}
.batch-btn:hover { background: var(--accent); border-color: var(--accent); }
.batch-cancel { background: transparent; border-color: #555; }
.batch-cancel:hover { background: #333; border-color: #666; }

/* Selection Mode Checkbox */
.select-checkbox {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.6);
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.2s;
}
.select-checkbox svg { width: 18px; height: 18px; fill: white; opacity: 0; }
.video-card.selected .select-checkbox {
    background: var(--accent);
    border-color: var(--accent);
}
.video-card.selected .select-checkbox svg { opacity: 1; }
body.select-mode .select-checkbox { display: flex; }
body.select-mode .video-card { cursor: default; }
body.select-mode .video-card:hover { transform: none; box-shadow: none; }
body.select-mode .video-list-item { cursor: default; }
body.select-mode .video-list-item:hover { background: var(--bg2); }
body.select-mode .video-list-item.selected { background: rgba(229, 9, 20, 0.15); }
body.select-mode .video-list-item .select-checkbox { display: flex; }
body.select-mode .content { padding-bottom: calc(80px + var(--safe-bottom)); }

/* Icon Button */
.icon-btn {
    width: 40px; height: 40px; padding: 8px;
    background: none; border: none; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg3); }
.icon-btn svg { width: 24px; height: 24px; fill: var(--fg); }

/* Search */
.search-bar {
    position: absolute; top: var(--header); left: 0; right: 0;
    padding: 12px; background: var(--bg2); display: flex; gap: 8px;
    z-index: 99; border-bottom: 1px solid #333;
}
.search-bar.hidden { display: none; }
.search-bar input {
    flex: 1; padding: 10px 16px; background: var(--bg3);
    border: 1px solid #333; border-radius: 20px;
    color: var(--fg); font-size: 1rem; outline: none;
}
.search-bar input:focus { border-color: var(--accent); }

/* Side Menu */
.side-menu {
    position: fixed; top: 0; left: -260px; width: 260px; height: 100%;
    background: var(--bg2); z-index: 200; transition: transform 0.3s;
    padding-top: calc(var(--header) + 16px); overflow-y: auto;
}
.side-menu.open { transform: translateX(260px); }
.menu-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.7);
    z-index: 199; opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.menu-overlay.open { opacity: 1; pointer-events: auto; }
.nav-item {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 24px; color: var(--fg2); text-decoration: none;
}
.nav-item:hover, .nav-item.active { background: var(--bg3); color: var(--fg); }
.nav-item.active { border-left: 3px solid var(--accent); }
.nav-item svg { width: 24px; height: 24px; fill: currentColor; }
.side-menu hr { border: none; border-top: 1px solid #333; margin: 8px 16px; }

/* Content */
.content {
    flex: 1; overflow-y: auto; padding: 16px;
    padding-bottom: calc(16px + var(--safe-bottom));
}

/* Video Grid - BIG CARDS (nur 4 sichtbar) */
.video-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 16px;
}
@media (min-width: 600px) {
    .video-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Video Card - CLEAN DESIGN */
.video-card {
    background: var(--bg2);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}
.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.video-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: var(--bg3);
    overflow: hidden;
}
.video-thumb img {
    width: 100%; height: 100%; object-fit: cover;
    opacity: 0; transition: opacity 0.3s;
}
.video-thumb img.loaded { opacity: 1; }

/* v3.2: Video preview on hover */
.video-thumb .preview-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1;
}
.video-card.video-previewing .preview-video {
    opacity: 1;
}
.video-card.video-previewing .thumb-img {
    opacity: 0 !important;
}

.video-duration {
    position: absolute; bottom: 8px; right: 8px;
    padding: 2px 6px; background: rgba(0,0,0,0.8);
    border-radius: 4px; font-size: 0.75rem;
    z-index: 3;
}
.video-progress {
    position: absolute; bottom: 0; left: 0; height: 3px;
    background: var(--accent);
    z-index: 2;
}

/* Thumbnail Hover Preview */
.thumb-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255,255,255,0.2);
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 4;
}
.thumb-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s linear;
}
.video-card.previewing .thumb-progress {
    opacity: 1;
}
.video-card.previewing .video-duration {
    opacity: 0;
}
.video-card.previewing .video-progress {
    opacity: 0;
}

.video-favorite {
    position: absolute; top: 8px; left: 8px;
}
.video-favorite svg { width: 20px; height: 20px; fill: var(--accent); }

/* v3.1: Duplicate Badge */
.duplicate-badge {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 8px;
    background: rgba(255, 100, 0, 0.9);
    color: white;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: bold;
    z-index: 5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* v3.1: Release Date Badge */
.release-date-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--fg2);
    border-radius: 4px;
    font-size: 0.7rem;
    z-index: 3;
}

.video-info { padding: 12px; display: flex; align-items: center; gap: 8px; }
.video-title {
    font-size: 0.9rem; font-weight: 500;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
    flex: 1;
}

/* Edit Button - UNDER VIDEO in info area */
.edit-btn {
    padding: 6px 12px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 6px;
    cursor: pointer;
    color: var(--fg);
    font-size: 0.8rem;
    white-space: nowrap;
    transition: background 0.2s, border-color 0.2s;
}
.edit-btn:hover, .edit-btn:active { 
    background: var(--accent); 
    border-color: var(--accent);
}

/* Video List - LARGER ITEMS (5 per screen) */
.video-list { display: flex; flex-direction: column; gap: 12px; }
.video-list-item {
    display: flex; align-items: center; gap: 16px;
    padding: 12px; background: var(--bg2); border-radius: 10px;
    cursor: pointer; position: relative;
    min-height: 100px;
}
.video-list-item:hover { background: var(--bg3); }
.video-list-item .select-checkbox {
    display: none;
    width: 28px; height: 28px;
    background: var(--bg3);
    border: 2px solid #555;
    border-radius: 6px;
    align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-right: -8px;
}
.video-list-item .select-checkbox svg { width: 18px; height: 18px; fill: white; opacity: 0; }
.video-list-item.selected .select-checkbox { background: var(--accent); border-color: var(--accent); }
.video-list-item.selected .select-checkbox svg { opacity: 1; }
.video-list-item .thumb {
    width: 180px; aspect-ratio: 16/9; background: var(--bg3);
    border-radius: 6px; overflow: hidden; flex-shrink: 0; position: relative;
}
.video-list-item .thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-list-item .info { flex: 1; min-width: 0; }
.video-list-item .title { font-size: 1rem; font-weight: 500; margin-bottom: 6px; }
.video-list-item .meta { font-size: 0.9rem; color: var(--fg2); }
.video-list-item .edit-btn { 
    position: static; 
    width: 40px; height: 40px;
    padding: 8px;
    background: var(--bg3);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.video-list-item .edit-btn:hover { background: var(--bg4, #444); }
.video-list-item .edit-btn svg { width: 20px; height: 20px; fill: var(--fg); }

/* VR Player - FULL SCREEN */
.vr-player {
    position: fixed; inset: 0;
    background: #000; z-index: 300;
}
.vr-player.hidden { display: none; }
#vrScene { width: 100%; height: 100%; }
#vrScene.hidden { display: none; }

/* Three.js Container */
.three-container {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
}
.three-container.hidden { display: none; }
.three-container canvas {
    width: 100% !important;
    height: 100% !important;
}

/* VR Controls Overlay */
.vr-controls {
    position: absolute; inset: 0;
    pointer-events: none;
    display: flex; flex-direction: column;
    justify-content: space-between;
    transition: opacity 0.3s;
}
.vr-controls.hidden { opacity: 0; }
.vr-controls > * { pointer-events: auto; }

.vr-top-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-top));
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}
.vr-title { flex: 1; font-size: 1rem; font-weight: 500; }

.vr-center-play {
    position: absolute; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 80px; height: 80px;
    background: rgba(0,0,0,0.6);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    opacity: 0; transition: opacity 0.3s;
}
.vr-controls:not(.playing) .vr-center-play { opacity: 1; }
.vr-center-play svg { width: 40px; height: 40px; fill: #fff; margin-left: 4px; }

.vr-bottom-bar {
    padding: 16px 20px;
    padding-bottom: calc(20px + var(--safe-bottom));
    background: linear-gradient(to top, rgba(0,0,0,0.9), rgba(0,0,0,0.6) 60%, transparent);
}

.vr-progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.vr-progress input[type="range"] {
    flex: 1; height: 8px; -webkit-appearance: none;
    background: rgba(255,255,255,0.3); border-radius: 4px;
}
.vr-progress input::-webkit-slider-thumb {
    -webkit-appearance: none; width: 20px; height: 20px;
    background: var(--accent); border-radius: 50%; cursor: pointer;
}
#vrTime { font-size: 0.95rem; color: var(--fg2); white-space: nowrap; }

.vr-buttons {
    display: flex; flex-wrap: wrap; gap: 10px;
    justify-content: center;
}

.vr-btn {
    padding: 12px 18px;
    background: rgba(255,255,255,0.15);
    border: none; border-radius: 8px;
    color: #fff; font-size: 1rem;
    cursor: pointer; white-space: nowrap;
    transition: background 0.2s;
    min-height: 48px;
}
.vr-btn:hover { background: rgba(255,255,255,0.25); }
.vr-btn.active { background: var(--accent); }
.vr-enter { background: var(--accent); font-weight: 600; }
.vr-enter:hover { background: var(--accent2); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex; align-items: center; justify-content: center;
    z-index: 400; padding: 16px;
}
.modal {
    background: var(--bg2);
    border-radius: 12px;
    width: 100%; max-width: 450px;
    max-height: 90vh; overflow-y: auto;
}
.modal.modal-large { max-width: 600px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px; border-bottom: 1px solid #333;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-body { padding: 20px; }
.modal-footer {
    display: flex; gap: 12px; padding: 16px 20px;
    border-top: 1px solid #333;
}
.modal-footer .spacer { flex: 1; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--fg2); font-size: 0.9rem; }
.form-group input[type="text"],
.form-group input[type="file"] {
    width: 100%; padding: 10px 12px;
    background: var(--bg3); border: 1px solid #333;
    border-radius: 6px; color: var(--fg); font-size: 1rem;
}
.form-group input:focus { border-color: var(--accent); outline: none; }

/* Filename Input */
.filename-input {
    display: flex; align-items: center; gap: 4px;
}
.filename-input input { flex: 1; }
.filename-input .file-ext { 
    color: var(--fg3); font-size: 0.9rem; white-space: nowrap; 
}

/* Thumbnail Select Grid */
.thumb-select {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg3);
    border-radius: 6px;
}
.thumb-option {
    position: relative;
    aspect-ratio: 16/9;
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.thumb-option:hover { border-color: var(--fg3); }
.thumb-option.selected { border-color: var(--accent); }
.thumb-option img { width: 100%; height: 100%; object-fit: cover; }
.thumb-option .thumb-label {
    position: absolute;
    bottom: 2px; right: 4px;
    font-size: 0.7rem;
    background: rgba(0,0,0,0.7);
    padding: 1px 4px;
    border-radius: 3px;
}

/* Cover Preview */
.cover-preview {
    margin-top: 8px;
}
.cover-preview img {
    max-width: 150px;
    max-height: 100px;
    border-radius: 6px;
    object-fit: cover;
}

/* Stars Select */
.stars-select {
    display: flex; flex-wrap: wrap; gap: 8px;
    max-height: 150px; overflow-y: auto;
    padding: 8px; background: var(--bg3); border-radius: 6px;
}
.star-checkbox {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 10px; background: var(--bg2);
    border-radius: 16px; cursor: pointer; font-size: 0.85rem;
}
.star-checkbox:has(input:checked) { background: var(--accent); }
.star-checkbox input { display: none; }
.star-checkbox .star-thumb { width: 20px; height: 20px; border-radius: 50%; overflow: hidden; }
.star-checkbox .star-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* Checkbox */
.checkbox-group { display: flex; align-items: center; gap: 8px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); }

/* Buttons */
.btn-primary {
    padding: 10px 20px; background: var(--accent);
    border: none; border-radius: 6px;
    color: #fff; font-size: 0.95rem; cursor: pointer;
}
.btn-primary:hover { background: var(--accent2); }
.btn-secondary {
    padding: 10px 20px; background: var(--bg3);
    border: none; border-radius: 6px;
    color: var(--fg); font-size: 0.95rem; cursor: pointer;
}
.btn-secondary:hover { background: #444; }
.btn-danger {
    padding: 10px 20px; background: transparent;
    border: 1px solid var(--accent); border-radius: 6px;
    color: var(--accent); font-size: 0.95rem; cursor: pointer;
}
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn-small {
    padding: 6px 12px; font-size: 0.8rem; margin-top: 8px;
}

/* Stars Page */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 1.4rem; margin: 0; }

/* Star Search */
.star-search {
    display: flex; gap: 8px; margin-bottom: 16px;
}
.star-search input {
    flex: 1; padding: 12px 16px; background: var(--bg2);
    border: 1px solid #333; border-radius: 10px;
    color: var(--fg); font-size: 1rem;
}
.star-search input:focus { border-color: var(--accent); outline: none; }

/* Stars Grid - 2x2 visible (4 cards) */
.stars-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Star Card - Big and touchable */
.star-card {
    background: var(--bg2);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}
.star-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.star-card .photo {
    width: 100%;
    aspect-ratio: 3/4;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.star-card .photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.star-card:hover .photo img {
    transform: scale(1.05);
}
.star-card .photo svg { width: 64px; height: 64px; fill: var(--fg3); }
.star-card .star-info {
    padding: 12px 10px;
    background: linear-gradient(to top, var(--bg2), rgba(26,26,26,0.9));
}
.star-card .name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.star-card .count {
    font-size: 0.8rem;
    color: var(--fg2);
}
.star-card .edit-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: rgba(0,0,0,0.6);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}
.star-card:hover .edit-btn { opacity: 1; }
.star-card .edit-btn:hover { background: var(--accent); }
.star-card .edit-btn svg { width: 100%; height: 100%; fill: white; }

/* Star Detail View */
.star-detail {
    margin-bottom: 20px;
}
.star-detail-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px;
    background: var(--bg2);
    border-radius: 12px;
    margin-bottom: 16px;
}
.star-detail-photo {
    width: 100px;
    height: 130px;
    background: var(--bg3);
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
}
.star-detail-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.star-detail-info {
    flex: 1;
    min-width: 0;
}
.star-detail-info h2 {
    font-size: 1.3rem;
    margin: 0 0 8px 0;
}
.star-detail-info .meta {
    color: var(--fg2);
    font-size: 0.9rem;
    margin-bottom: 12px;
}
.star-meta-info {
    color: var(--fg);
    font-size: 0.9rem;
    margin-bottom: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.star-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 8px;
    color: var(--fg);
    cursor: pointer;
    margin-bottom: 16px;
    font-size: 0.9rem;
}
.back-btn:hover { background: var(--bg2); border-color: #555; }

/* Studios Grid */
.studios-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.studio-card {
    background: var(--bg2);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}
.studio-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.studio-card .studio-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    background: var(--bg3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.studio-card .studio-info {
    flex: 1;
    min-width: 0;
}
.studio-card .name {
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}
.studio-card .count {
    font-size: 0.8rem;
    color: var(--fg2);
}
.studio-card .edit-btn {
    width: 36px;
    height: 36px;
    padding: 8px;
    background: var(--bg3);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}
.studio-card:hover .edit-btn { opacity: 1; }
.studio-card .edit-btn:hover { background: var(--accent); }
.studio-card .edit-btn svg { width: 100%; height: 100%; fill: white; }

/* Studio Detail View */
.studio-detail {
    margin-bottom: 20px;
}
.studio-detail-header {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 16px;
    background: var(--bg2);
    border-radius: 12px;
    margin-bottom: 16px;
}
.studio-detail-icon {
    font-size: 3rem;
    width: 80px;
    height: 80px;
    background: var(--bg3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.studio-detail-info {
    flex: 1;
    min-width: 0;
}
.studio-detail-info h2 {
    font-size: 1.3rem;
    margin: 0 0 8px 0;
}
.studio-detail-info .meta {
    color: var(--fg2);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* Photo Search Results */
.photo-search-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
    max-height: 200px;
    overflow-y: auto;
}
.photo-search-results img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, transform 0.2s;
}
.photo-search-results img:hover {
    border-color: var(--accent);
    transform: scale(1.02);
}
.photo-search-results img.selected {
    border-color: var(--accent);
}
.photo-search-btn {
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 6px;
    color: var(--fg);
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.photo-search-btn:hover { background: #333; }
.photo-search-loading {
    text-align: center;
    padding: 20px;
    color: var(--fg2);
}

/* Photo Preview */
.photo-preview { margin-top: 8px; }
.photo-preview img { max-width: 100px; max-height: 100px; border-radius: 8px; }

/* Upload */
.upload-area {
    border: 2px dashed #444;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}
.upload-area:hover, .upload-area.dragover { border-color: var(--accent); background: rgba(229,9,20,0.05); }
.upload-area svg { width: 64px; height: 64px; fill: var(--fg3); margin-bottom: 16px; }
.upload-area p { color: var(--fg2); }
.upload-progress { margin-top: 20px; }
.upload-progress .file-name { margin-bottom: 8px; }
.upload-progress .bar-container {
    height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden;
}
.upload-progress .bar-fill { height: 100%; background: var(--accent); transition: width 0.3s; }
.upload-progress .status { margin-top: 8px; color: var(--fg2); font-size: 0.9rem; }

/* Toast - centered in screen */
.toast {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    padding: 16px 32px; background: rgba(0,0,0,0.85);
    border-radius: 12px; font-size: 1.1rem;
    opacity: 0; transition: all 0.2s; z-index: 500;
    pointer-events: none;
}
.toast.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }

/* Scan Progress */
.scan-progress {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    padding: 24px; background: var(--bg2);
    border-radius: 12px; text-align: center; z-index: 500;
}
.scan-progress.hidden { display: none; }
.spinner {
    width: 40px; height: 40px; margin: 0 auto 16px;
    border: 4px solid #333; border-top-color: var(--accent);
    border-radius: 50%; animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* XBVR Sync Status */
.xbvr-status { display: flex; flex-direction: column; gap: 8px; }
.xbvr-stats { 
    display: flex; gap: 12px; flex-wrap: wrap; 
    justify-content: center; font-size: 0.85rem; color: var(--fg2); 
}

/* Empty State */
.empty-state {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 48px 24px; text-align: center;
}
.empty-state svg { width: 64px; height: 64px; fill: var(--fg3); margin-bottom: 16px; }
.empty-state h3 { margin-bottom: 8px; }
.empty-state p { color: var(--fg2); margin-bottom: 16px; }
.empty-text { color: var(--fg2); text-align: center; padding: 24px; }

/* Load More Button */
.btn-load-more {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 24px auto;
    padding: 14px 24px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 8px;
    color: var(--fg);
    font-size: 1rem;
    cursor: pointer;
}
.btn-load-more:hover {
    background: var(--bg2);
    border-color: var(--accent);
}

/* Responsive Galaxy Fold Fix */
@media (max-width: 400px) {
    .vr-buttons { gap: 4px; }
    .vr-btn { padding: 6px 10px; font-size: 0.8rem; }
    .vr-progress input { max-width: 50%; }
}

/* Stars Display in Edit Dialog */
.stars-display, .studios-display {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 32px;
    padding: 8px;
    background: var(--bg3);
    border-radius: 8px;
}
.stars-display .star-tag, .studios-display .studio-tag {
    padding: 6px 12px;
    background: var(--accent);
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
}
.studios-display .studio-tag {
    background: #4a9eff;
}
.stars-display .no-stars, .studios-display .no-studios {
    color: var(--fg3);
    font-size: 0.9rem;
}

/* Star Picker Modal - Full Screen */
.star-picker-modal {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    z-index: 400;
    overflow: hidden;
}
.star-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg2);
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}
.star-picker-header h2 {
    font-size: 1.2rem;
    margin: 0;
}
.star-picker-close {
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}
.star-picker-close:hover { background: var(--bg3); }
.star-picker-close svg { width: 24px; height: 24px; fill: var(--fg); }

.star-picker-search {
    padding: 12px 16px;
    background: var(--bg2);
    flex-shrink: 0;
}
.star-picker-search input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 10px;
    color: var(--fg);
    font-size: 1rem;
}
.star-picker-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.star-picker-grid {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    align-content: start;
    min-height: 0;
}

.star-picker-card {
    background: var(--bg2);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    text-align: center;
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 3px solid transparent;
}
.star-picker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.star-picker-card.selected {
    border-color: var(--accent);
}

.star-picker-photo {
    width: 100%;
    aspect-ratio: 3/4;
    background: var(--bg3);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.star-picker-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.star-picker-photo svg {
    width: 64px;
    height: 64px;
    fill: var(--fg3);
}

.star-picker-name {
    padding: 12px 10px;
    background: linear-gradient(to top, var(--bg2), rgba(26,26,26,0.9));
    font-weight: 600;
    font-size: 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.star-picker-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}
.star-picker-card.selected .star-picker-check {
    opacity: 1;
    transform: scale(1);
}
.star-picker-check svg {
    width: 18px;
    height: 18px;
    fill: white;
}

.star-picker-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: var(--bg2);
    border-top: 1px solid #333;
    gap: 12px;
    flex-shrink: 0;
}
.star-picker-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}
.star-picker-actions button {
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
}
.star-picker-actions .btn-secondary {
    background: var(--bg3);
    border: 1px solid #444;
    color: var(--fg);
}
.star-picker-actions .btn-primary {
    background: #444;
    border: none;
    color: var(--fg);
}
.star-picker-actions .btn-accent {
    background: var(--accent);
    border: none;
    color: white;
}
.star-picker-actions button:hover {
    opacity: 0.9;
}

.star-picker-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--fg3);
}

/* Studio Picker Cards */
.studio-picker-grid {
    grid-template-columns: repeat(2, 1fr);
}
.studio-picker-card {
    position: relative;
    background: var(--bg2);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.studio-picker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.studio-picker-card.selected {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.1);
}
.studio-picker-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    background: var(--bg3);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.studio-picker-name {
    font-weight: 500;
    font-size: 0.95rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.studio-picker-card .star-picker-check {
    background: #4a9eff;
}
.studio-picker-card.selected .star-picker-check {
    opacity: 1;
    transform: scale(1);
}

/* ========== v3.1 FEATURES ========== */

/* Grid Column Selector */
.grid-columns-selector {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}
.grid-columns-btn {
    width: 40px;
    height: 40px;
    padding: 8px;
    background: none;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.grid-columns-btn:hover { background: var(--bg3); }
.grid-columns-btn svg { width: 24px; height: 24px; fill: var(--fg); }
.grid-columns-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg2);
    border: 1px solid #333;
    border-radius: 8px;
    padding: 8px 0;
    min-width: 120px;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.grid-columns-dropdown.open { display: block; }
.grid-columns-option {
    padding: 10px 16px;
    cursor: pointer;
    color: var(--fg2);
    display: flex;
    align-items: center;
    gap: 8px;
}
.grid-columns-option:hover { background: var(--bg3); color: var(--fg); }
.grid-columns-option.active { color: var(--accent); }
.grid-columns-option.active::before { content: '✓'; width: 16px; }

/* Dynamic Grid Columns */
.video-grid.cols-1 { grid-template-columns: repeat(1, 1fr) !important; }
.video-grid.cols-2 { grid-template-columns: repeat(2, 1fr) !important; }
.video-grid.cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
.video-grid.cols-4 { grid-template-columns: repeat(4, 1fr) !important; }

/* Watch Later Toggle */
.watch-later-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
    z-index: 4;
}
.video-card:hover .watch-later-btn { opacity: 1; }
.watch-later-btn:hover { transform: scale(1.1); }
.watch-later-btn svg { width: 20px; height: 20px; fill: white; }
.watch-later-btn.active svg { fill: var(--accent); }
.watch-later-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    z-index: 3;
}

/* Rating Stars */
.rating-stars {
    display: flex;
    gap: 2px;
    align-items: center;
}
.rating-star {
    width: 20px;
    height: 20px;
    cursor: pointer;
    fill: #444;
    transition: fill 0.15s, transform 0.15s;
}
.rating-star:hover { transform: scale(1.2); }
.rating-star.filled { fill: #ffc107; }
.rating-star.hovered { fill: #ffdb4d; }
.video-rating {
    position: absolute;
    bottom: 30px;
    left: 8px;
    display: flex;
    gap: 1px;
    z-index: 3;
}
.video-rating svg {
    width: 12px;
    height: 12px;
    fill: #ffc107;
}
.rating-display {
    display: flex;
    gap: 3px;
    align-items: center;
}
.rating-display svg {
    width: 16px;
    height: 16px;
    fill: #ffc107;
}
.rating-display .empty { fill: #444; }

/* Edit Dialog Rating */
.edit-rating {
    display: flex;
    align-items: center;
    gap: 16px;
}
.edit-rating-stars {
    display: flex;
    gap: 4px;
}
.edit-rating-stars svg {
    width: 32px;
    height: 32px;
    cursor: pointer;
    fill: #444;
    transition: fill 0.15s, transform 0.15s;
}
.edit-rating-stars svg:hover { transform: scale(1.15); }
.edit-rating-stars svg.filled { fill: #ffc107; }
.edit-rating-clear {
    padding: 4px 8px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 4px;
    color: var(--fg2);
    font-size: 0.75rem;
    cursor: pointer;
}
.edit-rating-clear:hover { background: #333; }

/* Playlists Section in Menu */
.playlist-section {
    padding: 8px 16px;
}
.playlist-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px;
    color: var(--fg2);
    font-size: 0.85rem;
    text-transform: uppercase;
}
.playlist-add-btn {
    width: 24px;
    height: 24px;
    background: var(--bg3);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--fg);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.playlist-add-btn:hover { background: var(--accent); }
.playlist-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.playlist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--fg2);
    cursor: pointer;
    border-radius: 6px;
}
.playlist-item:hover { background: var(--bg3); color: var(--fg); }
.playlist-item.active { background: var(--bg3); color: var(--accent); }
.playlist-item-icon { font-size: 1.1rem; }
.playlist-item-name { flex: 1; font-size: 0.9rem; }
.playlist-item-count {
    background: var(--bg3);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--fg3);
}

/* XBVR Sync Status / Scan Status in Menu */
.sync-status {
    padding: 12px 16px;
    background: var(--bg3);
    margin: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
}
.sync-status.active {
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid var(--accent);
}
.sync-status.active .sync-status-title {
    color: var(--accent);
}
.sync-status-title {
    color: var(--fg2);
    margin-bottom: 4px;
    font-weight: 500;
}
.sync-status-progress {
    color: var(--fg);
    font-weight: 500;
    margin-bottom: 2px;
}
.sync-status-time {
    color: var(--fg2);
    font-size: 0.75rem;
}
.sync-status-count {
    color: var(--success);
    font-size: 0.75rem;
}
.sync-status .spinner-small {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 6px;
    vertical-align: middle;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Filter Buttons Row */
.filter-row {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-row::-webkit-scrollbar { display: none; }
.filter-btn {
    padding: 8px 16px;
    background: var(--bg2);
    border: 1px solid #333;
    border-radius: 20px;
    color: var(--fg2);
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--fg3); color: var(--fg); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: white; }

/* Tag Suggestions */
.tag-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}
.tag-suggestion {
    padding: 4px 10px;
    background: var(--bg3);
    border: 1px solid #444;
    border-radius: 14px;
    font-size: 0.8rem;
    color: var(--fg2);
    cursor: pointer;
    transition: all 0.2s;
}
.tag-suggestion:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

/* Duplicate Warning */
.duplicate-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ff9800;
    color: black;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 600;
    z-index: 3;
}

/* Edit Dialog - XBVR Metadata */
.video-description-text {
    background: var(--bg3);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--fg2);
    max-height: 150px;
    overflow-y: auto;
    line-height: 1.5;
}
.video-release-date {
    padding: 8px 12px;
    background: var(--bg3);
    border-radius: 8px;
    display: inline-block;
    font-weight: 500;
}
.video-duplicate-info {
    padding: 8px 12px;
    background: rgba(255, 152, 0, 0.2);
    border: 1px solid #ff9800;
    border-radius: 8px;
    color: #ff9800;
    font-weight: 500;
}

/* Playlist Picker Modal */
.playlist-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-height: 50vh;
    overflow-y: auto;
    padding: 8px;
}
.playlist-picker-card {
    background: var(--bg3);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    text-align: center;
}
.playlist-picker-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.playlist-picker-card.selected {
    border-color: var(--accent);
    background: rgba(229, 9, 20, 0.1);
}
.playlist-picker-icon { font-size: 2rem; margin-bottom: 8px; }
.playlist-picker-name { font-weight: 500; }
.playlist-picker-videos { color: var(--fg2); font-size: 0.8rem; margin-top: 4px; }

/* Description in Video Card (optional hover) */
.video-description {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    padding: 40px 12px 12px;
    font-size: 0.75rem;
    color: var(--fg2);
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 2;
    max-height: 50%;
    overflow: hidden;
}
.video-card:hover .video-description { opacity: 1; }

/* Release Date Badge */
.release-date-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    color: var(--fg2);
    z-index: 3;
}

/* Hidden */
.hidden { display: none !important; }
