/* --- CONFIGURACIÓN BASE --- */
:root {
    --row-hover: rgba(255, 255, 255, 0.08);
    --border-color: rgba(255, 255, 255, 0.1);
    --accent: #1cb495;
}

#filesharing-content {
    width: 95%;
    max-width: 1400px;
    margin: 0 auto 2rem auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

/* --- TOOLBAR --- */
.drive-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    flex-wrap: wrap;
}

/* Botón Nuevo */
.new-btn {
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 24px;
    padding: 0 24px;
    height: 40px;
    font-weight: 700;
    font-family: 'Montserrat', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: 0.2s;
}

.new-btn:hover {
    background-color: #eee;
    transform: scale(1.02);
}

.new-btn i {
    color: var(--accent);
}

/* Buscador */
.drive-search {
    position: relative;
    flex: 1;
    max-width: 500px;
}

.drive-search input {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 10px 15px 10px 40px;
    color: #fff;
    outline: none;
}

.drive-search input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--accent);
}

.drive-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

/* Toolbar Right */
.toolbar-end {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-only-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px;
}

.icon-only-btn:hover,
.icon-only-btn.active {
    color: #fff;
}

.divider-v {
    width: 1px;
    height: 20px;
    background: #444;
}

/* Quota Pill */
.quota-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: #aaa;
}

.quota-mini-bar {
    width: 60px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.quota-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.5s;
}

.quota-fill.danger {
    background: #ff3e4d;
}

/* --- BREADCRUMBS --- */
.breadcrumbs-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: rgba(20, 20, 20, 0.6);
    /* Un poco más oscuro */
    backdrop-filter: blur(10px);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 10px;
    height: 50px;
}

.crumbs-container {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #aaa;
    font-size: 0.95rem;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
    /* Ocultar barra scroll en Firefox */
}

.crumbs-container::-webkit-scrollbar {
    display: none;
}

.crumb-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all 0.2s;
}

.crumb-item.active-link {
    cursor: pointer;
    color: #ccc;
    background: rgba(255, 255, 255, 0.05);
}

.crumb-item.active-link:hover {
    background: rgba(28, 180, 149, 0.2);
    /* Verde suave al pasar ratón */
    color: #fff;
    text-shadow: 0 0 5px rgba(28, 180, 149, 0.5);
}

.crumb-item:hover {
    color: #fff;
    text-decoration: underline;
}

.crumb-item.current {
    color: #fff;
    font-weight: 700;
    cursor: default;
    background: transparent;
}

.crumb-separator {
    color: #555;
    display: flex;
    align-items: center;
    font-size: 0.8rem;
}

.icon-only-btn-sm {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #aaa;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-only-btn-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: #fff;
}

/* --- CONTENIDO (LISTA vs GRID) --- */
.file-content-wrapper {
    position: relative;
    min-height: 400px;
}

/* Header de la Tabla */
.list-header {
    display: grid;
    /* La definición de columnas debe ser idéntica a la de .file-item */
    grid-template-columns: 50px 1fr 150px 100px 100px;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    color: #888;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    align-items: center;
    /* Centrar verticalmente */
}

.list-header .col-name {
    grid-column: 2;
}

/* --- MODO LISTA (.list-view) --- */
.list-view .list-header {
    display: grid;
}

.list-view .file-item {
    display: grid;
    grid-template-columns: 50px 1fr 150px 100px 100px;
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    align-items: center;
    transition: background 0.1s;
}

.list-view .file-item:hover {
    background: var(--row-hover);
}

/* Columnas Comunes */
.col-icon {
    display: flex;
    justify-content: center;
    font-size: 1.2rem;
}

.col-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

.col-name:hover {
    color: var(--accent);
}

.col-date,
.col-size {
    color: #666;
    font-size: 0.85rem;
}

.col-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

/* --- MODO FOTOS (.photo-view) --- */
.photo-view .list-header {
    display: none;
}

.photo-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
    padding-top: 1rem;
}

.photo-view .file-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    aspect-ratio: 1;
    /* Cuadrado */
    position: relative;
    transition: transform 0.2s, border-color 0.2s;
}

.photo-view .file-item:hover {
    transform: translateY(-5px);
    border-color: #666;
}

/* En modo foto, transformamos las columnas */
.photo-view .col-date,
.photo-view .col-size {
    display: none;
}

