﻿/* ================= BASE LAYOUT ================= */
/* Box mô tả category WPDM */

.wpdm-cat-desc-box{
    background: #e8f4ff;
    border: 1px solid #b6d9ff;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 15px;

    font-size: 14px;
    line-height: 1.6;
    color: #003366;
}

.wpdm-browser-wrap {
    display: flex;
    gap: 16px;
    font-family: system-ui, sans-serif;
    position: relative;
}

.wpdm-browser-left {
    width: 260px;
    border-right: 1px solid #ddd;
    padding-right: 10px;
    background: #fff;
}

.wpdm-browser-right {
    flex: 1;
}

/* ================= TREE ================= */

#wpdm-tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

#wpdm-tree li {
    margin: 4px 0;
}

#wpdm-tree .node {
    display: block;
    padding: 3px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background .15s ease, color .15s ease;
}

#wpdm-tree .node:hover {
    background: #eef3ff;
}

#wpdm-tree .node.active {
    background: #2563eb;
    color: #fff;
    font-weight: 600;
}

/* children */
#wpdm-tree ul {
    list-style: none;
    margin-left: 16px;
    padding-left: 0;
    display: block;
}

/* ================= TABLE ================= */

.wpdm-table {
    width: 100%;
    border-collapse: collapse;
}

.wpdm-table th,
.wpdm-table td {
    border: 1px solid #ddd;
    padding: 8px;
    vertical-align: top;
}

.wpdm-table th {
    background: #f3f4f6;
}

/* ================= FILE ICON ================= */

.wpdm-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    margin-bottom: 4px;
}

.wpdm-file.pdf::before { content: "📄"; }
.wpdm-file.doc::before { content: "📝"; }
.wpdm-file.xls::before { content: "📊"; }
.wpdm-file.other::before { content: "📁"; }

/* ================= MODAL ================= */

#wpdm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.85);
    display: none;
    z-index: 9999;
}

#wpdm-modal iframe {
    width: 90%;
    height: 90%;
    margin: 3% auto;
    display: block;
    background: #fff;
}

#wpdm-modal .close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
}

/* ================= SEARCH ================= */

.wpdm-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.wpdm-search-box {
    display: flex;
    gap: 6px;
}

#wpdm-search {
    border-radius: 20px;
    padding: 6px 12px;
    border: 1px solid #ccc;
}

/* ================= TOGGLE BUTTON ================= */
#wpdm-toggle-tree {
    display: none;
}

/* ================= MOBILE ================= */
@media (max-width: 768px) {

    /* Button */
    #wpdm-toggle-tree {
        display: block !important;
        width: 100%;
        padding: 12px 14px;
        font-size: 18px;
        background: #f5f5f5;
        border: 1px solid #ddd;
        cursor: pointer;
        position: sticky;
        top: 0;
        z-index: 10001;
    }

    /* Layout */
    .wpdm-browser-wrap {
        display: block;
    }

    /* Tree panel (hidden by default) */
    .wpdm-browser-left {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        background: #fff;
        border-right: 1px solid #ddd;
        z-index: 10000;
        overflow-y: auto;
        transition: left 0.25s ease;
    }

    /* OPEN STATE */
    .wpdm-browser-left.open {
        left: 0;
    }

    /* Right content always visible */
    .wpdm-browser-right {
        padding: 10px;
    }

    /* Overlay */
    body.wpdm-tree-open::before {
        content: "";
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 9999;
    }
}

.wpdm-download-link{
    font-size:13px;
    margin-left:6px;
    text-decoration:underline;
}

/* reset */
#wpdm-tree ul {
    margin-left: 13px;
    padding-left: 0;
}

/* icon mặc định: folder đóng */
#wpdm-tree .node::before {
    content: "📁";
    margin-right: 6px;
    cursor: pointer;
}

/* node đang mở hoặc active → folder mở */
#wpdm-tree li.open > .node::before,
#wpdm-tree .node.active::before {
    content: "📂";
}

/* ẩn cây con mặc định */
#wpdm-tree li > ul {
    display: none;
}

/* mở cây con */
#wpdm-tree li.open > ul {
    display: block;
}

/* ================= AUTO EXPAND LEVEL 1 ================= */

/* mở level 1 ngay khi load */
#wpdm-tree > li > ul {
    display: block;
}

/* icon folder mở cho level 1 */
#wpdm-tree > li > .node::before {
    content: "📂";
}
