/**
 * NX Cloud Share - Thème Sombre Cyberpunk
 * Styles personnalisés identiques à la maquette
 */

/* Variables globales - Thème Sombre */
:root {
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-tertiary: #1a1a25;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #2a2a3a;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Space Grotesk', sans-serif;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
}

/* Gradient background */
.gradient-bg {
    background: linear-gradient(135deg, var(--bg-primary) 0%, #0f0f1a 50%, var(--bg-primary) 100%);
    background-attachment: fixed; /* Le dégradé reste fixe pendant le scroll */
    background-size: cover;       /* Le dégradé s'étire pour couvrir toute la zone */
    min-height: 100vh;            /* S'assure que le fond fait au moins la taille de l'écran */
}

/* Effet Glass morphism */
.glass {
    background: rgba(18, 18, 26, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
}

/* Effet glow */
.glow {
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.15);
}

/* Boutons primaires */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

/* Boutons secondaires */
.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Inputs */
/* Note: body textarea / body select = spécificité 0,0,0,2 pour surpasser
   les sélecteurs d'éléments nus (0,0,0,1) injectés par le Tailwind Play CDN
   après le chargement de la page, qui écraserait sinon le padding défini ici. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="datetime-local"],
body textarea,
body select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    width: 100%;
    transition: all 0.2s ease;
}

input:focus,
body textarea:focus,
body select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-secondary);
}

/* File items */
.file-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
    border-color: var(--accent-primary);
}

/* Drop zone */
.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-secondary);
    position: relative; /* nécessaire pour le rectangle de sélection */
}

.drop-zone.dragover {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1);
}

/* Sidebar items */
.sidebar-item {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
}

.sidebar-item:hover,
.sidebar-item.active {
    background: var(--bg-tertiary);
    border-left-color: var(--accent-primary);
}

/* Modal overlay */
.modal-overlay {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
}

/* Progress bar */
.progress-bar {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    height: 0.5rem;
    border-radius: 1rem;
    transition: width 0.3s ease;
}

/* Context menu */
.context-menu {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.15s ease;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
    animation: slideIn 0.3s ease-in-out;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

.notification.success {
    border-left: 4px solid var(--success);
}

.notification.error {
    border-left: 4px solid var(--danger);
}

.notification.warning {
    border-left: 4px solid var(--warning);
}

/* Footer sticky */
footer {
    margin-top: auto;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--bg-tertiary);
    border-bottom: 2px solid var(--border-color);
}

table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

table tr:hover {
    background: var(--bg-tertiary);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

/* Utilitaires */
.text-primary {
    color: var(--text-primary);
}

.text-secondary {
    color: var(--text-secondary);
}

.text-accent {
    color: var(--accent-primary);
}

.bg-primary {
    background: var(--bg-primary);
}

.bg-secondary {
    background: var(--bg-secondary);
}

.bg-tertiary {
    background: var(--bg-tertiary);
}

.border-primary {
    border-color: var(--border-color);
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }

    .card {
        padding: 1rem;
    }
}

/* Classes utilitaires supplémentaires pour thème sombre */

/* Badge error (alias de danger) */
.badge-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    display: inline-block;
    font-size: 0.875rem;
}

/* Sidebar responsive */
@media (min-width: 768px) {
    .sidebar-visible {
        display: flex !important;
    }
}

/* Dropdown menu dark */
.dropdown-menu {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
}

.dropdown-menu a,
.dropdown-menu button {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--bg-tertiary);
}

/* Link accent */
.link-accent {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

.link-accent:hover {
    color: var(--accent-secondary);
}

/* ════════════════════════════════════════════════════════════
   NX VIEW SYSTEM — Sélecteur de vues fichiers
   ════════════════════════════════════════════════════════════ */

/* Boutons de vue */
.nx-view-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.nx-view-btn:hover,
.nx-view-btn.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
}

/* Vue icônes — grille carrée */
.nx-view-icons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.nx-view-icons .nx-icon-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 16px 8px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    user-select: none;
}

.nx-view-icons .nx-icon-item:hover,
.nx-view-icons .nx-icon-item.selected {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
}

.nx-view-icons .nx-icon-item.selected {
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.4);
}

.nx-icon-name {
    font-size: 0.75rem;
    color: var(--text-primary);
    word-break: break-all;
    line-height: 1.3;
    max-height: 2.6em;
    overflow: hidden;
}

/* Vue compacte — liste dense */
.nx-view-compact .nx-compact-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s;
    user-select: none;
}