.photo-view .col-icon {
    flex: 1;
    font-size: 3rem;
    color: #444;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.photo-view .col-name {
    padding: 10px;
    font-size: 0.8rem;
    background: #1a1a1a;
    border-top: 1px solid var(--border-color);
    color: #ccc;
    text-align: center;
    width: 100%;
}

.photo-view .col-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 4px;
    padding: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-view .file-item:hover .col-actions {
    opacity: 1;
}

/* Imágenes Lazy Load */
.img-preview {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Botones Acción */
.action-btn-sm {
    background: transparent;
    border: none;
    color: #aaa;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    cursor: pointer;
}

.action-btn-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.btn-del:hover {
    color: #ff3e4d;
}

.btn-dl:hover {
    color: var(--accent);
}

/* --- LIGHTBOX (MODAL) CORREGIDO --- */
/* Este bloque faltaba o estaba incompleto, por eso salía abajo */
#lightboxModal {
    display: none;
    /* OCULTO POR DEFECTO */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0, 0, 0, 0.9);
    justify-content: center;
    /* Centrado Flex */
    align-items: center;
    backdrop-filter: blur(5px);
}

.lightbox-content {
    background: transparent;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    /* Ajuste para que el contenido no se salga */
    width: auto;
    height: auto;
}

#lightboxImg {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    object-fit: contain;
}

#lightboxVideo {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
    outline: none;
}

#lightboxCaption {
    margin-top: 10px;
    color: #ccc;
    font-family: 'Courier New', monospace;
}

.close-lightbox {
    position: absolute;
    top: -40px;
    right: 0;
    font-size: 2rem;
    color: #fff;
    cursor: pointer;
}

.lightbox-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: var(--accent);
    color: #000;
    text-decoration: none;
    border-radius: 20px;
    font-weight: bold;
}

/* --- DRAG OVERLAY (CORREGIDO) --- */
.drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(28, 180, 149, 0.2);
    border: 3px dashed #1cb495;
    border-radius: 12px;
    /* IMPORTANTE: display none por defecto */
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    pointer-events: none;
    /* Deja pasar clicks si se queda pillado */
    backdrop-filter: blur(4px);
}

/* Solo se muestra cuando tiene la clase .active */
.drag-overlay.active {
    display: flex !important;
}

.drag-overlay i {
    font-size: 4rem;
    color: #fff;
    margin-bottom: 1rem;
    text-shadow: 0 0 10px var(--accent);
}

.drag-overlay h3 {
    font-size: 1.5rem;
    color: #fff;
    text-transform: uppercase;
    text-shadow: 0 0 10px var(--accent);
}

/* --- COLORES ICONOS --- */
.folder-icon {
    color: #f5c842;
}

.pdf-icon {
    color: #e74c3c;
}

.img-icon {
    color: #9b59b6;
}

.code-icon {
    color: #f1c40f;
}

/* --- BLOQUEO ACCESO --- */
#access-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 90%;
    max-width: 500px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid #ff3e4d;
    padding: 3rem 2rem;
    border-radius: 12px;
    z-index: 9999;
}

#access-warning i {
    font-size: 4em;
    color: #ff3e4d;
    margin-bottom: 1.5rem;
    animation: pulseLock 2s infinite;
}

.protected-content {
    display: none !important;
}

body.is-authenticated .protected-content {
    display: block !important;
    animation: fadeIn 0.8s ease-out;
}

body.is-authenticated footer.protected-content {
    display: flex !important;
}

body.is-authenticated #access-warning {
    display: none !important;
}

#confirmModal {
    /* Aseguramos que ocupe toda la pantalla y use Flexbox para centrar */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    /* Fondo oscuro */
    z-index: 9999;

    /* Centrado perfecto */
    display: none;
    /* JS lo cambiará a 'flex' */
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

/* Cuando JS pone display: flex, esto asegura el centrado */
#confirmModal[style*="display: flex"] {
    display: flex !important;
}

