/* --- Bootstrap Theme Overrides --- */
:root {
    --bs-primary: #198754;
    --bs-primary-rgb: 25,135,84;
    --bs-link-color-rgb: 25,135,84;
    /* A slightly darker green for hover, derived from Bootstrap's success theme */
    --bs-link-hover-color-rgb: 21, 115, 71; 
}

.btn-primary {
    --bs-btn-color: #fff;
    --bs-btn-bg: #198754;
    --bs-btn-border-color: #198754;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #157347;
    --bs-btn-hover-border-color: #146c43;
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #146c43;
    --bs-btn-active-border-color: #13653f;
}
.btn-outline-primary {
    --bs-btn-color: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--bs-primary);
    --bs-btn-hover-border-color: var(--bs-primary);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: var(--bs-primary);
    --bs-btn-active-border-color: var(--bs-primary);
    --bs-btn-disabled-color: var(--bs-primary);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--bs-primary);
    --bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}

body {
    overflow-x: hidden; /* Prevent horizontal scrollbar */
}

#main-wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    flex-grow: 1; /* Allow wrapper to fill remaining space */
}

#content-wrapper {
    width: 100%;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
}

#content-wrapper > .container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* Styles for sidebar*/
#sidebar {
    min-width: 250px;
    max-width: 250px;
    background: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    transition: all 0.3s;
}

#sidebar.collapsed {
    margin-left: -250px; /* Hide sidebar */
}
        
.sidebar-tree {
    margin-top: 1rem;
}
.tree-nested {
    padding-left: 1.25rem; /* Indentation for child items */
}
.tree-item {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.5rem;
    border-radius: var(--bs-border-radius);
    text-decoration: none;
    color: var(--bs-body-color);
}
.tree-item:hover {
    background-color: var(--bs-secondary-bg);
}
.tree-item.active {
    background-color: var(--bs-primary);
    color: var(--bs-white);
}
.tree-page-icon {
    margin-right: 0.5rem;
    opacity: 0.7;
}
.tree-item-title {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}
.tree-item-actions {
    display: flex;
    align-items: center;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}
.tree-item:hover .tree-item-actions,
.tree-item.active .tree-item-actions {
    visibility: visible;
    opacity: 1;
}
.action-btn {
    color: inherit;
    text-decoration: none;
    padding: 0.25rem;
    opacity: 0.7;
}
.action-btn:hover {
    opacity: 1;
}

/* --- Silo Cover Image Styles --- */
.silo-cover-image {
    aspect-ratio: 2 / 1;
    overflow: hidden;
}
.silo-cover-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Title as Input Styles --- */
ins {
    background-color: var(--bs-success-bg-subtle);
    text-decoration: none;
}

del {
    background-color: var(--bs-danger-bg-subtle);
    text-decoration: none;
}

.title-input {
    font-size: var(--bs-heading-font-size, 2.5rem); /* Match h1 font size */
    font-weight: 500;
    line-height: 1.2;
    border: none;
    background-color: transparent;
    padding: 0;
    box-shadow: none !important; /* Remove focus glow */
}

.title-input:focus {
    border: none;
    background-color: transparent;
}

.diff-view {
    white-space: pre-wrap;
    font-family: var(--bs-font-monospace);
}

/* Org export styling */
[id^="outline-container-"] {
  margin-bottom: 1.5rem;  /* Reduced from 2rem */
}

/* Text within sections */
[id^="outline-text-"] {
  margin-bottom: 1rem;  /* Reduced from 1.5rem */
}

/* Headings */
h2 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.3rem;
}

h3 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

/* Paragraph spacing */
p {
  margin-bottom: 0.75rem;  /* Reduced from 1rem */
  line-height: 1.5;  /* Slightly reduced from 1.6 */
}

/* List spacing */
ul, ol {
  margin-bottom: 1rem;  /* Reduced from 1.5rem */
  padding-left: 1.5rem;  /* Reduced from 2rem */
}

li {
  margin-bottom: 0.3rem;  /* Reduced from 0.5rem */
}

li p {
  margin-bottom: 0.3rem;
}

/* Table improvements - REDUCED SPACING */
table {
  margin: 0.75rem 0;  /* Reduced from 1.5rem */
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.4rem 0.6rem;  /* Significantly reduced from 0.75rem */
  vertical-align: top;
  border-top: 1px solid var(--bs-border-color);
}

thead th {
  vertical-align: bottom;
  border-bottom: 2px solid var(--bs-border-color);
}

/* Code block spacing - REDUCED SPACING */
.src, .verbatim, pre {
  margin: 0.6rem 0;  /* Reduced from 1rem */
  padding: 0.6rem;  /* Reduced from 1rem */
  border-radius: 0.25rem;
}

code.verbatim {
  padding: 0.1rem 0.2rem;  /* Reduced from 0.2rem 0.4rem */
  display: inline;
  margin: 0;
}

/* New rule for no-transition */
#sidebar.no-transition {
    transition: none !important;
}
