/*
 * Filename: vertical.css
 * Description: Common styles for top-to-bottom (vertical) tree views.
 * Selectors are prefixed with 'vertical-' to avoid conflicts.
 */

/* Main container for the vertical tree */
#vertical-tree-container {
    text-align: center;
    width: 100%;
    overflow: auto;
    display: block;
    padding: 20px;
}

#vertical-tree-body {
    white-space: nowrap;
    overflow: visible;
    display: inline-block;
    min-height: 500px;
    text-align: center;
    box-sizing: border-box;
}

/* Scrollbar styling */
.vertical-tree-scroll::-webkit-scrollbar {
    width: 5px;
    height: 8px;
}
.vertical-tree-scroll::-webkit-scrollbar-track {
    border-radius: 10px;
    background-color: #e4e4e4;
}
.vertical-tree-scroll::-webkit-scrollbar-thumb {
    background: #212121;
    border-radius: 10px;
    transition: 0.3s;
}
.vertical-tree-scroll::-webkit-scrollbar-thumb:hover {
    background: #d5b14c;
}

/* Tree Structure */
.vertical-genealogy-tree {
    display: inline-block;
}

.vertical-genealogy-tree ul {
    padding-top: 20px;
    position: relative;
    padding-left: 0;
    display: flex;
    justify-content: center;
}

.vertical-genealogy-tree li {
    float: left;
    text-align: center;
    list-style-type: none;
    position: relative;
    padding: 20px 5px 0 5px;
}

/* Connector Lines */
.vertical-genealogy-tree li::before,
.vertical-genealogy-tree li::after {
    content: "";
    position: absolute;
    top: 0;
    right: 50%;
    border-top: 2px solid #ccc;
    width: 50%;
    height: 18px;
}

.vertical-genealogy-tree li::after {
    right: auto;
    left: 50%;
    border-left: 2px solid #ccc;
}

.vertical-genealogy-tree li:only-child::after,
.vertical-genealogy-tree li:only-child::before {
    display: none;
}

.vertical-genealogy-tree li:only-child {
    padding-top: 0;
}

.vertical-genealogy-tree li:first-child::before,
.vertical-genealogy-tree li:last-child::after {
    border: 0 none;
}

.vertical-genealogy-tree li:last-child::before {
    border-right: 2px solid #ccc;
    border-radius: 0 5px 0 0;
}

.vertical-genealogy-tree li:first-child::after {
    border-radius: 5px 0 0 0;
}

.vertical-genealogy-tree ul ul::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid #ccc;
    width: 0;
    height: 20px;
}

/* Node Styling */
.vertical-genealogy-tree li a {
    border: 1px solid #ccc;
    background: #fff;
    text-decoration: none;
    color: #444;
    font-family: Arial, Verdana, Tahoma;
    font-size: 11px;
    display: inline-block;
    border-radius: 5px;
    cursor: default;
    padding: 10px 30px 6px 9px;
    position: relative;
}

.vertical-genealogy-tree li a:hover+ul li::after,
.vertical-genealogy-tree li a:hover+ul li::before,
.vertical-genealogy-tree li a:hover+ul::before,
.vertical-genealogy-tree li a:hover+ul ul::before {
    border-color: #fbba00;
}

.vertical-member-view-box {
    padding: 0;
    text-align: center;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.vertical-member-details {
    display: inline-block;
    max-width: auto !important;
    white-space: nowrap !important;
    text-overflow: ellipsis;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    color: #333;
}

.vertical-member-details h3, .vertical-member-details h4 {
    margin: 4px;
    font-size: 12px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vertical-hidden-subtree {
    display: none !important;
}

/* Action Buttons (Add, View, etc.) */
.vertical-add-child-btn, .vertical-view-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    right: 5px;
    width: 24px;
    height: 24px;
    background-color: #131413;
    color: white;
    border-radius: 50%;
    text-align: center;
    line-height: 24px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease-in-out;
    z-index: 10;
}

.vertical-add-child-btn .zmdi, .vertical-view-btn .zmdi {
    font-size: 16px;
    line-height: 24px;
}

.vertical-add-child-btn:hover {
    background-color: #121512;
    transform: translateY(-50%) scale(1.1);
}

.vertical-view-btn:hover {
    background-color: #131416;
    transform: translateY(-50%) scale(1.1);
}

/* --- Legend Styles --- */
.vertical-legend-container {
    margin-bottom: 15px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.vertical-legend-item {
    display: flex;
    align-items: center;
}

.vertical-legend-box {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 3px;
    margin-right: 6px;
    vertical-align: middle;
    border: 1px solid #777;
}

/* --- Modal Styles for Vertical Trees --- */
.vertical-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.vertical-modal-content {
    background-color: #fefefe;
    margin: 10% auto;
    padding: 0;
    border: 1px solid #888;
    width: 95%;
    max-width: 1400px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    animation: vertical-animatetop 0.4s;
}

@keyframes vertical-animatetop {
    from { top: -300px; opacity: 0 }
    to { top: 0; opacity: 1 }
}

.vertical-modal-header {
    padding: 12px 20px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vertical-modal-title {
    font-size: 18px;
}

.vertical-modal-body {
    padding: 20px;
    font-size: 14px;
    max-height: 70vh;
    overflow-y: auto;
}

.vertical-close-button {
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.vertical-close-button:hover {
    color: black;
}

/* --- Table Styles for Modal --- */
.vertical-budget-table {
    width: 100%;
    border-collapse: collapse;
}

.vertical-budget-table th,
.vertical-budget-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

.vertical-budget-table td:not(:first-child) {
    text-align: right;
    font-family: monospace;
}

.vertical-budget-table th {
    background-color: #f2f2f2;
    font-weight: bold;
}

.vertical-budget-table tbody tr.parent-row:hover,
.vertical-budget-table tbody tr.child-row:hover {
    background-color: #f5f5f5 !important;
    cursor: pointer;
}


/* FORCE the details box to stay directly below the unit box */
.vertical-genealogy-tree li {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Unit Box stays compact */
.vertical-member-view-box {
    display: block !important;
    width: auto !important;
    margin: 0 auto !important;
}

/* Details box goes below (new line) */
.unit-summary-box {
    display: block !important;
    margin-top: 6px !important;
    width: auto !important;
    max-width: 240px !important;
    background: #ffffff;
    border: 1px solid #dcdcdc;
    border-radius: 6px;
    text-align: left;
    padding: 8px 12px;
    box-shadow: 0 2px 3px rgba(0,0,0,0.1);
}

/* Make the details inline inside one horizontal row */
.unit-summary-box {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 18px !important;       /* space between values */
    padding: 8px 12px !important;
    background: #ffffff !important;
    border: 1px solid #dcdcdc !important;
    border-radius: 6px !important;
    margin-top: 6px !important;
    width: auto !important;
    max-width: 100% !important;
    white-space: nowrap !important;
}

/* Style for each inline text item */
.unit-summary-box p {
    margin: 0 !important;
    padding: 0 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    display: inline-block !important;
    white-space: nowrap !important;
}
