/* ============================================================
   Mobile CSS — LD Tool
   Alle mobile-specifieke overrides voor schermen < 768px
   ============================================================ */

/* ---- Bestaande desktop navbar: verbergen op mobile ---- */
@media (max-width: 767px) {
    nav.navbar.navbar-fixed-top {
        display: none !important;
    }
    body {
        margin-top: 54px;
    }
}

/* ---- #mobile-nav: niet zichtbaar op desktop ---- */
@media (min-width: 768px) {
    #mobile-nav { display: none !important; }
}

/* ---- Mobile nav structuur ---- */
#mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
}

#mobile-nav-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 54px;
    padding: 0 12px;
    background-color: #565656;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.mobile-nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}
.mobile-nav-brand img:first-child { height: 24px; width: auto; }
.mobile-nav-brand img:last-child  { height: 20px; width: auto; }

#mobile-nav-toggle {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 4px;
    padding: 7px 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}
#mobile-nav-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #fff;
    border-radius: 1px;
}

#mobile-nav-panel {
    display: none;
    background-color: #565656;
    border-top: 1px solid rgba(255,255,255,0.12);
    max-height: calc(100vh - 54px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Taal */
.mnav-language {
    display: flex;
    gap: 6px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.mnav-language a {
    color: #ccc;
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
}
.mnav-language a.active {
    background-color: #ee721f;
    color: #fff;
}
.mnav-language a:hover { color: #fff; border-color: rgba(255,255,255,0.3); }

/* Zoekbalk */
.mnav-search {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.mnav-input {
    flex: 1;
    height: 38px;
    border-radius: 20px;
    border: none;
    padding: 0 14px;
    font-size: 14px;
    outline: none;
    min-width: 0;
    background: #fff;
}
.mnav-btn {
    height: 38px;
    padding: 0 18px;
    background-color: #ee721f;
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Tag dropdown */
.mnav-section {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.mnav-select {
    width: 100%;
    height: 38px;
    border-radius: 20px;
    border: none;
    padding: 0 14px;
    font-size: 14px;
    background-color: #fff;
    cursor: pointer;
}

/* Navigatielinks */
.mnav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 50px;
    color: #ddd;
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-size: 15px;
}
.mnav-link:hover, .mnav-link:active {
    color: #fff;
    background-color: rgba(255,255,255,0.06);
    text-decoration: none;
}
.mnav-link .fa { width: 18px; text-align: center; color: #ee721f; }

/* Gebruikersnaam */
.mnav-user {
    padding: 0 16px;
    height: 46px;
    color: #aaa;
    font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 12px;
}
.mnav-user .fa { color: #ee721f; }

.mnav-logout { color: #ee721f !important; }
.mnav-logout .fa { color: #ee721f; }

/* ---- Boom-pagina: voorkom dubbel scroll-gedrag ---- */
body.legaldesk-tree-loaded {
    overflow: hidden;
}
body.legaldesk-tree-loaded .content-info {
    display: none;
}

/* ---- Boomstructuur: desktop boom verbergen op mobile ---- */
@media (max-width: 767px) {
    .user-tree-view {
        display: none !important;
    }
}

/* ---- Mobile boom: verbergen op desktop ---- */
@media (min-width: 768px) {
    .mobile-tree-view {
        display: none !important;
    }
}

/* ---- Mobile boom: layout & stijl ---- */
.mobile-tree-view {
    padding: 15px;
    background: #f9f9f9;
    min-height: 100vh;
}

.mobile-tree-header {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ee721f;
}

/* Zoekbalk in mobile boom */
.mobile-tree-view .mobile-search {
    margin-bottom: 15px;
}

.mobile-tree-view .mobile-search .form-control {
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 15px;
}

/* Level-0 panel headers (root categorieën) — grijs */
.mobile-tree-view > .panel-group > .panel > .panel-heading {
    background-color: #6c757d;
    border-color: #6c757d;
}

.mobile-tree-view > .panel-group > .panel > .panel-heading a {
    color: #fff;
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 15px;
    text-decoration: none;
    gap: 8px;
}

.mobile-tree-view > .panel-group > .panel > .panel-heading a:hover {
    color: #fff;
    background-color: rgba(0,0,0,0.1);
}

/* Tag badge in mobile boom */
.mobile-tag-badge {
    display: inline-block;
    background-color: #526293;
    color: #fff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.4;
}

/* Geneste panels (level 1+) */
.mobile-leaf .panel-heading {
    background-color: #fff;
    padding: 0;
}

.mobile-leaf .panel-heading .panel-title a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 15px;
    min-height: 44px;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    border-left: 3px solid transparent;
}

.mobile-leaf .panel-heading .panel-title a:hover,
.mobile-leaf .panel-heading .panel-title a[aria-expanded="true"] {
    color: #ee721f;
    border-left-color: #ee721f;
    background-color: #fff8f4;
}

/* Subsystem label (streepjes-items) */
.mobile-leaf .panel-heading .panel-title a.mobile-only-line {
    color: #999;
    font-style: italic;
    border-left-color: #ddd;
    cursor: default;
}

/* Document links in de boom */
.mobile-doc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    min-height: 44px;
    color: #333;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    text-decoration: none;
    word-break: break-word;
}

.mobile-doc-link:hover,
.mobile-doc-link:focus {
    color: #ee721f;
    background-color: #fff8f4;
    text-decoration: none;
}

.mobile-doc-link .fa {
    color: #ee721f;
    flex-shrink: 0;
}

/* Beschrijving in boom node */
.mobile-node-description {
    padding: 8px 15px;
    font-size: 13px;
    color: #666;
    border-bottom: 1px solid #f0f0f0;
    background-color: #fafafa;
}

/* Lege nodes (geen children, geen docs) */
.mobile-leaf-empty {
    padding: 10px 15px;
    color: #999;
    font-size: 13px;
    font-style: italic;
}

/* Niveau-indicatie: indentatie */
.mobile-level-1 > .mobile-leaf .panel-heading .panel-title a { padding-left: 25px; }
.mobile-level-2 > .mobile-leaf .panel-heading .panel-title a { padding-left: 35px; }
.mobile-level-3 > .mobile-leaf .panel-heading .panel-title a { padding-left: 45px; }
.mobile-level-4 > .mobile-leaf .panel-heading .panel-title a { padding-left: 55px; }

.mobile-level-1 .mobile-doc-link { padding-left: 25px; }
.mobile-level-2 .mobile-doc-link { padding-left: 35px; }
.mobile-level-3 .mobile-doc-link { padding-left: 45px; }
.mobile-level-4 .mobile-doc-link { padding-left: 55px; }

/* ---- Document view pagina (view_document) ---- */
/* Desktop: verberg mobile cards */
@media (min-width: 768px) {
    .mobile-doc-view {
        display: none !important;
    }
}

/* Mobile: verberg de iframe viewer, toon mobile cards */
@media (max-width: 767px) {
    .doucument {
        display: none !important;
    }

    .mobile-doc-view {
        display: block !important;
        padding: 15px;
    }
}

.mobile-doc-view h4 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #ee721f;
}

.mobile-doc-view h5 {
    font-size: 15px;
    font-weight: 600;
    color: #526293;
    margin: 15px 0 10px;
}

.mobile-doc-card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.doc-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    word-break: break-word;
}

.mobile-doc-card .btn {
    margin-bottom: 8px;
}

.mobile-doc-section {
    margin-top: 5px;
}

/* ---- Document show pagina's (tabel stacking) ---- */
@media (max-width: 767px) {
    .documents-list th,
    .documents-list td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    .documents-list th {
        background-color: #f5f5f5;
        border-bottom: none !important;
        font-weight: 600;
        padding-bottom: 4px;
    }

    .documents-list td {
        border-top: none !important;
        padding-top: 4px;
        margin-bottom: 4px;
        word-break: break-word;
    }

    .documents-list tr {
        display: block;
        border: 1px solid #ddd;
        border-radius: 4px;
        margin-bottom: 10px;
        overflow: hidden;
    }

    /* Edit/aanpassen knop: full-width op mobile */
    .panel-body > .btn {
        width: 100%;
        margin-top: 10px;
        padding: 12px;
        font-size: 15px;
    }
}

/* ---- Catindex pagina: touch-friendly accordion + knoppen ---- */
@media (max-width: 767px) {
    /* Panel heading: grotere tapzone */
    .categories-list .panel-heading {
        padding: 0;
    }

    .categories-list .panel-title {
        padding: 0;
    }

    .categories-list .panel-title a {
        display: flex;
        align-items: center;
        padding: 14px 15px;
        min-height: 50px;
        font-size: 15px;
    }

    /* Download link naast titel: grotere tapzone */
    .categories-list .panel-title .fa-download {
        padding: 14px 10px;
        min-height: 50px;
        display: inline-flex;
        align-items: center;
    }

    /* Actiebuttons (trash, mail, pencil) stapelen onder de naam */
    .categories-list .panel-title {
        flex-wrap: wrap;
    }

    /* Verberg pull-right op mobile zodat ze niet overlappen */
    .categories-list .panel-title .pull-right {
        float: none !important;
        display: inline-flex;
        align-items: center;
        padding: 8px 10px;
        min-height: 44px;
        margin-left: 5px;
    }

    /* Panel body: grotere tekst en padding */
    .categories-list .panel-body {
        padding: 15px;
        font-size: 14px;
    }

    /* Category sidebar: goede padding */
    .document-categories {
        margin-bottom: 15px;
    }

    .document-categories ul li a {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 10px;
    }

    /* "Document toevoegen" knop: full-width */
    .categories-list .btn-add {
        width: 100%;
        margin-top: 10px;
        padding: 12px;
        font-size: 15px;
    }
}

/* ---- Algemene touch verbeteringen ---- */
@media (max-width: 767px) {
    /* Minimale tapzone voor alle klikbare elementen */
    .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Breadcrumbs: compacter op mobile */
    .breadcrumb {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Container: geen horizontale overflow */
    .container {
        overflow-x: hidden;
    }
}
