/* --- Estructura y Layout Principal --- */
html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; }
body { background-color: #f8f9fa; display: flex; flex-direction: column; }
.app-body { background-color: #f8f9fa; }
.min-width-0 { min-width: 0; }

.container-fluid { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
#file-manager { display: flex; flex-direction: column; flex-grow: 1; min-height: 0; }
#drop-zone { flex-grow: 1; display: flex; flex-direction: column; min-height: 0; transition: all 0.2s ease-in-out; border: 2px dashed transparent; }
#file-list { overflow-y: auto; }

/* --- Sidebar (Nuevo) --- */
#sidebar { background-color: #fff !important; transition: transform 0.3s ease; }
#sidebar .nav-link { color: #555; border-radius: 8px; margin-bottom: 4px; padding: 10px 15px; font-weight: 500; }
#sidebar .nav-link:hover { background-color: #f1f3f5; color: #000; }
#sidebar .nav-link.active { background-color: #e7f1ff; color: #0d6efd; }
#sidebar .nav-link i { width: 24px; text-align: center; }

/* --- Overlay de Carga --- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1056;
}
.loader-content .spinner-border {
    width: 3rem;
    height: 3rem;
}
.loader-content p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* --- Modales de Bootstrap --- */
#bs-alert-modal {
    z-index: 1060;
}

/* --- Estilos para Drag & Drop y Selección --- */
#drop-zone.drag-over { border-color: #0d6efd; background-color: #e9f2ff; }
.file-item.drag-over-folder { background-color: #d1e7dd !important; box-shadow: 0 0 0 2px #198754; }
.file-item.selected { background-color: #cfe2ff !important; }
.file-item.dragging { opacity: 0.4; }
.drag-ghost { position: absolute; left: -9999px; display: flex; align-items: center; background-color: #0d6efd; color: white; padding: 8px 12px; border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,0.2); font-weight: bold; font-size: 14px; z-index: 9999; }
.drag-ghost-counter { margin-left: 8px; background-color: white; color: #0d6efd; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }

/* --- Overlay para Arrastrar y Soltar (Fullscreen) --- */
#fullscreen-drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(13, 110, 253, 0.15); /* Color azul pálido y semitransparente */
    border: 4px dashed rgba(13, 110, 253, 0.5);
    z-index: 2000; /* Un z-index alto para que esté por encima de todo */
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none; /* Importante para que los eventos de drop sigan funcionando debajo */
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

#fullscreen-drag-overlay .overlay-content {
    text-align: center;
    color: rgba(13, 110, 253, 0.8);
    font-weight: bold;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.5);
}

/* Efecto visual para items en el portapapeles */
.item-in-clipboard {
    border-left: 4px solid #0d6efd !important;
}
.item-in-clipboard > .row > .col-md-6,
.item-in-clipboard > .row > .col-md-2,
.item-in-clipboard > .row > .col-md-3 {
    opacity: 0.6;
}


/* --- Estilos de Elementos --- */
#login-tab, #register-tab { cursor: pointer; }
.file-item { transition: background-color 0.15s ease-in-out, border-left 0.15s ease-in-out; position: relative; border-left: 4px solid transparent; }
.file-item:hover { background-color: #f1f3f5; cursor: pointer; }
.item-size, .item-modified { color: #6c757d; }
.item-actions .dropdown .btn { background-color: transparent; border: none; color: #6c757d; padding: 0.1rem 0.5rem; }
.file-item:hover .item-actions .dropdown .btn,
.item-actions .dropdown .btn.show { background-color: #e9ecef; }
.dropdown-menu { font-size: 0.9rem; }
.dropdown-item { cursor: pointer; }
.dropdown-item i { color: #6c757d; }
.dropdown-item.text-danger i { color: inherit; }

/* Colores para los iconos */
.item-icon .fa-folder { color: #FFC107 !important; }
.item-icon .fa-file-image { color: #6f42c1; }
.item-icon .fa-file-video { color: #fd7e14; }
.item-icon .fa-file-audio { color: #d63384; }
.item-icon .fa-file-pdf { color: #dc3545; }
.item-icon .fa-file-archive { color: #6610f2; }
.item-icon .fa-file-word { color: #0d6efd; }
.item-icon .fa-file-excel { color: #198754; }
.item-icon .fa-file-powerpoint { color: #ff8000; }
.item-icon .fa-file-code { color: #20c997; }
.item-icon .fa-file-alt { color: #6c757d; }
.item-icon .fa-pencil-ruler { color: #17a2b8; }
.item-icon .fa-database { color: #343a40; }

/* REGLA PROBLEMÁTICA (Mantenemos para menús de archivos, pero sobreescribimos abajo para Sidebar) */
.dropdown.position-static { position: static !important; }
.dropdown-menu { position: fixed !important; z-index: 1060 !important; }

#file-list { position: relative; z-index: 1; }
.item-actions .fa-download { color: #0d6efd; }

#main-actions > * {
    margin-right: 5px;
}
#main-actions > .btn-group > .btn,
#main-actions > .btn {
    border-radius: var(--bs-border-radius) !important;
}
#main-actions > *:last-child {
    margin-right: 0;
}
#clipboard-actions.btn-group > .btn:first-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

#clipboard-actions.btn-group > .btn:last-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    margin-left: -1px;
}
#progress-bar {
    padding-left: 12px;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
}
#progress-bar-container {
    width: 75%;
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 0;
    height: 17px;
}
#file-list {
    border-top: 1px solid #dee2e6;
}
#drop-zone .card-header {
    background-color: transparent;
    border-bottom: 1px solid #dee2e6;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    font-weight: 500;
}
#drop-zone .card-header .row {
    align-items: center;
}
#drop-zone .card-header a {
    color: #6c757d;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    text-decoration: none;
}
#drop-zone .card-header a:hover {
    color: #212529;
}
#drop-zone .card-header .row > div:last-child {
    color: #6c757d;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    font-weight: 500;
}
.shared-icon {
    cursor: pointer;
    color: #6c757d; 
    font-size: 0.8rem;
    flex-shrink: 0; 
    transition: color 0.2s ease-in-out;
}
.shared-icon:hover {
    color: #0d6efd;
}

/* ================================================================== */
/* ==================== VISTA DE CUADRÍCULA ========================= */
/* ================================================================== */

/* Contenedor Grid */
#file-list.grid-view {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    padding: 15px;
    gap: 15px;
}

/* Transformar las filas de bootstrap en tarjetas */
#file-list.grid-view .file-item {
    width: 140px;
    height: 170px; /* Un poco más alto para nombres largos */
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    position: relative;
    border-left: 1px solid #eee; /* Reset borde selección lista */
    margin-bottom: 0;
    background-color: #fff;
}

#file-list.grid-view .file-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
    border-color: #dee2e6;
}

#file-list.grid-view .file-item.selected {
    background-color: #e7f1ff !important;
    border: 1px solid #0d6efd !important;
    box-shadow: 0 0 0 1px #0d6efd inset;
}

/* Reorganizar contenido interno en Grid */
#file-list.grid-view .row {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
    width: 100%;
}

#file-list.grid-view .col-md-6 {
    /* Nombre e Icono */
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
}

#file-list.grid-view .item-icon {
    margin-right: 0 !important;
    margin-bottom: 12px;
}
#file-list.grid-view .item-icon i {
    font-size: 3rem !important; /* Icono gigante */
}

#file-list.grid-view .item-name {
    font-size: 0.85rem;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
    width: 100%;
}

/* Ocultar metadatos en Grid */
#file-list.grid-view .col-md-2, /* Tamaño */
#file-list.grid-view .col-md-3, /* Fecha */
#file-list.grid-view .shared-icon {
    display: none !important;
}

/* Botón de acciones (3 puntos) en Grid */
#file-list.grid-view .col-md-1 {
    position: absolute;
    top: 5px;
    right: 5px;
    width: auto;
    padding: 0;
}
#file-list.grid-view .action-menu-btn {
    opacity: 0; /* Solo visible al hover */
    padding: 2px 6px;
    background-color: rgba(255,255,255,0.8);
    border-radius: 4px;
}
#file-list.grid-view .file-item:hover .action-menu-btn,
#file-list.grid-view .action-menu-btn[aria-expanded="true"] {
    opacity: 1;
}