/* Ajuste de la caja */
.confirm-box {
    background: #1a1a1a;
    border: 1px solid #ff3e4d;
    box-shadow: 0 0 30px rgba(255, 62, 77, 0.3);
    max-width: 90%;
    width: 350px;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    position: relative;
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.confirm-actions button {
    min-width: 100px;
    border: none;
}

.confirm-actions button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseLock {

    0%,
    100% {
        opacity: 0.8;
        transform: scale(1);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
        text-shadow: 0 0 20px #ff3e4d;
    }
}

/* Responsive */
@media (max-width: 768px) {

    /* Ocultar columnas secundarias en la lista (esto ya lo tenías, lo mantenemos) */
    .list-header,
    .col-date,
    .col-size {
        display: none !important;
    }

    /* Ajuste de la grilla de archivos para móvil */
    .list-view .file-item {
        /* Icono | Nombre | Acciones */
        grid-template-columns: 40px 1fr 50px;
        gap: 10px;
    }

    /* --- OPTIMIZACIÓN TOOLBAR MÓVIL (Lo que pediste) --- */

    .drive-toolbar {
        flex-direction: column;
        align-items: center;
        /* Centra todo horizontalmente */
        gap: 15px;
        /* Espacio entre filas */
        padding: 1rem;
    }

    /* Ocultar buscador en móvil */
    .toolbar-center {
        display: none;
    }

    /* Centrar grupo de botones "Nuevo" */
    .toolbar-start {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    /* Centrar y organizar grupo de herramientas derecha */
    .toolbar-end {
        width: 100%;
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        /* Permitir que la cuota baje si no cabe */
        gap: 15px;
    }

    /* Optimización extra: Botón "Nuevo" más ancho en móvil para fácil pulsación */
    .new-btn {
        width: 100%;
        justify-content: center;
    }

    /* Ajuste visual de la barra de cuota en móvil */
    .quota-pill {
        margin-top: 5px;
        width: 100%;
        justify-content: center;
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Estilo para el input del modal de carpeta */
#folderNameInput:focus {
    border-color: #1cb495 !important;
    /* Verde neon */
    box-shadow: 0 0 10px rgba(28, 180, 149, 0.3);
}

/* Asegurar que el modal de carpeta también se centra (reusamos la lógica del confirmModal) */
#createFolderModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#createFolderModal[style*="display: flex"] {
    display: flex !important;
}

/* Elemento Seleccionado (Ctrl + Click) */
.file-item.selected {
    background-color: rgba(28, 180, 149, 0.2) !important;
    border: 1px solid #1cb495 !important;
    position: relative;
    z-index: 5;
}

/* Barra Flotante de Acciones */
.batch-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    /* Oculto abajo */
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 25px;
    border-radius: 50px;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid #1cb495;
    z-index: 100;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    pointer-events: none;
}

.batch-toolbar.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: all;
}

.batch-info {
    font-weight: bold;
    color: #fff;
    font-size: 0.9rem;
}

.batch-info span {
    color: #1cb495;
}

/* Arrastrar elementos (Ghost Image) */
.dragging-ghost {
    opacity: 0.5;
    border: 2px dashed #fff;
}

/* Carpeta destino al arrastrar encima */
.file-item.drop-target {
    background: rgba(245, 200, 66, 0.3) !important;
    border: 2px dashed #f5c842 !important;
    transform: scale(1.02);
}

/* --- AÑADIR AL FINAL DE assets/css/fileStationNew.css --- */

/* Modal Mover: Contenedor de lista */
.folder-list-container {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px;
}

/* Items de la lista */
.folder-target-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    color: #ccc;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.folder-target-item:hover {
    background: rgba(28, 180, 149, 0.2);
    color: #fff;
    padding-left: 15px;
    /* Efecto deslizamiento */
}

.folder-target-item i {
    color: #f5c842;
}

/* Scrollbar fina para la lista */
.folder-list-container::-webkit-scrollbar {
    width: 6px;
}

.folder-list-container::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

/* --- Estilos para Compartir --- */
#shareEmailInput:focus {
    border-color: #3498db !important;
    /* Azul */
    box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
}

/* Asegurar centrado del modal share (reutilizando lógica) */
#shareModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

#shareModal[style*="display: flex"] {
    display: flex !important;
}

/* Etiqueta de "Compartido por" */
.shared-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.7rem;
    color: #3498db;
    /* Azul tipo Twitter/Link */
    background: rgba(52, 152, 219, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    border: 1px solid rgba(52, 152, 219, 0.3);
    white-space: nowrap;
    align-self: flex-start;
}

.shared-pill i {
    font-size: 0.65rem;
}

/* Ajuste para que el nombre del archivo y la etiqueta convivan bien */
.col-name-wrapper {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}