.nx-view-compact .nx-compact-item:hover,
.nx-view-compact .nx-compact-item.selected {
    background: var(--bg-tertiary);
}

.nx-view-compact .nx-compact-item.selected {
    outline: 1px solid rgba(99, 102, 241, 0.5);
}

/* Vue détails — tableau triable */
.nx-view-details table thead th {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.nx-view-details table thead th:hover {
    color: var(--text-primary);
}

.nx-view-details table tbody tr {
    cursor: pointer;
}

.nx-view-details table tbody tr.selected {
    background: rgba(99, 102, 241, 0.12) !important;
    outline: 1px solid rgba(99, 102, 241, 0.4);
}

/* Vue compacte — séparateur poids / date */
.nx-compact-sep {
    color: rgba(148, 163, 184, 0.35);
    font-size: 0.7rem;
    margin: 0 2px;
    user-select: none;
}

/* Sélection éléments standard (vue default) */
.file-item.selected {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.1) !important;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.3);
}

/* ════════════════════════════════════════════════════════════
   NX UI SYSTEM — Composants propriétaires globaux
   ════════════════════════════════════════════════════════════ */

/* Utilitaire : masquer */
.nx-hidden {
    display: none !important;
}

/* ── Toasts ──────────────────────────────────────────────── */
@keyframes nxToastIn {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

@keyframes nxToastOut {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(110%); opacity: 0; }
}

.nx-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    pointer-events: auto;
    max-width: 340px;
    animation: nxToastIn 0.3s ease forwards;
}

.nx-toast.nx-toast-out {
    animation: nxToastOut 0.3s ease forwards;
}

.nx-toast-msg {
    flex: 1;
    line-height: 1.4;
}

.nx-toast-close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.75);
    padding: 2px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.15s;
}

.nx-toast-close:hover {
    color: #fff;
}

/* ── Modale ──────────────────────────────────────────────── */
.nx-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 999;
    animation: nxFadeIn 0.15s ease;
}

@keyframes nxFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes nxModalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);    }
}

.nx-modal-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 24rem;
    box-shadow: 0 0 60px rgba(99, 102, 241, 0.15);
    animation: nxModalIn 0.2s ease;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
}

.nx-modal-wide {
    max-width: 32rem;
}

/* ── Menu contextuel ─────────────────────────────────────── */
#nx-context-menu {
    position: fixed;
    min-width: 180px;
    padding: 4px 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
    z-index: 9999;
    animation: nxCtxIn 0.12s ease;
    font-family: 'Space Grotesk', sans-serif;
}

@keyframes nxCtxIn {
    from { opacity: 0; transform: scale(0.94); }
    to   { opacity: 1; transform: scale(1);    }
}

.nx-ctx-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 16px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: inherit;
    text-align: left;
    transition: background 0.12s ease;
    white-space: nowrap;
}

.nx-ctx-item:hover {
    background: rgba(51, 65, 85, 0.65);
}

.nx-ctx-icon {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.nx-ctx-sep {
    margin: 4px 0;
    border: none;
    border-top: 1px solid var(--border-color);
}

/* ════════════════════════════════════════════════════════════
   NX PREVIEW SYSTEM — Modale de prévisualisation universelle
   ════════════════════════════════════════════════════════════ */

/* ── Overlay principal ───────────────────────────────────── */
#nx-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: stretch;
    justify-content: center;
    animation: nxFadeIn 0.18s ease;
    outline: none;
}

.nx-pv-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 5, 10, 0.92);
    backdrop-filter: blur(6px);
}

.nx-pv-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    z-index: 1;
}

/* ── En-tête ─────────────────────────────────────────────── */
.nx-pv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(18, 18, 26, 0.98);
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
    flex-shrink: 0;
}

.nx-pv-title {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.nx-pv-filename {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 400px;
}

.nx-pv-size {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.nx-pv-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.nx-pv-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-family: 'Space Grotesk', sans-serif;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    text-decoration: none;
    white-space: nowrap;
}

.nx-pv-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
    border-color: rgba(99, 102, 241, 0.5);
}

.nx-pv-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.4);
}

/* ── Corps ───────────────────────────────────────────────── */
.nx-pv-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 0;
}

/* ── Chargement ──────────────────────────────────────────── */
.nx-pv-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    position: absolute;
    inset: 0;
    justify-content: center;
    background: transparent;
    z-index: 2;
}

.nx-pv-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: nxSpin 0.8s linear infinite;
}

@keyframes nxSpin {
    to { transform: rotate(360deg); }
}

