/* ============================================================
   BBB Drive — Explorateur de fichiers
   BBB Design System : mode clair, FPS sobre, accent var(--bbb-accent-red)
   DM Mono pour métadonnées, Segoe UI pour contenu
   ============================================================ */

/* DM Mono disponible via login.css (déjà chargé dans index.html) */
.bbb-drive {
    padding: 8px 0 24px;
    position: relative; /* ancre le backdrop upload */
}

/* ── Backdrop upload (affiché pendant l'envoi + traitement Imagick) ── */
.drive-upload-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 19, 22, 0.62);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    border-radius: 2px;
}

.drive-upload-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.drive-upload-spinner {
    width: 2.6rem;
    height: 2.6rem;
    color: #fff;
    border-width: 3px;
}

.drive-upload-backdrop-label {
    color: #fff;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.drive-upload-backdrop-filename {
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.68rem;
    letter-spacing: 0.04em;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}

.drive-upload-backdrop-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-align: center;
}

/* ── En-tête : chemin du dossier ───────────────────────────── */
.drive-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 4px 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid #dee2e6;
}

.drive-header-icon {
    color: var(--bbb-accent-red);
    font-size: 1rem;
    flex-shrink: 0;
}

.drive-header-path {
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 0.67rem;
    letter-spacing: 0.1em;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drive-header-path strong {
    color: #111316;
    font-weight: 500;
}

/* ── État chargement ───────────────────────────────────────── */
.drive-loading {
    display: flex;
    align-items: center;
    padding: 40px 16px;
    color: #6c757d;
    font-family: 'DM Mono', monospace;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
}

/* ── État erreur ───────────────────────────────────────────── */
.drive-error {
    padding: 12px 16px;
    background: rgba(255, 61, 0, 0.05);
    border: 1px solid rgba(255, 61, 0, 0.2);
    border-radius: 2px;
    color: #bc2d12;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

/* ── Tabs sous-dossiers ────────────────────────────────────── */
.drive-subtabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 0;
}

.drive-subtab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6c757d;
    cursor: pointer;
    transition:
        color 0.18s ease,
        border-color 0.18s ease;
    position: relative;
    bottom: -1px;
    white-space: nowrap;
}

.drive-subtab:hover {
    color: #111316;
}

.drive-subtab.active {
    color: var(--bbb-accent-red);
    border-bottom-color: var(--bbb-accent-red);
}

.drive-subtab-badge {
    background: var(--bbb-accent-red);
    color: #fff;
    font-family: 'DM Mono', monospace;
    font-size: 0.58rem;
    font-weight: 500;
    padding: 1px 5px;
    border-radius: 2px;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

/* ── Liste de fichiers ─────────────────────────────────────── */
.drive-file-list {
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 2px 2px;
}

/* Grille : icône | nom | type | taille | date | actions */
.drive-file-header,
.drive-file-row {
    display: grid;
    grid-template-columns: 32px 1fr 52px 68px 78px 90px;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
}

.drive-file-header {
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
}

.drive-file-header .drive-col-name,
.drive-file-header .drive-col-ext,
.drive-file-header .drive-col-size,
.drive-file-header .drive-col-date {
    font-family: 'DM Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #adb5bd;
}

.drive-file-row {
    border-bottom: 1px solid #f1f3f5;
    transition: background 0.12s ease;
}

.drive-file-row:last-child {
    border-bottom: none;
}

.drive-file-row:hover {
    background: #f8f9fa;
}

/* Colonnes */
.drive-col-icon {
    text-align: center;
    font-size: 1.05rem;
    color: #6c757d;
}

.drive-col-name {
    font-size: 0.875rem;
    color: #111316;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.drive-col-ext {
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    color: #6c757d;
}

.drive-col-size {
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    color: #6c757d;
    text-align: right;
}

.drive-col-date {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem;
    color: #6c757d;
}

.drive-col-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

/* Bouton d'action (download, etc.) */
.drive-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 2px;
    border: 1px solid #dee2e6;
    background: none;
    color: #6c757d;
    text-decoration: none;
    font-size: 0.8rem;
    transition:
        color 0.15s ease,
        border-color 0.15s ease,
        background 0.15s ease;
    cursor: pointer;
}

.drive-action-btn:hover {
    color: var(--bbb-accent-red);
    border-color: rgba(255, 61, 0, 0.4);
    background: rgba(255, 61, 0, 0.04);
}

/* ── État vide ─────────────────────────────────────────────── */
.drive-empty {
    text-align: center;
    padding: 48px 16px 40px;
}

.drive-empty-icon {
    font-size: 2.4rem;
    color: #dee2e6;
    display: block;
    margin-bottom: 12px;
}

.drive-empty p {
    font-family: 'DM Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #adb5bd;
    margin: 0 0 6px;
}

.drive-empty small {
    font-family: 'DM Mono', monospace;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
}

