/* ================================================
   AU DELA DE LA PORTE DU TRUMAN SHOW - Styles CSS
   Fusion Mediatheque + Video Downloader
   ================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    /* Couleurs principales */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --accent: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Texte */
    --text: #1e293b;
    --text-light: #64748b;
    --text-muted: #9ca3af;

    /* Arriere-plans */
    --bg: #f1f5f9;
    --card: #ffffff;
    --border: #e2e8f0;

    /* Sidebar */
    --sidebar-bg: #1e293b;
    --sidebar-text: #e2e8f0;

    /* Types de fichiers */
    --video: #ef4444;
    --image: #22c55e;
    --audio: #f59e0b;
    --document: #3b82f6;

    /* Categories mots-cles */
    --personne: #8b5cf6;
    --lieu: #10b981;
    --date: #f59e0b;
    --theme: #ef4444;
    --organisation: #ec4899;
    --evenement: #14b8a6;
    --concept: #6366f1;
    --media: #f97316;
    --politique: #dc2626;
    --sante: #22c55e;
    --autre: #64748b;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

/* ================================================
   SIDEBAR PRINCIPALE (Navigation onglets)
   ================================================ */
.main-sidebar {
    width: 200px;
    min-width: 200px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
}

.main-sidebar-header {
    padding: 1rem;
    text-align: center;
    background: #0f172a;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.main-sidebar-header h1 {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f9fafb;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

.main-sidebar-header p {
    font-size: 0.65rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.sidebar-thumbnail {
    width: 80%;
    max-width: 160px;
    margin-top: 0.75rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
}

/* Onglets principaux */
.main-tabs {
    padding: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.main-tab {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: 0.5rem;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.main-tab:hover {
    background: rgba(255,255,255,0.08);
    color: #e5e7eb;
}

.main-tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

.main-tab span.tab-icon {
    font-size: 1.1rem;
}

/* Icone d'aide */
.help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    margin-left: auto;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.2s;
}

.help-icon:hover {
    background: rgba(255,255,255,0.3);
    color: #fff;
    transform: scale(1.1);
}

.main-tab.active .help-icon {
    background: rgba(255,255,255,0.25);
    color: rgba(255,255,255,0.9);
}

.main-tab.active .help-icon:hover {
    background: rgba(255,255,255,0.4);
    color: #fff;
}

/* Sous-navigation */
.sub-nav {
    flex: 1;
    padding: 0.5rem;
    overflow-y: auto;
}

.sub-nav-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light);
    margin: 0.75rem 0.5rem 0.5rem;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.15rem;
    border-radius: 0.4rem;
    cursor: pointer;
    color: #9ca3af;
    font-size: 0.8rem;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #e5e7eb;
}

.nav-item.active {
    background: rgba(255,255,255,0.1);
    border-left-color: var(--primary);
    color: #f9fafb;
    font-weight: 500;
}

.nav-item span.nav-icon {
    font-size: 0.95rem;
    opacity: 0.8;
}

/* Bouton scan dans sidebar */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.75rem;
    margin-top: 0.5rem;
    border-radius: 0.4rem;
    border: 1px dashed rgba(255,255,255,0.2);
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: var(--primary);
    color: #c7d2fe;
}

.nav-btn .nav-icon {
    font-size: 1rem;
}

/* Footer sidebar */
.main-sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.main-sidebar-footer button {
    width: 100%;
    padding: 0.5rem;
    background: #374151;
    border: 1px solid #4b5563;
    border-radius: 0.4rem;
    color: #9ca3af;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.main-sidebar-footer button:hover {
    background: #4b5563;
    color: #e5e7eb;
}

/* ================================================
   CONTENU PRINCIPAL
   ================================================ */
