* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

/* Global Navigation */
.navbar {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
}

.navbar-brand:focus,
.navbar-brand:hover {
    color: #0d6efd;
}

.navbar-controls {
    align-items: stretch;
}

.toolbar-search-container {
    width: 100%;
    max-width: 420px;
    flex-shrink: 0;
    margin-left: auto;
}

.toolbar-search-container .input-group {
    border: 1px solid #ced4da;
    border-radius: 4px;
    overflow: hidden;
    background-color: #ffffff;
}

.toolbar-search-container .input-group-text {
    background-color: #ffffff;
    border: none;
    color: #6c757d;
}

.toolbar-search-container .form-control {
    border: none;
    box-shadow: none;
}

.toolbar-search-container .form-control:focus {
    box-shadow: none;
}

.toolbar-search-container .btn {
    border: none;
    background-color: #ffffff;
    color: #6c757d;
}

.toolbar-search-container .btn:hover {
    background-color: #f8f9fa;
    color: #dc3545;
}

/* Main Content Area - Side by Side Layout */
.main-content {
    flex: 1;
    overflow: visible;
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
}

.tree-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tree-container {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

.description-section {
    width: 400px;
    display: flex;
    flex-direction: column;
    min-width: 300px;
    position: sticky;
    top: 1.5rem;
    align-self: flex-start;
    max-height: calc(100vh - 3rem);
}

.description-panel {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 1.5rem;
    flex: 1;
    overflow-y: auto;
}

/* Tree Styles */
.tree-node {
    margin-left: 1.5rem;
}

.tree-node-label {
    padding: 0.5rem 0.75rem;
    margin: 0.125rem 0;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #212529;
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.tree-node-label:hover {
    background-color: #f8f9fa;
    border-color: #dee2e6;
}

.tree-node-label.active {
    background-color: #0d6efd;
    color: #ffffff;
    border-color: #0d6efd;
}

.tree-node-label.active .node-id {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.tree-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6c757d;
    flex-shrink: 0;
}

.tree-toggle:hover {
    color: #212529;
}

.tree-children {
    display: none;
}

.tree-children.expanded {
    display: block;
}

.tree-node-text {
    flex: 1;
    font-size: 0.9375rem;
}

.node-id {
    font-size: 0.75rem;
    color: #6c757d;
    background-color: #e9ecef;
    padding: 0.125rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.node-id.hidden {
    display: none;
}

.highlight {
    background-color: #fff3cd;
    padding: 0.125rem 0.25rem;
    border-radius: 2px;
    font-weight: 600;
}

.tree-node-label.search-match {
    border-left: 3px solid #ffc107;
}

.search-stats {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.5rem;
}

.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.no-results i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.description-panel .h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #dee2e6;
}

.description-panel h5 {
    font-size: 1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.75rem;
}

.description-content {
    white-space: pre-line;
    line-height: 1.6;
    color: #495057;
    font-size: 0.9375rem;
}

/* Loading and Error States */
.spinner-border {
    color: #0d6efd;
}

.alert {
    border-radius: 4px;
}

.toolbar-buttons-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.navbar-controls .btn {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

/* Mode Toggle Switch - Bootstrap form-switch styling */
.form-check.form-switch {
    padding-left: 2.5em;
    min-height: 1.5rem;
    display: flex;
    align-items: center;
    width: 130px;
    flex-shrink: 0;
}

.form-check.form-switch .form-check-input {
    cursor: pointer;
    flex-shrink: 0;
}

.form-check.form-switch .form-check-label {
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    margin-left: 0.5rem;
    width: 70px;
    display: inline-block;
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 991.98px) {
    .navbar-controls {
        align-items: stretch;
    }

    .toolbar-search-container {
        max-width: 100%;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
        padding: 1rem;
    }

    .description-section {
        width: 100%;
        min-width: unset;
        position: static;
        max-height: none;
    }

    .toolbar-search-container {
        width: 100%;
    }
}

/* Scrollbar Styling */
.tree-container::-webkit-scrollbar,
.description-panel::-webkit-scrollbar {
    width: 8px;
}

.tree-container::-webkit-scrollbar-track,
.description-panel::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.tree-container::-webkit-scrollbar-thumb,
.description-panel::-webkit-scrollbar-thumb {
    background: #ced4da;
    border-radius: 4px;
}

.tree-container::-webkit-scrollbar-thumb:hover,
.description-panel::-webkit-scrollbar-thumb:hover {
    background: #adb5bd;
}

/* Accessibility - Focus Styles */
*:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.tree-node-label:focus {
    outline: 2px solid #0d6efd;
    outline-offset: -2px;
}

button:focus,
input:focus,
.tree-toggle:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0d6efd;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Footer */
.footer {
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    padding: 0.5rem 1.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: auto;
}