/* ── Couleurs icônes fichiers ───────────────────────────────── */
.drive-col-icon .bi-file-earmark-pdf {
    color: #bc2d12;
}
.drive-col-icon .bi-file-earmark-word {
    color: #034173;
}
.drive-col-icon .bi-file-earmark-excel {
    color: #059669;
}
.drive-col-icon .bi-file-earmark-ppt {
    color: #cf3114;
}
.drive-col-icon .bi-file-earmark-image {
    color: #7f7f7f;
}
.drive-col-icon .bi-file-earmark-play {
    color: #9467bd;
}
.drive-col-icon .bi-file-earmark-music {
    color: #ff7f0e;
}
.drive-col-icon .bi-file-earmark-zip {
    color: #d4af37;
}
.drive-col-icon .bi-file-earmark-check {
    color: #059669;
}
.drive-col-icon .bi-images {
    color: #7f7f7f;
}

/* ── Bouton danger (confirmation suppression) ──────────────── */
.drive-action-btn.danger {
    color: #bc2d12;
    border-color: rgba(188, 45, 18, 0.4);
}

.drive-action-btn.danger:hover {
    color: #fff;
    background: #bc2d12;
    border-color: #bc2d12;
}

/* ── Confirmation suppression ──────────────────────────────── */
.drive-confirm-delete {
    grid-column: 3 / 6; /* occupe les colonnes type + taille + date */
    display: flex;
    align-items: center;
    gap: 6px;
}

.drive-confirm-delete .mono {
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    color: #bc2d12;
    white-space: nowrap;
    margin-right: 2px;
}

.drive-file-row.is-confirming {
    background: rgba(188, 45, 18, 0.03);
}

/* ── Champ renommage inline ────────────────────────────────── */
.drive-rename-input {
    width: 100%;
    padding: 3px 7px;
    font-family: 'DM Mono', 'Courier New', monospace;
    font-size: 0.78rem;
    color: #111316;
    background: #fff;
    border: 1px solid rgba(255, 61, 0, 0.5);
    border-radius: 2px;
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 61, 0, 0.08);
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.drive-rename-input:focus {
    border-color: var(--bbb-accent-red);
    box-shadow: 0 0 0 2px rgba(255, 61, 0, 0.14);
}

.drive-file-row.is-renaming {
    background: rgba(255, 61, 0, 0.02);
}

/* ── Barre tabs + bouton upload ─────────────────────────────── */
.drive-subtabs-bar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    border-bottom: 1px solid #dee2e6;
}

/* Override : .drive-subtabs perd sa propre border-bottom quand dans la bar */
.drive-subtabs-bar .drive-subtabs {
    border-bottom: none;
    flex: 1;
}

.drive-upload-btn-wrap {
    padding-bottom: 4px;
    flex-shrink: 0;
}

.drive-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: none;
    border: 1px solid rgba(255, 61, 0, 0.4);
    border-radius: 2px;
    color: var(--bbb-accent-red);
    font-family: 'DM Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        border-color 0.15s ease;
    white-space: nowrap;
}

.drive-upload-btn:hover:not([disabled]) {
    background: rgba(255, 61, 0, 0.06);
    border-color: var(--bbb-accent-red);
}

.drive-upload-btn.uploading,
.drive-upload-btn[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ── Drag & drop ────────────────────────────────────────────── */
.drive-file-list.drag-over {
    outline: 2px dashed var(--bbb-accent-red);
    outline-offset: -2px;
    background: rgba(255, 61, 0, 0.03);
}

.drive-file-list.drag-over .drive-empty {
    color: var(--bbb-accent-red);
}

/* ── Animation spin (upload en cours) ──────────────────────── */
@keyframes drive-spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.drive-spin {
    display: inline-block;
    animation: drive-spin 0.8s linear infinite;
}

/* ── Utilitaire mono ────────────────────────────────────────── */
.bbb-drive .mono {
    font-family: 'DM Mono', 'Courier New', monospace;
}

/* ═══════════════════════════════════════════════════════════════
   VUE VISUELS — grille thumbnails
   ═══════════════════════════════════════════════════════════════ */

/* Zone de drop visuels */
.drive-visuals-drop-zone {
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 2px 2px;
    min-height: 160px;
    transition:
        background 0.15s ease,
        outline 0.15s ease;
}

.drive-visuals-drop-zone.drag-over {
    outline: 2px dashed var(--bbb-accent-red);
    outline-offset: -2px;
    background: rgba(255, 61, 0, 0.03);
}

/* Grille responsive */
.drive-visuals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding: 14px;
}

/* ── Card visuel ───────────────────────────────────────────── */
.drive-visual-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative; /* ancre le dropdown */
}

/* ── Zone thumbnail ─────────────────────────────────────────── */
.drive-visual-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    background: #f1f3f5;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    overflow: hidden;
    cursor: default;
}