/* ── Viewer : Image ──────────────────────────────────────── */
.nx-pv-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    user-select: none;
    background: repeating-conic-gradient(rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%) 0 0 / 20px 20px;
}

.nx-pv-image-wrapper:active {
    cursor: grabbing;
}

.nx-pv-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.05s ease;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

/* ── Viewer : PDF ────────────────────────────────────────── */
.nx-pv-pdf-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.nx-pv-pdf-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(18, 18, 26, 0.95);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    flex-wrap: wrap;
}

/* Zone de scroll pour toutes les pages PDF */
.nx-pv-pdf-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #1a1b26;
}

.nx-pv-pdf-page-wrap {
    position: relative;
    flex-shrink: 0;
}

.nx-pv-pdf-canvas {
    display: block;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
    max-width: 100%;
}

.nx-pv-pdf-page-label {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255,255,255,0.7);
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 4px;
    pointer-events: none;
}

/* ── PDF : couche texte (sélection de texte) ─────────────── */
.nx-pv-pdf-text-layer {
    position: absolute;
    top: 0; left: 0;
    overflow: hidden;
    line-height: 1;
    pointer-events: none;
    user-select: text;
    -webkit-user-select: text;
}
.nx-pv-pdf-text-layer span,
.nx-pv-pdf-text-layer br {
    color: transparent;
    position: absolute;
    white-space: pre;
    cursor: text;
    transform-origin: 0% 0%;
    pointer-events: all;
}
.nx-pv-pdf-text-layer ::selection {
    background: rgba(99, 102, 241, 0.35);
}

/* ── PDF : couche annotations (liens cliquables) ─────────── */
.nx-pv-pdf-annot-layer {
    position: absolute;
    top: 0; left: 0;
    overflow: hidden;
    pointer-events: none;
}
.nx-pv-pdf-annot-layer a {
    pointer-events: all;
    position: absolute;
    display: block;
    cursor: pointer;
    border-radius: 2px;
}
.nx-pv-pdf-annot-layer a:hover {
    background: rgba(99, 102, 241, 0.15);
    outline: 1px solid rgba(99, 102, 241, 0.4);
}

/* ── Viewer : Vidéo custom ───────────────────────────────── */
.nx-pv-video-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

/* Lecteur vidéo NX */
.nx-vp {
    position: relative;
    width: 100%;
    height: 100%;
    background: #000;
    user-select: none;
    overflow: hidden;
}

.nx-vp-screen {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.nx-vp-video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    /* Désactiver les contrôles natifs */
    pointer-events: none;
}

/* Overlay transparent pour intercepter les clics droits sur la vidéo */
.nx-vp-overlay {
    position: absolute;
    inset: 0;
    cursor: pointer;
    background: transparent;
}

/* Indicateur play/pause central (flash) */
.nx-vp-play-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transition: transform 0.15s ease, opacity 0.3s ease;
    opacity: 0;
}

.nx-vp-play-indicator.flash {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* Barre de contrôles — flottante (superposée à la vidéo) */
.nx-vp-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    padding: 32px 16px 12px;
    z-index: 4;
    opacity: 1;
    transition: opacity 0.35s ease, transform 0.35s ease;
    transform: translateY(0);
}

.nx-vp-controls.nx-vp-controls-hidden {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
}

/* Séparateur heure/minutes dans les durées vidéo */
.nx-vp-time-sep {
    opacity: 0.4;
    margin: 0 3px;
}

.nx-vp-timeline-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.nx-vp-timeline {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    transition: height 0.15s ease;
}

.nx-vp-timeline:hover {
    height: 6px;
}

.nx-vp-timeline-buf {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    pointer-events: none;
}

.nx-vp-timeline-prog {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    pointer-events: none;
}

.nx-vp-timeline-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    pointer-events: none;
    transition: transform 0.15s ease;
}

.nx-vp-timeline:hover .nx-vp-timeline-thumb {
    transform: translate(-50%, -50%) scale(1);
}

.nx-vp-time {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.nx-vp-btns {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nx-vp-left,
.nx-vp-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nx-vp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    transition: background 0.12s, color 0.12s;
    min-width: 32px;
}

.nx-vp-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.nx-vp-vol-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nx-vp-vol-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 70px;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    outline: none;
}

.nx-vp-vol-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

/* Fullscreen dans le lecteur */
.nx-vp:fullscreen {
    width: 100vw;
    height: 100vh;
}