/* Utilería Scrollbar */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background-color: rgba(0,0,0,0.2); border-radius: 10px; }

/* ================================================================== */
/* =============== INICIO: ESTILOS PARA EL LOGIN ==================== */
/* ================================================================== */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #ffffff;
    overflow: auto;
}

.login-body .container-fluid {
    display: contents; /* Hace que el contenedor no afecte al layout de flex */
}

.login-box {
    width: 100%;
    max-width: 380px;
    padding: 2rem;
    text-align: center;
}

.login-icon-container {
    width: 100px;
    height: 100px;
    background-color: #5dade2; /* Tono de azul de la imagen */
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    color: white;
    font-size: 48px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.login-box .input-group {
    border: 1px solid #ced4da;
    border-radius: 8px; /* Bordes más redondeados */
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-box .input-group .form-control,
.login-box .input-group .input-group-text {
    border: none; /* Quitamos los bordes individuales */
    box-shadow: none;
}

.login-box .input-group-text {
    background-color: white;
    padding-left: 15px;
    padding-right: 15px;
    color: #adb5bd; /* Iconos en un tono gris */
}

.login-box .input-group .form-control {
    padding-left: 0;
}

.login-box .input-group:focus-within {
    border-color: #5dade2;
    box-shadow: 0 0 0 0.25rem rgba(93, 173, 226, 0.25);
}

.login-btn {
    background-color: #5dade2;
    border-color: #5dade2;
    padding: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    border-radius: 8px;
    text-transform: uppercase;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.login-btn:hover {
    background-color: #3498db; /* Azul un poco más oscuro al pasar el ratón */
    border-color: #3498db;
}

.login-footer {
    font-size: 0.9rem;
    color: #b0b0b0;
}

.login-footer a {
    color: #5dade2;
    text-decoration: none;
    font-weight: 500;
}

.login-footer a:hover {
    text-decoration: underline;
}

/* --- Estilos para el Modal de Información --- */
#info-modal-body h6 {
    font-size: 0.9rem;
    font-weight: 600;
    color: #6c757d;
}

#info-modal-body .breadcrumb-item {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px; 
}
#info-modal-body .breadcrumb-item:last-child {
    font-weight: bold;
    color: #212529;
}

