/* ==========================================================================
   Tree Explorer Stylesheet (CodeIgniter 3 Layout Override)
   ========================================================================== */

/* Sidebar Layout */
.explorer-page-section {
    background: #eeeeee;
    padding: 6px;
}

.explorer-fluid {
    width: 100%;
    max-width: 100%;
    padding-right: 0;
    padding-left: 0;
}

.explorer-fluid > .row {
    margin-right: 0;
    margin-left: 0;
}

.explorer-fluid > .row > [class*="col-"] {
    padding-right: 0;
    padding-left: 0;
}

.explorer-container {
    display: flex;
    flex-wrap: nowrap;
    margin-top: 0;
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    overflow: hidden;
    min-height: 520px;
}

.explorer-sidebar {
    flex: 0 0 245px;
    max-width: 245px;
    background: #f6f6f6;
    border-right: 1px solid #d9d9d9;
    padding: 17px 10px 20px;
}

.explorer-content {
    flex: 1;
    min-width: 0;
    padding: 18px 18px 20px;
    background: #fff;
}

/* Sidebar Tree Structure */
.tree-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0;
    margin: 0 0 8px;
    padding: 0 10px 15px;
    border-bottom: 1px solid #e1e1e1;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tree-title i {
    color: #00a877;
}

.tree-root {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tree-item {
    margin: 6px 0;
}

.tree-node {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 8px 8px;
    border-radius: 4px;
    color: #555;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    line-height: 1.25;
}

.tree-node span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-node:hover {
    background: #f0fbf7;
    color: #00a877;
}

.tree-node.active {
    background: #06ad78 !important;
    color: #fff !important;
    font-weight: 600;
}

.tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    margin-right: 4px;
    cursor: pointer;
    color: #888;
    transition: transform 0.2s ease;
}

.tree-toggle.collapsed {
    transform: rotate(-90deg);
}

.tree-icon {
    margin-right: 8px;
    font-size: 14px;
    color: #3b94d9;
}

.tree-node.active .tree-toggle,
.tree-node.active .tree-icon {
    color: #fff;
}

/* Nested lists */
.tree-branch {
    list-style: none;
    padding-left: 12px;
    margin: 0;
    display: block;
}

.tree-branch.collapsed {
    display: none;
}

/* Content Header & Controls */
.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 16px;
    border-bottom: 0;
    padding-bottom: 0;
}

.breadcrumbs {
    font-size: 14px;
    color: #555;
    margin: 0;
    font-weight: 600;
    line-height: 1.5;
    padding-top: 2px;
}

.breadcrumbs a {
    color: #00a877;
    text-decoration: none;
}

.breadcrumbs span {
    color: #00875e;
}

.btn-actualizar {
    background-color: #009d6f;
    color: #fff;
    border: none;
    border-radius: 3px;
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    cursor: pointer;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 130px;
    justify-content: center;
}

.btn-actualizar:hover {
    background-color: #00875e;
    color: #fff;
}

/* Search bar */
.search-container {
    width: min(420px, 100%);
    margin-bottom: 18px;
    position: relative;
}

.search-input {
    width: 100%;
    height: 58px;
    padding: 12px 15px 12px 56px;
    border: 1px solid #d8e8e3;
    border-radius: 4px;
    font-size: 14px;
    transition: border 0.2s, box-shadow 0.2s;
    background: #fbfefd;
}

.search-input:focus {
    border-color: #00a877;
    box-shadow: 0 0 0 3px rgba(0, 168, 119, 0.1);
    background: #fff;
    outline: none;
}

.search-icon-inside {
    position: absolute;
    left: 17px;
    top: 50%;
    transform: translateY(-50%);
    color: #009d6f;
    font-size: 16px;
}

/* Files Listing */
.files-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid #ececec;
}

.file-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 82px;
    padding: 12px 12px 12px 4px;
    border: 0;
    border-bottom: 1px solid #ececec;
    border-radius: 0;
    transition: background 0.2s;
    background: #fff;
}

.file-row:hover {
    background: #fbfefd;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
    flex: 1 1 auto;
}

.file-type-icon {
    width: 58px;
    height: 58px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f04444;
    border: 0;
    border-radius: 4px;
    flex: 0 0 58px;
    color: #fff;
    box-shadow: inset 0 -12px 0 rgba(0,0,0,0.05);
    overflow: hidden;
}

.file-type-icon:before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    border-top: 14px solid rgba(255,255,255,0.88);
    border-left: 14px solid rgba(0,0,0,0.16);
    width: 0;
    height: 0;
}

