/* public/assets/css/style.css - VMS Dark Professional */

/* =============================================
   CSS Variables — Design System
   ============================================= */
:root {
    --bg-main:      #0d1117;
    --bg-sidebar:   #0a0a14;
    --bg-card:      #161b22;
    --accent:       #1ab7ea;
    --text-primary: #e6edf3;
    --text-muted:   #8b949e;
    --border:       rgba(255, 255, 255, 0.08);
    --sidebar-w:    220px;
    --topbar-h:     60px;
}

/* =============================================
   Base Reset
   ============================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, sans-serif;
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent);
    opacity: 0.85;
}

/* =============================================
   Topbar
   ============================================= */
.vms-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    z-index: 1000;
}

.vms-logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    text-decoration: none;
}
.vms-logo:hover {
    color: var(--accent);
    opacity: 1;
}

.vms-search {
    flex: 1;
    max-width: 480px;
}
.vms-search .form-control {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 20px;
    padding: 6px 14px;
}
.vms-search .form-control::placeholder {
    color: var(--text-muted);
}
.vms-search .form-control:focus {
    background: rgba(255,255,255,0.09);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(26,183,234,0.2);
}

.vms-topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.vms-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vms-username {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Hamburger button (hidden on desktop) */
.sidebar-toggle-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 36px;
    height: 36px;
}
.sidebar-toggle-btn span {
    display: block;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.2s;
}

/* =============================================
   Sidebar
   ============================================= */
.vms-sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 20px 0;
    transition: transform 0.25s ease;
    z-index: 900;
}

.vms-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.vms-nav li a {
    display: block;
    padding: 10px 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.15s, background 0.15s;
    border-left: 3px solid transparent;
}
.vms-nav li a:hover {
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    opacity: 1;
}
.vms-nav li.active a {
    color: var(--accent);
    border-left-color: var(--accent);
    background: rgba(26,183,234,0.08);
}

/* =============================================
   Main Layout
   ============================================= */
.vms-layout {
    display: flex;
    min-height: calc(100vh - var(--topbar-h));
    margin-top: var(--topbar-h);
}

.vms-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 28px 24px;
    min-width: 0;
}

/* =============================================
   Cards — General
   ============================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
}

.card-header {
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.card-body {
    color: var(--text-primary);
}

/* =============================================
   Video Card
   ============================================= */
.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    color: var(--text-primary);
}
.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(26,183,234,0.2);
}

.video-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #1a1a2e;
    overflow: hidden;
}
.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-thumb-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #0d0d1a);
    display: flex;
    align-items: center;
    justify-content: center;
}
.video-thumb-placeholder svg {
    width: 48px;
    height: 48px;
    fill: rgba(255,255,255,0.5);
}

.video-card .card-body {
    padding: 12px;
}
.video-card .card-title {
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 4px;
    line-height: 1.4;
}

/* =============================================
   Folder Card
   ============================================= */
.folder-card {
    border: 1px solid rgba(26,183,234,0.3);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    color: var(--text-primary);
    background: var(--bg-card);
}
.folder-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(26,183,234,0.2);
}

/* =============================================
   Player
   ============================================= */
.player-container {
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}
.embed-responsive {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    background: #000;
}
.embed-responsive iframe,
.embed-responsive video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.video-js {
    width: 100%;
    min-height: 320px;
}

/* =============================================
   Forms — Dark Style
   ============================================= */
.form-control,
.form-select {
    background-color: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.form-control:focus,
.form-select:focus {
    background-color: rgba(255,255,255,0.09);
    border-color: var(--accent);
    color: var(--text-primary);
    box-shadow: 0 0 0 2px rgba(26,183,234,0.2);
}
.form-control::placeholder {
    color: var(--text-muted);
}
.form-label {
    color: var(--text-muted);
    font-size: 0.875rem;
}
.form-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* =============================================
   Buttons — Accent
   ============================================= */
.btn-primary {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-primary:hover,
.btn-primary:focus {
    background-color: #17a3d4;
    border-color: #17a3d4;
    color: #fff;
}
.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-outline-secondary:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
    border-color: var(--border);
}

/* View toggle */
.view-toggle .btn { color: var(--text-muted); border-color: var(--border); background: rgba(255,255,255,0.03); }
.view-toggle .btn.active { color: #000; background: var(--accent); border-color: var(--accent); }

/* =============================================
   List Groups — Dark
   ============================================= */
.list-group-item {
    background: transparent;
    border-color: var(--border);
    color: var(--text-primary);
}

/* =============================================
   Alerts — Dark adjustment
   ============================================= */
.alert-info {
    background: rgba(26,183,234,0.12);
    border-color: rgba(26,183,234,0.3);
    color: var(--text-primary);
}

/* =============================================
   Text utilities override
   ============================================= */
.text-muted {
    color: var(--text-muted) !important;
}

/* =============================================
   Navbar (legacy pages compatibility)
   ============================================= */
.navbar-logo {
    height: 36px;
    width: auto;
}

/* =============================================
   Breadcrumb VMS
   ============================================= */
.breadcrumb-vms {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* =============================================
   Auth Pages
   ============================================= */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
}

.auth-card h1 {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 28px;
}

.auth-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    display: block;
    margin: 0 auto 1rem;
}

/* Share page */
.share-password-form {
    max-width: 320px;
}

/* =============================================
   Poster Picker
   ============================================= */
.poster-picker-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-top: 24px;
}

.picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.picker-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.picker-status-msg {
    font-size: 0.85rem;
    color: var(--accent);
    min-height: 1.2em;
}

.picker-preview-wrap {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}

#poster-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
    min-height: 120px;
    background: #111;
}

.picker-overlay-timecode {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}

/* Timeline scrubber */
.picker-timeline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.picker-time-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 36px;
}

.picker-scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.15);
    outline: none;
    cursor: pointer;
    accent-color: var(--accent);
}

.picker-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(26,183,234,0.6);
}

.picker-scrubber::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

/* Pulsanti controllo */
.picker-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    justify-content: center;
    margin-top: 14px;
}

.picker-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.picker-btn:hover {
    background: rgba(255,255,255,0.14);
}

.picker-btn-confirm {
    background: #f0a500;
    border-color: #f0a500;
    color: #000;
    font-weight: 600;
    padding: 6px 18px;
}

.picker-btn-confirm:hover {
    background: #ffc107;
    border-color: #ffc107;
}

.picker-btn-confirm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================
   Poster Picker Page (poster_picker.php)
   ============================================= */
.pp-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 0;
}

.pp-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.pp-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.pp-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 768px) {
    .pp-layout { grid-template-columns: 1fr; }
}

.pp-video-el {
    width: 100%;
    border-radius: 8px;
    background: #000;
    display: block;
}

.pp-canvas-wrap {
    position: relative;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    line-height: 0;
}

#pp-canvas {
    width: 100%;
    height: auto;
    display: block;
    min-height: 100px;
    background: #111;
    border-radius: 8px;
}

.pp-canvas-timecode {
    position: absolute;
    bottom: 8px;
    right: 10px;
    background: rgba(0,0,0,0.75);
    color: #fff;
    font-family: monospace;
    font-size: 0.82rem;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
}

.pp-timeline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

.pp-time-lbl {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    min-width: 36px;
}

.pp-scrubber {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.15);
    outline: none;
    cursor: pointer;
    accent-color: var(--accent);
}

.pp-scrubber::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 4px rgba(26,183,234,0.6);
}

.pp-step-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
    justify-content: center;
}

.pp-btn {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 6px;
    padding: 7px 13px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.pp-btn:hover { background: rgba(255,255,255,0.14); }

.pp-confirm-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.pp-btn-confirm {
    background: #f0a500;
    border: none;
    color: #000;
    font-weight: 700;
    border-radius: 6px;
    padding: 9px 22px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s;
}

.pp-btn-confirm:hover   { background: #ffc107; }
.pp-btn-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

.pp-status-msg {
    font-size: 0.88rem;
    min-height: 1.2em;
}

/* Video card — pulsanti azione owner */
.card-footer-actions {
    display: flex;
    gap: 6px;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

.btn-card-action {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid var(--border);
    color: var(--text-primary);
    background: rgba(255,255,255,0.05);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-card-action:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); opacity: 1; }

.btn-action-poster { border-color: rgba(240,165,0,0.4); color: #f0a500; }
.btn-action-poster:hover { background: rgba(240,165,0,0.12); color: #ffc107; }

.btn-action-edit { border-color: rgba(26,183,234,0.3); color: var(--accent); }
.btn-action-edit:hover { background: rgba(26,183,234,0.1); }

/* =============================================
   Video List View
   ============================================= */
.video-list-card { border: 1px solid var(--border); }
.video-list-row {
    background: rgba(0,0,0,0.04);
    border-color: var(--border);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}
.video-list-thumb-wrap { display: block; flex: 0 0 auto; }
.video-list-thumb {
    width: 140px;
    height: 78px;
    border-radius: 8px;
    object-fit: cover;
    background: #1a1a2e;
    border: 1px solid var(--border);
}
.video-list-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1a2e, #0d0d1a);
}
.video-list-thumb.placeholder svg { width: 42px; height: 42px; fill: rgba(255,255,255,0.5); }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.minw-0 { min-width: 0; }

@media (max-width: 768px) {
    .video-list-row { flex-wrap: wrap; }
    .video-list-thumb { width: 120px; height: 68px; }
}

/* =============================================
   Mobile Responsive
   ============================================= */
@media (max-width: 768px) {
    .vms-sidebar {
        transform: translateX(-100%);
    }
    .vms-sidebar.open {
        transform: translateX(0);
    }
    .vms-main {
        margin-left: 0;
        padding: 16px;
    }
    .sidebar-toggle-btn {
        display: flex;
    }
    .vms-search {
        max-width: 180px;
    }
}

/* === Folder card con cover image === */
.folder-card .folder-cover {
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}
.folder-card .folder-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.folder-card .folder-name {
    padding: 8px 10px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}
/* Folder header in folder_view: keep cover thumbnail small (no hero image) */
.folder-header-cover,
.folder-title-thumb {
    width: 52px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
}
/* Cover preview in rename modal */
.folder-cover-preview {
    width: 100%;
    max-height: 120px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}