/* --- Botón Nuevo Personalizado (Degradado) --- */
.custom-new-btn {
    background: linear-gradient(135deg, #0d6efd 0%, #6f42c1 100%);
    color: white !important;
    border: none;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    border-radius: 0.375rem; 
}

.custom-new-btn:hover,
.custom-new-btn[aria-expanded="true"] {
    background: linear-gradient(135deg, #0b5ed7 0%, #59359a 100%);
    color: white !important;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.custom-new-btn i {
    color: white !important;
}

/* --- CORRECCIÓN IMPORTANTE: Dropdown del Sidebar --- */
/* Forzamos a que este menú específico sea absolute para que respete el ancho del botón padre */
#sidebar .dropdown-menu {
    position: absolute !important;
    width: 100%; /* Respetará el w-100 del HTML */
}

/* --- CORRECCIÓN BARRA ALMACENAMIENTO --- */
#storage-usage-footer {
    position: static !important; 
    width: 100% !important;
    background-color: transparent !important;
    border: none !important;
    padding-top: 15px !important;
    margin-top: auto !important; 
    box-shadow: none !important;
    z-index: 1;
}

#sidebar {
    overflow-y: auto; 
    scrollbar-width: thin; 
}

#storage-usage-footer .progress {
    background-color: #e9ecef;
    box-shadow: inset 0 1px 2px rgba(0,0,0,.1);
}