.file-icon-lines {
    width: 26px;
    height: 17px;
    margin-bottom: 2px;
    border-top: 2px solid rgba(255,255,255,0.86);
    border-bottom: 2px solid rgba(255,255,255,0.86);
    position: relative;
}

.file-icon-lines:before {
    content: "";
    position: absolute;
    top: 6px;
    left: 0;
    width: 26px;
    border-top: 2px solid rgba(255,255,255,0.86);
}

.file-icon-label {
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    max-width: 46px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}

.file-ext-doc,
.file-ext-docx,
.file-ext-rtf {
    background: #3478d9;
}

.file-ext-xls,
.file-ext-xlsx {
    background: #178a56;
}

.file-ext-ppt,
.file-ext-pptx,
.file-ext-pps {
    background: #d65a2e;
}

.file-ext-jpg,
.file-ext-jpeg,
.file-ext-png,
.file-ext-gif,
.file-ext-tif {
    background: #7c62d4;
}

.file-ext-mp3,
.file-ext-wav,
.file-ext-wma {
    background: #be4bdb;
}

.file-ext-mp4,
.file-ext-webm,
.file-ext-vob,
.file-ext-wmv {
    background: #0f8ea8;
}

.file-ext-rar,
.file-ext-zip {
    background: #6f6f6f;
}

.file-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.file-name {
    appearance: none;
    background: transparent;
    border: 0;
    padding: 0;
    font-size: 14px;
    font-weight: 700;
    color: #424242;
    margin-bottom: 4px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    text-align: left;
    cursor: pointer;
    transition: color 0.2s;
}

.file-name:hover,
.file-name:focus {
    color: #00875e;
    outline: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.file-meta {
    font-size: 11px;
    color: #9b9b9b;
    text-transform: uppercase;
    font-weight: 500;
}

.file-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.file-size {
    min-width: 78px;
    color: #8a8a8a;
    font-size: 12px;
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
}

.btn-action {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    border: 1px solid #d9f0e8;
    background: #f8fffc;
    color: #009d6f;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 16px;
}

.btn-action:hover {
    background: #eaf8f3;
    color: #007b58;
    border-color: #9fd9c7;
}

.btn-action.btn-download:hover {
    background: #e6f6ee;
}

.no-files-message {
    text-align: center;
    padding: 44px 20px;
    color: #888;
    font-size: 14px;
}

/* Modal Visor */
.modal-backdrop.show {
    opacity: 0.8;
}

.preview-modal-dialog {
    max-width: min(900px, calc(100% - 48px)) !important;
    width: 900px !important;
    height: calc(100vh - 48px);
    margin: 24px auto;
}

.preview-modal-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 6px;
    overflow: hidden;
}

.preview-modal-header {
    background-color: #08ad7a;
    color: #fff;
    min-height: 80px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 0;
}

.preview-modal-title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 150px);
}

.btn-close-preview {
    background: #079868;
    border: none;
    color: #fff;
    font-size: 26px;
    width: 130px;
    height: 52px;
    border-radius: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.btn-close-preview:hover {
    background: #087f5a;
}

.preview-modal-body {
    flex: 1;
    padding: 0;
    background: #303030;
    position: relative;
    min-height: 0;
}

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.preview-modal-footer {
    padding: 10px 18px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.preview-media-wrap,
.preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 20px;
}

.preview-media-wrap {
    background: #f4f4f4;
}

.preview-image,
.preview-video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.preview-audio {
    width: min(620px, 90%);
}

.preview-empty {
    flex-direction: column;
    color: #555;
    background: #fff;
    text-align: center;
}

.preview-empty i {
    color: #00a877;
    margin-bottom: 15px;
}

.preview-empty-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Responsive adjustment */
@media(max-width: 768px) {
    .explorer-container {
        flex-wrap: wrap;
    }

    .explorer-sidebar {
        flex: 0 0 100%;
        max-width: 100%;
        border-right: none;
        border-bottom: 1px solid #eee;
    }

    .explorer-content {
        padding: 16px;
    }

    .content-header {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .btn-actualizar {
        width: 100%;
    }

    .file-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .file-actions {
        width: 100%;
        justify-content: flex-end;
        padding-left: 76px;
    }

    .preview-modal-dialog {
        max-width: calc(100% - 20px) !important;
        width: calc(100% - 20px) !important;
        height: calc(100vh - 20px);
        margin: 10px auto;
    }

    .preview-modal-header {
        min-height: 64px;
    }

    .preview-modal-title {
        max-width: calc(100% - 76px);
    }

    .btn-close-preview {
        width: 60px;
        height: 42px;
    }
}
