﻿
/* --- Desktop Tree View (Flexbox - For Admin Only) --- */
.org-tree-container {
    width: 100%;
    overflow: visible; /* جلوگیری از برش خوردن لبه‌ها */
    padding: 20px 0 40px 0;
    display: flex;
    justify-content: center;
    direction: ltr; 
}

.org-tree {
    display: inline-flex;
    justify-content: center;
    margin: 0 auto;
    transform-origin: top center;
}

.org-tree ul {
    display: flex;
    padding-top: 20px;
    position: relative;
    gap: 0;
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.org-tree li {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 4px 0 4px;
    position: relative;
}

/* Horizontal line */
.org-tree li::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    border-top: 2px solid var(--color-primary);
    z-index: 1;
}

.org-tree li:only-child::before { display: none; }
.org-tree li:first-child::before { left: 50%; right: 0; }
.org-tree li:last-child::before { left: 0; right: 50%; }

/* Vertical lines */
.org-tree li::after, .org-tree ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background-color: var(--color-primary);
    z-index: 1;
}

.org-tree li:only-child::after { display: none; }
.org-tree > ul::before { display: none; }
.org-tree > ul > li { padding-top: 0; }
.org-tree > ul > li::after { display: none; }

/* --- Premium Dark Theme Box Styles (Shared) --- */
.org-node-box {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 10px;
    border-radius: 12px;
    background: linear-gradient(145deg, var(--color-bg-card) 0%, var(--body-bg) 100%);
    border: 1px solid var(--color-border);
    color: var(--color-text-main);
    font-weight: 800;
    font-size: 0.85rem;
    line-height: 1.5;
    text-align: center;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 2;
    transition: all 0.3s ease;
    width: 140px;
    min-height: 75px;
    white-space: normal;
    word-wrap: break-word;
    direction: rtl; 
}

.org-node-box:hover {
    border-color: var(--color-primary);
    box-shadow: 0 8px 20px rgba(138, 180, 248, 0.15);
    background: linear-gradient(145deg, var(--color-bg-hover) 0%, var(--color-bg-card) 100%);
}

/* Admin Buttons */
.org-node-box .d-flex { gap: 6px !important; padding-top: 10px !important; margin-top: 10px !important; }
.org-node-box .action-btn { width: 28px !important; height: 28px !important; border-radius: 8px !important; }
.org-node-box .action-btn lottie-player { width: 16px !important; height: 16px !important; }

/* --- Mobile Accordion View --- */
.org-mobile-container { display: none; width: 100%; max-width: 600px; margin: 0 auto; }
.org-mobile-list { list-style: none; padding: 0; margin: 0; }
.org-mobile-list ul { padding-right: 20px; border-right: 2px solid var(--color-border); margin-top: 10px; list-style: none; }
.org-mobile-node { background: var(--color-bg-card); border: 1px solid var(--color-border); border-radius: 8px; margin-bottom: 10px; overflow: hidden; }
.org-mobile-header { padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; font-weight: bold; color: var(--color-text-main); cursor: pointer; background: var(--color-bg-hover); }
.org-mobile-header:hover { background: var(--color-primary-light); }
.org-mobile-body { padding: 15px; background: var(--color-bg-card); border-top: 1px solid var(--color-border); }

@media (max-width: 1024px) {
    .org-tree-container, #d3-org-chart-wrapper { display: none !important; }
    .org-mobile-container { display: block !important; }
}

/* --- Light Mode Export Styles (For PDF) --- */
.light-mode-export { background: #ffffff !important; color: #000000 !important; padding: 40px !important; border-radius: 0 !important; }
.light-mode-export .org-node-box { background: #f8f9fa !important; border-color: #333333 !important; color: #000000 !important; box-shadow: none !important; }
.light-mode-export .org-tree li::before { border-color: #333333 !important; }
.light-mode-export .org-tree li::after, .light-mode-export .org-tree ul::before { background-color: #333333 !important; }
.light-mode-export #d3-org-chart { transform: none !important; }