.main-content {
    flex: 1;
    margin-left: 200px;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* Header sticky */
.main-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.main-header-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-header-title span {
    font-size: 1.1rem;
    opacity: 0.7;
}

.main-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Zone de contenu */
.content-area {
    flex: 1;
    padding: 0 1.5rem 1rem 1.5rem;
}

/* Panneaux */
.panel {
    display: none;
    animation: fadeIn 0.2s ease;
}

.panel.active {
    display: block;
}

/* Zone sticky pour les filtres - collee en haut */
.sticky-filters {
    position: sticky;
    top: 0;
    z-index: 40;
    background: var(--bg);
    margin: 0 -1.5rem 0.75rem -1.5rem;
    padding: 1rem 1.5rem 0.5rem 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sticky-filters .card {
    margin-bottom: 0.5rem;
}

.sticky-filters .card:last-child {
    margin-bottom: 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================================
   COMPOSANTS COMMUNS
   ================================================ */

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.card-title span {
    font-size: 1rem;
    opacity: 0.6;
}

/* Icone refresh dans card-title */
.refresh-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-right: 0.25rem;
    border-radius: 0.3rem;
    background: transparent;
    color: var(--text-light);
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.refresh-icon:hover {
    color: var(--primary);
    transform: rotate(180deg);
}

/* Boutons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

.btn-success {
    background: var(--accent);
    color: #fff;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--text);
}

.btn-secondary:hover {
    background: #d1d5db;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: var(--warning);
    color: #fff;
}

.btn-warning:hover {
    background: #d97706;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Boutons de reparation video */
.btn-repair {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-repair:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-repair-small {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 500;
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.btn-repair-small:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.btn-repair-small:disabled,
.btn-repair:disabled {
    opacity: 0.6;
    cursor: wait;
}

/* Panel d'erreur video */
.video-error-panel {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--danger);
    border-radius: 0.5rem;
    padding: 1.5rem;
    text-align: center;
    margin-top: 1rem;
}

.video-error-panel p {
    color: var(--danger);
    font-size: 1rem;
    margin-bottom: 1rem;
}

/* Popup nettoyage caracteres speciaux */
.cleanup-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.cleanup-popup {
    background: var(--card);
    border-radius: 1rem;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.cleanup-popup h3 {
    color: var(--warning);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cleanup-popup p {
    color: var(--text);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.cleanup-popup p strong {
    color: var(--primary);
    word-break: break-all;
}

.cleanup-popup-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.cleanup-popup-buttons .btn {
    flex: 1;
    min-width: 140px;
    padding: 0.75rem 1rem;
    font-weight: 600;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

/* Formulaires */
.form-group {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-group label {
    flex-shrink: 0;
    min-width: 80px;
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.form-group input,
.form-group select {
    flex: 1;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    align-items: center;
}

input[type="text"],
input[type="url"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    color: var(--text);
    font-size: 0.85rem;
    transition: all 0.15s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

input::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
}

.toast {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    padding: 0.6rem 1rem;
    margin-top: 0.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: slideIn 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.toast.success {
    border-left: 4px solid var(--accent);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ================================================
   MEDIATHEQUE - Styles specifiques
   ================================================ */

/* Sidebar secondaire Mediatheque */
.mediatheque-sidebar {
    display: none;
    width: 280px;
    background: var(--sidebar-bg);
    padding: 1rem;
    position: fixed;
    left: 200px;
    top: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 90;
    border-right: 1px solid rgba(255,255,255,0.1);
}

.mediatheque-sidebar.active {
    display: block;
}

.mediatheque-content {
    margin-left: 0;
    transition: margin-left 0.3s;
}

.mediatheque-content.with-sidebar {
    margin-left: 280px;
}

/* Recherche sidebar */
.sidebar-search {
    position: relative;
    margin-bottom: 1rem;
}

.sidebar-search input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.5rem;
    color: white;
    font-size: 0.9rem;
}

.sidebar-search input:focus {
    background: rgba(255,255,255,0.15);
    border-color: var(--primary);
}

.sidebar-search input::placeholder {
    color: rgba(255,255,255,0.5);
}

/* Card compact (collapsible) */
.card-compact {
    padding: 0.5rem 1rem;
}

.card-title-toggle {
    cursor: pointer;
    user-select: none;
    margin-bottom: 0;
}

.card-title-toggle:hover {
    color: var(--primary);
}

.toggle-icon {
    font-size: 0.65rem;
    transition: transform 0.2s;
    margin-right: 0.3rem;
}

/* Stats sidebar */
.sidebar-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
}

.sidebar-stats-compact {
    max-height: 60px;
    margin-top: 0.5rem;
}

.sidebar-stats.collapsed {
    max-height: 0;
    opacity: 0;
    margin: 0;
}

.sidebar-stat {
    background: var(--bg);
    border-radius: 0.35rem;
    padding: 0.35rem 0.25rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.sidebar-stat:hover {
    background: #e2e8f0;
}

.sidebar-stat.active {
    border-color: var(--primary);
    background: #ede9fe;
}

.sidebar-stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar-stat-value.video { color: var(--video); }
.sidebar-stat-value.image { color: var(--image); }
.sidebar-stat-value.audio { color: var(--audio); }
.sidebar-stat-value.document { color: var(--document); }
.sidebar-stat-value.total { color: var(--primary); }

.sidebar-stat-label {
    font-size: 0.55rem;
    color: var(--text-light);
    text-transform: uppercase;
}

/* Grille fichiers */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.files-grid.images-mode {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
}

/* Mode tri par repertoire - Colonne unique */
.folders-single-column {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    grid-column: 1 / -1;
}

.folder-section {
    margin: 0;
    width: 100%;
}

.folder-header {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: 0.4rem;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 10;
}

.folder-header:hover {
    background: var(--bg);
    border-color: var(--primary);
}

.folder-header .folder-chevron {
    color: var(--text-light);
    transition: transform 0.3s;
    font-size: 0.6rem;
}

.folder-header.collapsed .folder-chevron {
    transform: rotate(-90deg);
}

.folder-header .folder-icon {
    font-size: 0.9rem;
}

.folder-header .folder-path {
    flex: 1;
    color: var(--text-light);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.7rem;
}

.folder-header .folder-count {
    background: var(--bg);
    color: var(--text-light);
    padding: 0.15rem 0.4rem;
    border-radius: 1rem;
    font-size: 0.6rem;
    font-weight: 600;
}

.folder-content {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-top: 0.4rem;
    padding-left: 0.4rem;
    border-left: 2px solid var(--border);
    margin-left: 0.4rem;
}

.folder-content.collapsed {
    display: none;
}

/* Carte fichier mini (pour mode repertoire) */
.file-card-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.file-card-mini:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.file-card-mini .file-icon {
    font-size: 1rem;
}

.file-card-mini .file-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-mini .file-type-badge {
    font-size: 0.6rem;
    padding: 0.1rem 0.3rem;
}

/* Image card small (pour mode repertoire images) */
.image-card-small {
    width: 60px;
    height: 60px;
    display: inline-block;
    margin: 2px;
    cursor: pointer;
    border-radius: 0.25rem;
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.image-card-small:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.image-card-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bouton tout ouvrir/fermer */
.btn-toggle-all {
    background: rgba(99,102,241,0.1);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.3rem 0.6rem;
    border-radius: 0.35rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 0.5rem;
}

.btn-toggle-all:hover {
    background: var(--primary);
    color: white;
}


/* Grille mots-cles par categorie */
.keywords-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.keyword-group {
    background: var(--bg);
    border-radius: 0.75rem;
    padding: 1rem;
}

.keyword-group-title {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: 0.25rem;
    display: inline-block;
    color: white;
    text-transform: uppercase;
}

.keyword-group-title.personne { background: var(--personne); }
.keyword-group-title.lieu { background: var(--lieu); }
.keyword-group-title.date { background: var(--date); }
.keyword-group-title.theme { background: var(--theme); }
.keyword-group-title.organisation { background: var(--organisation); }
.keyword-group-title.evenement { background: var(--evenement); }
.keyword-group-title.concept { background: var(--concept); }
.keyword-group-title.media { background: var(--media); }
.keyword-group-title.politique { background: var(--politique); }
.keyword-group-title.sante { background: var(--sante); }
.keyword-group-title.autre { background: var(--autre); }

.keyword-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.keyword-chip {
    padding: 0.3rem 0.6rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.3rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.keyword-chip:hover {
    border-color: var(--primary);
    background: #ede9fe;
    transform: translateY(-1px);
}

/* Carte fichier */
.file-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.file-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.file-card-header {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.file-icon {
    font-size: 1.75rem;
}

.file-type-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: white;
}

.file-type-badge.video { background: linear-gradient(135deg, var(--video), #dc2626); }
.file-type-badge.image { background: linear-gradient(135deg, var(--image), #16a34a); }
.file-type-badge.audio { background: linear-gradient(135deg, var(--audio), #d97706); }
.file-type-badge.document { background: linear-gradient(135deg, var(--document), #2563eb); }

.file-ext {
    font-size: 0.7rem;
    color: var(--text-light);
    margin-left: auto;
    font-weight: 500;
    background: var(--card);
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
}

.file-card-body {
    padding: 1rem;
}

.file-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text);
}

.file-keywords {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.file-keyword {
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.65rem;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
}

.file-keyword:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

.file-keyword.personne { background: var(--personne); }
.file-keyword.lieu { background: var(--lieu); }
.file-keyword.date { background: var(--date); }
.file-keyword.theme { background: var(--theme); }
.file-keyword.organisation { background: var(--organisation); }
.file-keyword.evenement { background: var(--evenement); }
.file-keyword.concept { background: var(--concept); }
.file-keyword.media { background: var(--media); }
.file-keyword.politique { background: var(--politique); }
.file-keyword.sante { background: var(--sante); }
.file-keyword.autre { background: var(--autre); }

/* Carte image miniature */
.image-card {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 0.5rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}

.image-card:hover {
    border-color: var(--image);
    transform: scale(1.02);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.image-card-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: var(--bg);
    display: block;
}

.image-card-info {
    padding: 0.5rem;
    background: var(--card);
}

.image-card-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================
   TELECHARGEMENT - Styles specifiques
   ================================================ */

/* URL Input */
.url-input-container {
    position: relative;
}

.url-input {
    padding-right: 90px !important;
}

.url-detect {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* Video preview */
.video-preview {
    display: none;
    background: #f9fafb;
    border-radius: 0.4rem;
    padding: 0.75rem;
    margin-top: 0.75rem;
    border: 1px solid var(--border);
}

.video-preview.visible,
.video-preview.active {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.video-preview img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 0.35rem;
}

.video-preview-info {
    flex: 1;
    min-width: 150px;
}

.video-preview-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.85rem;
    line-height: 1.3;
    color: var(--text);
}

.video-preview-meta {
    font-size: 0.75rem;
    color: var(--text-light);
}

.platform-badge {
    display: inline-flex;
    padding: 0.2rem 0.6rem;
    border-radius: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    background: #e5e7eb;
    color: #374151;
}

.platform-badge.youtube { background: #fecaca; color: #991b1b; }
.platform-badge.twitter { background: #dbeafe; color: #1e40af; }

/* Downloads list */
.downloads-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.download-item {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.download-item.status-error {
    background: #fef2f2;
    border-color: #fecaca;
}

.download-item.status-downloading,
.download-item.status-pending {
    background: #f0fdf4;
    border-color: #86efac;
}

.download-item.status-success {
    background: #f0fdf4;
    border-color: #86efac;
}

.download-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.download-url {
    flex: 1;
    font-size: 0.8rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-status-line {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
}

.download-status-icon {
    color: var(--accent);
}

.download-status-text {
    color: var(--text-light);
}

.download-status-text.status-success {
    color: var(--accent);
    font-weight: 600;
}

.download-status-text.status-error {
    color: var(--danger);
    font-weight: 600;
}

/* Progress bar amelioree */
.download-progress-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.download-progress-bar {
    flex: 1;
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.download-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444 0%, #ef4444 100%);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.download-progress-fill.completed {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

.download-progress-percent {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    min-width: 45px;
    text-align: right;
}

.download-filename {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 0.2rem;
}

.download-error {
    font-size: 0.75rem;
    color: var(--danger);
    margin-top: 0.2rem;
}

/* Old styles kept for compatibility */
.download-icon {
    font-size: 1.2rem;
    opacity: 0.7;
}

.download-thumb {
    width: 70px;
    height: 45px;
    object-fit: cover;
    border-radius: 0.3rem;
    flex-shrink: 0;
}

.download-info {
    flex: 1;
    min-width: 0;
}

.download-title {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-status {
    font-size: 0.75rem;
    color: var(--text-light);
}

.download-status.completed {
    color: var(--accent);
    font-weight: 600;
}

.download-status.error {
    color: var(--danger);
    font-weight: 600;
}

/* Progress bar (old) */
.progress-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
}

.btn-cancel {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: #fecaca;
    color: var(--danger);
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: var(--danger);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-cancel:hover {
    background: var(--danger);
    color: white;
}

/* Scan results */
.scan-results {
    max-height: 450px;
    overflow-y: auto;
}

.scan-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.4rem;
    border: 1px solid transparent;
    margin-bottom: 0.35rem;
}

.scan-item:hover {
    background: #f9fafb;
    border-color: var(--border);
}

.scan-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin-top: 0.3rem;
}

.scan-item-thumb {
    width: 90px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 0.3rem;
    overflow: hidden;
    background: #e5e7eb;
}

.scan-item-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-item-content {
    flex: 1;
    min-width: 0;
}

.scan-item-title {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: 0.3rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.scan-item-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* History list */
.history-list {
    max-height: 550px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    margin-bottom: 0.5rem;
    background: #fafafa;
    transition: all 0.15s;
}

.history-item:hover {
    background: var(--card);
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.history-thumb {
    width: 100px;
    height: 56px;
    flex-shrink: 0;
    border-radius: 0.35rem;
    overflow: hidden;
    background: #e5e7eb;
}

.history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.history-content {
    flex: 1;
    min-width: 0;
}

.history-title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.3rem;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.history-actions button {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.3rem;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    transition: all 0.15s;
}

.history-actions button:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* File Manager */
.file-manager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: calc(100vh - 160px);
}

.file-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-panel-header {
    padding: 0.75rem 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.file-panel-title {
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

.file-grid {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.file-item {
    background: #f9fafb;
    border: 1px solid var(--border);
    border-radius: 0.35rem;
    padding: 0.4rem 0.6rem;
    cursor: grab;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-item:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.file-item.selected {
    border-color: var(--primary);
    background: #ede9fe;
}

.file-item-icon {
    font-size: 1.1rem;
    opacity: 0.7;
    flex-shrink: 0;
}

.file-item-name {
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    cursor: text;
}

.file-item-name:hover {
    background: rgba(99, 102, 241, 0.1);
    border-radius: 3px;
}

/* Input edition nom de fichier */
.filename-edit-input {
    width: 100%;
    min-width: 200px;
    font-size: 0.85rem;
    font-family: inherit;
    padding: 6px 10px;
    border: 2px solid var(--primary);
    border-radius: 4px;
    background: white;
    color: #1e293b;
    outline: none;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.25);
    position: relative;
    z-index: 10;
}

.filename-edit-input:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.35);
}

/* Agrandir le conteneur du nom pendant l'edition */
.file-item-name:has(.filename-edit-input) {
    overflow: visible;
    flex: 2;
    min-width: 250px;
}

.file-item-size {
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* File item states for drag & drop */
.file-item.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.file-item.folder-item {
    cursor: pointer;
}

.file-item.folder-item:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}

.file-item.video-playable {
    cursor: pointer;
}

.file-item.video-playable:hover {
    background: #ede9fe;
    border-color: #8b5cf6;
}

/* File icons colored */
.file-item-icon.video {
    position: relative;
    width: 22px;
    height: 16px;
    background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
}

.file-item-icon.video::before {
    content: '';
    width: 0;
    height: 0;
    border-left: 5px solid #fff;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
    margin-left: 1px;
}

.file-item-icon.audio { color: #059669; }
.file-item-icon.image { color: #0891b2; }
.file-item-icon.folder { color: #d97706; }

/* Drop zone destination */
.file-grid-dest {
    position: relative;
    min-height: 200px;
}

.file-grid-dest.drag-over {
    background: rgba(34, 197, 94, 0.08);
    border: 2px dashed var(--accent);
    border-radius: 0.35rem;
}

.drop-zone-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    text-align: center;
}

.drop-zone-icon {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 0.5rem;
}

.drop-zone-hint p {
    font-size: 0.85rem;
    margin: 0.2rem 0;
}

.drop-zone-sub {
    font-size: 0.75rem;
    opacity: 0.7;
}

/* Destination path display */
.dest-path-display {
    padding: 0.5rem 0.75rem;
    background: #f3f4f6;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-light);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.dest-path-display:hover {
    background: #e5e7eb;
    color: var(--primary);
}

.dest-path-display.copied {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent);
}

.dest-path-text {
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Selected count badge */
.selected-count {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-right: 0.4rem;
    font-weight: 500;
}

/* Logs */
.logs-container {
    background: #1e293b;
    border-radius: 0.4rem;
    padding: 0.75rem;
    max-height: 450px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.75rem;
}

.log-entry {
    padding: 0.3rem 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.2rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.log-entry.INFO { background: rgba(255,255,255,0.03); color: #9ca3af; }
.log-entry.SUCCESS { background: rgba(34,197,94,0.15); color: #6ee7b7; }
.log-entry.ERROR { background: rgba(239,68,68,0.15); color: #fca5a5; }
.log-entry.DOWNLOAD { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.log-entry.WARNING { background: rgba(245,158,11,0.15); color: #fcd34d; }

/* ================================================
   MODALES
   ================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--card);
    border-radius: 1rem;
    width: 100%;
    max-width: 950px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    word-break: break-word;
    flex: 1;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--card);
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
}

.modal video,
.modal img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 0.5rem;
    display: block;
    margin: 0 auto;
}

.modal audio {
    width: 100%;
    margin-top: 1rem;
}

.modal-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.modal-info p {
    margin-bottom: 0.4rem;
    color: var(--text-light);
}

.modal-info strong {
    color: var(--primary);
}

/* Chemin de fichier cliquable pour copier */
.file-path-copy {
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    background: rgba(99, 102, 241, 0.1);
    transition: all 0.2s ease;
    user-select: all;
    word-break: break-all;
}

.file-path-copy:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
}

.file-path-copy.copied {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent);
    animation: copyFlash 0.3s ease;
}

@keyframes copyFlash {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ================================================
   RESPONSIVE
   ================================================ */
@media (max-width: 1024px) {
    .main-sidebar {
        width: 60px;
        min-width: 60px;
    }

    .main-sidebar-header h1,
    .main-sidebar-header p,
    .main-tab span:last-child,
    .nav-item span:last-child,
    .sub-nav-title {
        display: none;
    }

    .main-tab,
    .nav-item {
        justify-content: center;
        padding: 0.75rem;
    }

    .main-content {
        margin-left: 60px;
    }

    .mediatheque-sidebar {
        left: 60px;
        width: 250px;
    }
}

@media (max-width: 768px) {
    .main-sidebar {
        width: 50px;
        min-width: 50px;
    }

    .main-content {
        margin-left: 50px;
    }

    .file-manager {
        grid-template-columns: 1fr;
        height: auto;
    }

    .files-grid {
        grid-template-columns: 1fr;
    }

    .mediatheque-sidebar {
        display: none !important;
    }

    .mediatheque-content.with-sidebar {
        margin-left: 0;
    }
}

/* ================================================
   MODAL AIDE - STYLES
   ================================================ */
.help-modal {
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
}

.help-content {
    padding: 20px;
}

.help-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.help-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.help-section h4 {
    color: #2563eb;
    font-size: 1.1em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.help-section p {
    color: #495057;
    line-height: 1.6;
    margin-bottom: 8px;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.help-item {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    padding: 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.help-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.help-item .help-icon {
    font-size: 1.8em;
}

.help-item span:not(.help-icon) {
    font-weight: 600;
    color: #343a40;
}

.help-item small {
    font-size: 0.75em;
    color: #6c757d;
}

.help-tip {
    background: linear-gradient(135deg, #e7f3ff 0%, #dbeafe 100%);
    border-left: 4px solid #2563eb;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin-top: 12px;
    color: #1e40af;
    font-size: 0.9em;
}

kbd {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 0.85em;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* ================================================
   MODALE RENOMMAGE FICHIERS
   ================================================ */
.rename-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.rename-modal {
    background: var(--card);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 700px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    overflow: hidden;
}

.rename-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.rename-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rename-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.rename-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.rename-modal-body {
    padding: 1.25rem;
}

.rename-options {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.rename-checkbox {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
}

.rename-checkbox:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.rename-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.rename-checkbox span {
    font-size: 0.85rem;
    color: var(--text);
}

.rename-checkbox code {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
    font-weight: 600;
}

.rename-current {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 0.4rem;
}

.rename-current label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--warning);
    font-weight: 600;
    display: block;
    margin-bottom: 0.35rem;
}

.rename-current-text {
    font-size: 0.85rem;
    color: var(--text);
    word-break: break-all;
    font-family: 'Consolas', 'Monaco', monospace;
}

.rename-preview {
    padding: 0.75rem;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 0.4rem;
}

.rename-preview label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
    display: block;
    margin-bottom: 0.35rem;
}

.rename-preview-text {
    font-size: 0.85rem;
    color: var(--text);
    word-break: break-all;
    font-family: 'Consolas', 'Monaco', monospace;
    font-weight: 500;
}

.rename-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.rename-modal-footer .btn {
    min-width: 100px;
    justify-content: center;
}

.rename-input-group {
    margin-bottom: 1.25rem;
}

.rename-input-group label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.rename-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 0.4rem;
    overflow: hidden;
    transition: border-color 0.2s;
}

.rename-input-wrapper:focus-within {
    border-color: var(--primary);
}

.rename-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    font-family: 'Consolas', 'Monaco', monospace;
}

.rename-extension {
    padding: 0.75rem 1rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    font-family: 'Consolas', 'Monaco', monospace;
    border-left: 1px solid var(--border);
}

/* Section video dans modale renommage */
.rename-video-section {
    margin-bottom: 1.25rem;
}

.rename-video-section .btn-info {
    background: linear-gradient(135deg, #0ea5e9, #06b6d4);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 0.4rem;
    cursor: pointer;
    transition: all 0.2s;
}

.rename-video-section .btn-info:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.rename-video-container {
    margin-top: 0.75rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background: #000;
}

.rename-video-container video {
    width: 100%;
    max-height: 300px;
    display: block;
}

.rename-modal.has-video {
    max-width: 800px;
}

/* ================================================
   BOUTONS ACTIONS FICHIER (RENOMMER / SUPPRIMER)
   ================================================ */
.file-item-rename,
.file-item-delete {
    background: none;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 1rem;
    opacity: 0;
    transition: all 0.2s;
    border-radius: 0.25rem;
}

.file-item-delete {
    margin-left: auto;
}

.file-item:hover .file-item-rename,
.file-item:hover .file-item-delete {
    opacity: 0.6;
}

.file-item-rename:hover {
    opacity: 1 !important;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.file-item-delete:hover {
    opacity: 1 !important;
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
}

/* Modale confirmation suppression */
.delete-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease;
}

.delete-modal {
    background: var(--card);
    border-radius: 0.75rem;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: slideUp 0.3s ease;
    overflow: hidden;
    border: 2px solid var(--danger);
}

.delete-modal-header {
    padding: 1rem 1.25rem;
    background: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.delete-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--danger);
    margin: 0;
}

.delete-modal-body {
    padding: 1.25rem;
    text-align: center;
}

.delete-modal-body p {
    margin: 0 0 0.75rem 0;
    color: var(--text);
}

.delete-filename {
    background: var(--bg);
    padding: 0.75rem 1rem;
    border-radius: 0.4rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    color: var(--text);
    word-break: break-all;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border);
}

.delete-warning {
    color: var(--danger) !important;
    font-size: 0.85rem;
    font-weight: 500;
}

.delete-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(-20px); }
}

/* ================================================
   VIDEO MODAL - Lecteur Video
   ================================================ */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.video-modal.visible {
    display: flex;
}

.video-modal-content {
    background: var(--card);
    border-radius: 1rem;
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}

.video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.video-modal-title {
    font-size: 1rem;
    font-weight: 600;
    word-break: break-word;
    flex: 1;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 1rem;
}

.video-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-light);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.video-modal-close:hover {
    background: var(--card);
    color: var(--danger);
}

.video-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 80px);
    background: #000;
}

.video-modal-body video {
    max-width: 100%;
    max-height: 70vh;
    display: block;
    margin: 0 auto;
    border-radius: 0.5rem;
}

.video-modal-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.video-modal-info p {
    margin-bottom: 0.4rem;
    color: var(--text-light);
}

.video-modal-info strong {
    color: var(--primary);
}

/* ================================================
   DESTINATION FOLDER - COMPACT LIST
   ================================================ */
.dest-file-item-compact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border-bottom: 1px solid var(--border);
    cursor: default;
    transition: background 0.15s;
}

.dest-file-item-compact:hover {
    background: rgba(99, 102, 241, 0.08);
}

.dest-file-item-compact.is-folder {
    cursor: pointer;
    font-weight: 500;
}

.dest-file-item-compact.is-folder:hover {
    background: rgba(217, 119, 6, 0.1);
}

.dest-file-item-compact .dest-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
}

.dest-file-item-compact .dest-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.dest-file-item-compact .dest-size {
    color: var(--text-muted);
    font-size: 0.65rem;
    flex-shrink: 0;
    min-width: 50px;
    text-align: right;
}

/* ================================================
   SCAN RESULTS - COMPACT LIST WITH THUMBNAILS
   ================================================ */
.scan-result-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}

.scan-result-compact:hover {
    background: rgba(99, 102, 241, 0.05);
}

.scan-result-compact input[type="checkbox"] {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.scan-thumb {
    position: relative;
    width: 60px;
    height: 34px;
    flex-shrink: 0;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
}

.scan-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-thumb .no-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.2rem;
    color: var(--text-muted);
}

.scan-duration-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.55rem;
    padding: 1px 3px;
    border-radius: 2px;
    font-family: monospace;
}

.scan-info-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
    cursor: pointer;
}

.scan-title-compact {
    font-size: 0.7rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}

.scan-meta-compact {
    display: flex;
    gap: 0.5rem;
    font-size: 0.6rem;
    color: var(--text-muted);
}

.scan-date-compact {
    color: var(--text-secondary);
}

/* ================================================
   FILE PANELS - UNIFORM FONT SIZE
   ================================================ */
.file-panel .file-item,
.file-panel .dest-file-item-compact {
    font-size: 0.7rem;
}

/* ================================================
   FILE ITEM COMPACT - UNIFORM STYLE FOR BOTH PANELS
   ================================================ */
.file-item-compact,
.dest-file-item-compact {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    border-bottom: 1px solid var(--border);
    cursor: default;
    transition: background 0.15s;
}

.file-item-compact:hover,
.dest-file-item-compact:hover {
    background: rgba(99, 102, 241, 0.08);
}

.file-item-compact.selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--primary);
}

.file-item-compact.is-folder,
.dest-file-item-compact.is-folder {
    cursor: pointer;
    font-weight: 500;
}

.file-item-compact.is-folder:hover,
.dest-file-item-compact.is-folder:hover {
    background: rgba(217, 119, 6, 0.1);
}

.file-item-compact.video-playable {
    cursor: pointer;
}

.file-item-compact.video-playable:hover {
    background: rgba(139, 92, 246, 0.1);
}

.file-item-compact.has-special-chars {
    background: rgba(245, 158, 11, 0.08);
}

.file-icon-compact,
.dest-file-item-compact .dest-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
    width: 1.2rem;
    text-align: center;
}

.file-name-compact,
.dest-file-item-compact .dest-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    font-size: 0.7rem;
}

.file-size-compact,
.dest-file-item-compact .dest-size {
    color: var(--text-muted);
    font-size: 0.65rem;
    flex-shrink: 0;
    min-width: 55px;
    text-align: right;
}

.file-btn-compact {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    padding: 0.15rem 0.25rem;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s;
    color: var(--text-muted);
}

.file-item-compact:hover .file-btn-compact {
    opacity: 0.6;
}

.file-btn-compact:hover {
    opacity: 1 !important;
    color: var(--primary);
}

.file-btn-compact.file-btn-delete:hover {
    color: var(--danger);
}

/* Video play button - sexy circular button */
.video-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff !important;
    border-radius: 50%;
    font-size: 0.6rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.video-play-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(139, 92, 246, 0.5);
}

/* Folder icon - orange */
.file-item-compact.is-folder .file-icon-compact,
.dest-file-item-compact.is-folder .dest-icon {
    color: #d97706;
}
