/* =========================================================
   Global Layout Adjustments
   Ensures the page layout fits the viewport cleanly.
   ========================================================= */
.custom-container {
    max-width: 95% !important;
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
}

/* =========================================================
   Tab Navigation Styling
   Custom appearance for tab headers and active states.
   ========================================================= */
.tabs-header-wrapper {
    display: flex;
    justify-content: flex-start;
    border-bottom: 1px solid #dcdcdc;
    margin-bottom: 30px;
    padding-bottom: 10px;
    width: 100%;
}

.custom-group-tabs {
    padding: 0;
    margin: 0;
}

.custom-group-tabs .nav-link {
    color: #555;
    border-radius: 8px;
    padding: 10px 25px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
    background: #f8f9fa;
    font-weight: bold;
}

.custom-group-tabs .nav-link:hover {
    background: #eee;
}

.custom-group-tabs .nav-link.active {
    background-color: #d60000;
    color: #fff;
    box-shadow: 0 4px 10px rgba(214, 0, 0, 0.2);
}

/* =========================================================
   Rule Box Layout Fixes
   Forces rule items and wrapper to occupy full available width.
   ========================================================= */
.custom-rules-wrapper {
    width: 100% !important;
    display: block;
}

.custom-rule-item {
    width: 100% !important;
    /* Forces full-width rule cards */
    margin-bottom: 25px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border: 1px solid #ebebeb;
    display: block;
}

.custom-rule-header {
    width: 100%;
    padding: 20px 30px;
    background: #fdfdfd;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.3s ease;
}

.custom-rule-header:hover {
    background: #f5f5f5;
}

.custom-rule-header h3 {
    font-size: 1.3rem;
    line-height: 1.6;
    margin: 0;
    color: #222;
    font-weight: 700;
}

/* =========================================================
   Global Width Overrides
   Ensures no parent container restricts width of tab content.
   ========================================================= */
#ruleGroupTabsContent,
#ruleGroupTabsContent .tab-pane,
#ruleGroupTabsContent .custom-rules-wrapper,
#ruleGroupTabsContent .custom-rule-item {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}

/* Enforce full-width main column layout */
.custom-container .col-lg-12 {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
}

/* =========================================================
   Sidebar Tree View
   Styles for hierarchical navigation sidebar.
   ========================================================= */
.hierarchy-sidebar {
    background: #fcfcfc;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    padding: 15px;
    max-height: 600px;
    overflow-y: auto;
}

.tree-root,
.nested-tree {
    list-style-type: none;
    margin: 0;
}

/* Additional indentation for tree hierarchy */
.hierarchy-sidebar ul.tree-root,
.hierarchy-sidebar ul.nested-tree {
    padding-right: 35px !important;
}

.tree-node {
    padding: 12px 12px 12px 20px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #444;
    font-size: 1rem;
    margin-bottom: 4px;
    border: 1px solid transparent;
    white-space: normal !important;
    word-break: break-word;
    /* Prevents overflow on long text */
    line-height: 1.8;
}

.tree-node:hover {
    background: #f0f0f0;
    border-color: #e0e0e0;
}

.tree-node.active-node {
    background: #d60000;
    color: #fff;
    font-weight: bold;
    box-shadow: 0 3px 8px rgba(214, 0, 0, 0.2);
}

/* Toggle arrow styling for collapsible nodes */
.tree-node .toggle-icon {
    min-width: 20px;
    text-align: center;
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    /* Smooth icon rotation */
    margin-left: 5px;
    margin-top: 3px;
    /* Align icon with first line of text */
}

/* Arrow state when the section is expanded */
.toggle-icon.open {
    transform: rotate(-90deg);
    /* Downward arrow rotation */
}

/* =========================================================
   Content Display Area
   Main panel used to show rule details and content.
   ========================================================= */
.rule-content-display {
    background: #fff;
    border: 1px solid #eaeaea;
    border-radius: 10px;
    padding: 40px;
    min-height: 450px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.02);
}

.content-title {
    color: #d60000;
    margin-bottom: 25px;
    font-weight: bold;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
    font-size: 1.5rem;
}

.content-text {
    line-height: 2.2;
    text-align: justify;
    color: #333;
    font-size: 1.1rem;
}



.tabs-header-wrapper {
    margin-bottom: 15px !important;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
}

.tabs-header-wrapper ul.custom-group-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
    margin: 0 !important;
    justify-content: flex-start;
}

.tabs-header-wrapper ul.custom-group-tabs li {
    margin: 0 !important;
    list-style: none;
}

.tabs-header-wrapper .nav-link {
    white-space: nowrap;
}


.tab-content {
    position: relative;
    z-index: 1;
    margin-top: 15px !important;
}

#ruleGroupTabsContent>.tab-pane {
    display: none !important;
    opacity: 1 !important;
}

#ruleGroupTabsContent>.tab-pane.active {
    display: block !important;
}


.custom-rule-item {
    margin-bottom: 10px;
}