.drive-visual-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.drive-visual-card:hover .drive-visual-img {
    transform: scale(1.04);
}

/* Placeholder sans thumbnail */
.drive-visual-no-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #dee2e6;
}

/* Badge nb tailles (coin inférieur gauche) */
.drive-visual-sizes-badge {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(17, 19, 22, 0.62);
    color: #fff;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    padding: 2px 5px;
    border-radius: 2px;
    pointer-events: none;
}

/* ── Overlay actions (visible au hover) ─────────────────────── */
.drive-visual-overlay {
    position: absolute;
    inset: 0;
    background: rgba(17, 19, 22, 0.45);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 4px;
    padding: 6px;
    opacity: 0;
    transition: opacity 0.18s ease;
}

.drive-visual-thumb:hover .drive-visual-overlay,
.drive-visual-card.is-confirming .drive-visual-overlay {
    opacity: 1;
}

/* Boutons d'action sur fond sombre */
.drive-visual-overlay .drive-action-btn {
    background: rgba(255, 255, 255, 0.92);
    border-color: transparent;
    color: #111316;
}

.drive-visual-overlay .drive-action-btn:hover {
    background: #fff;
    color: var(--bbb-accent-red);
    border-color: transparent;
}

/* ── Dropdown téléchargement ────────────────────────────────── */

/* Le menu est positionné par rapport à .drive-visual-card (position:relative)
   et non dans .drive-visual-thumb (overflow:hidden) pour ne pas être croppé. */
.drive-visual-dl-menu {
    position: absolute;
    top: 34px; /* juste sous les boutons de l'overlay */
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 2px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.14);
    min-width: 190px;
    z-index: 200;
    overflow: hidden;
}

.drive-dl-header {
    font-size: 0.56rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: #adb5bd;
    padding: 7px 10px 5px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.drive-dl-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    text-decoration: none;
    color: #111316;
    font-size: 0.8rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.drive-dl-item:hover {
    background: #f8f9fa;
    color: var(--bbb-accent-red);
}

.drive-dl-width {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    min-width: 48px;
}

.drive-dl-size {
    font-size: 0.65rem;
    color: #adb5bd;
    margin-left: auto;
}

.drive-dl-divider {
    height: 1px;
    background: #dee2e6;
    margin: 2px 0;
}

.drive-dl-zip {
    color: #6c757d;
    font-size: 0.75rem;
    gap: 6px;
}

.drive-dl-zip:hover {
    color: var(--bbb-accent-red);
    background: rgba(255, 61, 0, 0.04);
}

/* ── Nom sous la card ───────────────────────────────────────── */
.drive-visual-name {
    font-size: 0.75rem;
    color: #111316;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    padding: 0 2px;
    line-height: 1.3;
}

/* ── Renommage inline ───────────────────────────────────────── */
.drive-visual-rename-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drive-visual-rename-placeholder {
    aspect-ratio: 1 / 1;
    background: rgba(255, 61, 0, 0.04);
    border: 1px dashed rgba(255, 61, 0, 0.35);
    border-radius: 2px;
}

.drive-visual-rename-input {
    width: 100%;
}

/* ── Confirmation suppression ───────────────────────────────── */
.drive-visual-confirm {
    display: flex;
}

.drive-visual-confirm-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px 6px;
    background: rgba(188, 45, 18, 0.04);
    border: 1px solid rgba(188, 45, 18, 0.2);
    border-radius: 2px;
    width: 100%;
    min-height: 80px;
    justify-content: center;
}

.drive-visual-confirm-icon {
    font-size: 1.1rem;
    color: #bc2d12;
}

.drive-visual-confirm-text {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
    color: #bc2d12;
    text-align: center;
    line-height: 1.3;
}

.drive-visual-confirm-btns {
    display: flex;
    gap: 4px;
}

/* ── État vide visuels ──────────────────────────────────────── */
.drive-visuals-empty {
    padding: 48px 16px 40px;
}

/* ── Visuel principal ───────────────────────────────────────── */

/* Contour doré sur la thumb principale (le badge est à l'intérieur de drive-visual-thumb) */
.drive-visual-thumb:has(.drive-visual-main-badge) {
    border-color: #d4af37;
    box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.22);
}

/* Badge étoile (coin supérieur gauche, dans la thumb — non masqué par l'overlay hover) */
.drive-visual-main-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: #d4af37;
    color: #fff;
    font-size: 0.6rem;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* Bouton étoile actif (étoile pleine dorée) */
.drive-visual-overlay .drive-action-btn.drive-btn-main-active {
    color: #d4af37;
    background: rgba(255, 255, 255, 0.95);
}

.drive-visual-overlay .drive-action-btn.drive-btn-main-active:hover {
    color: #b8962e;
    background: #fff;
}