/* ── Viewer : Audio custom ───────────────────────────────── */
.nx-pv-audio-wrap {
    width: 100%;
    max-width: 560px;
    padding: 20px;
}

.nx-ap {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px 24px 20px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.4);
}

.nx-ap-visual {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.nx-ap-icon {
    width: 72px;
    height: 72px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.nx-ap-info {
    min-width: 0;
}

.nx-ap-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nx-ap-ext {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
}

.nx-ap-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nx-ap-timeline-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.nx-ap-timeline {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.nx-ap-timeline:hover {
    height: 6px;
}

.nx-ap-dur {
    white-space: nowrap;
}

.nx-ap-prog {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
    pointer-events: none;
}

.nx-ap-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-primary);
    pointer-events: none;
}

.nx-ap-btns {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* ── Viewer : Code/Texte ─────────────────────────────────── */
.nx-pv-code-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.nx-pv-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
    background: #1a1b26;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.nx-pv-code-lang {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nx-pv-code-editor {
    flex: 1;
    display: flex;
    overflow: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    background: #1a1b26;
}

.nx-pv-line-numbers {
    padding: 16px 12px 16px 16px;
    background: #13131e;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.25);
    text-align: right;
    user-select: none;
    flex-shrink: 0;
    margin: 0;
    height: max-content;
}

.nx-pv-line-numbers code {
    background: none;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.nx-pv-code-content {
    flex: 1;
    padding: 16px;
    margin: 0;
    overflow: visible;
    white-space: pre;
    background: transparent !important;
}

.nx-pv-code-content code {
    background: none !important;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

/* ── Viewer : Non supporté / Erreur ─────────────────────── */
.nx-pv-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    text-align: center;
    padding: 40px 20px;
}

.nx-pv-unsupported h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.nx-pv-unsupported p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.nx-pv-dl-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: opacity 0.2s;
}

.nx-pv-dl-btn:hover {
    opacity: 0.85;
}

/* ════════════════════════════════════════════════════════════
   PAGE STREAMING VIDÉO — public/stream.php
   ════════════════════════════════════════════════════════════ */

.nx-stream-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #000;
}

.nx-stream-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: rgba(10, 10, 15, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: 12px;
    z-index: 10;
}

.nx-stream-meta {
    min-width: 0;
}

.nx-stream-title {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
}

.nx-stream-sub {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.nx-stream-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.nx-stream-player-wrap {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* Panneau embed */
.nx-stream-embed-panel {
    background: rgba(18, 18, 26, 0.97);
    border-top: 1px solid var(--border-color);
    padding: 16px 20px;
    flex-shrink: 0;
}

.nx-stream-embed-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.nx-stream-embed-code {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.nx-stream-embed-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    outline: none;
    cursor: text;
}

/* ════════════════════════════════════════════════════════════
   PAGE EMBED — public/embed.php
   ════════════════════════════════════════════════════════════ */

.nx-embed-page {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #000;
    display: flex;
    flex-direction: column;
}

.nx-embed-player {
    flex: 1;
    min-height: 0;
}

/* ════════════════════════════════════════════════════════════
   TRANSFER MANAGER — panneau unifié upload + download
   ════════════════════════════════════════════════════════════ */

#nx-transfer-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 11000;
    min-width: 320px;
    max-width: 400px;
    background: rgba(18, 18, 26, 0.97);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

#nx-transfer-panel.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

#nx-transfer-panel.done {
    opacity: 0;
    transform: translateY(16px);
}

.nx-tp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 8px;
    border-bottom: 1px solid var(--border-color);
}

.nx-tp-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nx-tp-entry {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
}

.nx-tp-entry:last-child {
    border-bottom: none;
}

.nx-tp-entry.done {
    opacity: 0.4;
    transition: opacity 0.4s ease;
}

.nx-tp-entry.error .nx-tp-bar-fill {
    background: var(--danger);
}

.nx-tp-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.nx-tp-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.nx-tp-icon.up svg { color: var(--accent-primary); }
.nx-tp-icon.dl svg { color: #22c55e; }

.nx-tp-name {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.nx-tp-pct {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.nx-tp-bar-wrap {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.nx-tp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    border-radius: 2px;
    transition: width 0.2s ease;
}

.nx-tp-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

/* ════════════════════════════════════════════════════════════
   VIEWER : OFFICE (Word / Excel)
   ════════════════════════════════════════════════════════════ */

.nx-pv-office-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.nx-pv-office-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 16px;
    background: rgba(18, 18, 26, 0.95);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.nx-pv-office-body {
    flex: 1;
    overflow: auto;
    padding: 24px;
    background: #fff;
    color: #111;
}

/* Fond gris simulant un lecteur de document paginé */
.nx-pv-word-pages {
    flex: 1;
    overflow-y: auto;
    background: #d0d0d0;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
}

/* Page A4 blanche avec ombre */
.nx-pv-word-page {
    background: #fff;
    color: #1a1a1a;
    width: 100%;
    max-width: 740px;
    padding: 80px 88px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.22);
    border-radius: 2px;
    position: relative;
    min-height: 400px;
}

/* Numéro de page en bas */
.nx-pv-word-page-num {
    text-align: center;
    font-size: 0.72rem;
    color: #999;
    margin-top: 40px;
    padding-top: 8px;
    border-top: 1px solid #e0e0e0;
}

/* Contenu Word converti par mammoth */
.nx-pv-word-page-content {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: 0.95rem;
    line-height: 1.75;
    color: #1a1a1a;
}
.nx-pv-word-page-content h1 { font-size: 1.6rem; margin: 0 0 0.6em; font-weight: 700; }
.nx-pv-word-page-content h2 { font-size: 1.3rem; margin: 1em 0 0.5em; font-weight: 700; }
.nx-pv-word-page-content h3 { font-size: 1.1rem; margin: 0.8em 0 0.4em; font-weight: 600; }
.nx-pv-word-page-content p  { margin: 0.5em 0; }
.nx-pv-word-page-content ul,.nx-pv-word-page-content ol { margin: 0.5em 0; padding-left: 1.5em; }
.nx-pv-word-page-content table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.nx-pv-word-page-content td,.nx-pv-word-page-content th { border: 1px solid #bbb; padding: 6px 10px; vertical-align: top; }
.nx-pv-word-page-content th { background: #f5f5f5; font-weight: 600; }
.nx-pv-word-page-content img { max-width: 100%; height: auto; display: block; margin: 0.5em auto; }
.nx-pv-word-page-content strong { font-weight: 700; }
.nx-pv-word-page-content em { font-style: italic; }

/* Viewer EPUB */
.nx-pv-epub-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}
.nx-pv-epub-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}
.nx-pv-epub-viewer {
    flex: 1;
    min-height: 0;
    background: #fff;
}
.nx-pv-epub-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

/* Onglets feuilles Excel */
.nx-pv-sheet-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}

.nx-pv-sheet-tab {
    padding: 3px 10px !important;
    font-size: 0.78rem !important;
    border-radius: 4px !important;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.nx-pv-sheet-tab.active {
    opacity: 1;
    background: rgba(99, 102, 241, 0.2) !important;
    border-color: var(--accent-primary) !important;
}

.nx-pv-sheet-body {
    overflow: auto;
    padding: 0 !important;
}

.nx-pv-sheet-table-wrap {
    overflow: auto;
    min-height: 100%;
    padding: 12px;
}

.nx-pv-sheet-table {
    border-collapse: collapse;
    font-size: 0.82rem;
    white-space: nowrap;
    background: #fff;
    color: #111;
}

.nx-pv-sheet-table td,
.nx-pv-sheet-table th {
    border: 1px solid #d1d5db;
    padding: 4px 10px;
    min-width: 80px;
}

.nx-pv-sheet-table th {
    background: #f3f4f6;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* ════════════════════════════════════════════════════════════
   VIEWER : ARCHIVES
   ════════════════════════════════════════════════════════════ */

.nx-pv-archive-body {
    flex: 1;
    overflow: auto;
    padding: 12px 8px;
    background: var(--bg-primary);
}

.nx-pv-archive-tree {
    font-size: 0.83rem;
    user-select: none;
}

.nx-pv-arch-dir {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 5px;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.12s;
}

.nx-pv-arch-dir:hover {
    background: rgba(255,255,255,0.06);
}

.nx-pv-arch-toggle {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.15s;
}

.nx-pv-arch-toggle.open {
    transform: rotate(90deg);
}

.nx-pv-arch-children {
    border-left: 1px solid var(--border-color);
    margin-left: 14px;
}

.nx-pv-arch-children.hidden {
    display: none;
}

.nx-pv-arch-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: background 0.12s;
}

.nx-pv-arch-file:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary);
}

.nx-pv-arch-filename {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nx-pv-arch-meta {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 8px;
}

.nx-pv-arch-count {
    font-size: 0.72rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    padding: 1px 5px;
    flex-shrink: 0;
    margin-left: auto;
}
