:root {
  --sidebar-width: 260px;
}

html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* ---- Sidebar ---- */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #f8f9fa;
  border-right: 1px solid #dee2e6;
  z-index: 1050;
  overflow-y: auto;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid #dee2e6;
}

.sidebar-brand {
  font-weight: 600;
  font-size: 1.1rem;
  color: #212529;
}

.sidebar-nav {
  padding: 0.75rem 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem;
  color: #212529;
  text-decoration: none;
  transition: background 0.15s ease;
}

.sidebar-link:hover {
  background: #e9ecef;
  color: #212529;
}

.sidebar-link i {
  width: 1.25rem;
  text-align: center;
}

.sidebar-divider {
  margin: 0.5rem 1rem;
  border-color: #dee2e6;
}

.sidebar-section {
  padding: 0.5rem 0 0.25rem;
}

.sidebar-section-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6c757d;
  padding: 0 1.25rem;
  margin: 0.25rem 0 0.25rem;
}

.sidebar-project-row {
  display: flex;
  align-items: center;
}

.sidebar-project-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem 0.4rem 1.25rem;
  color: #212529;
  text-decoration: none;
  transition: background 0.15s ease;
  font-size: 0.875rem;
  flex: 1;
  min-width: 0;
}

.sidebar-project-link:hover {
  background: #e9ecef;
  color: #212529;
}

.sidebar-project-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: #6c757d;
  cursor: pointer;
  border-radius: 4px;
  margin-right: 0.35rem;
  transition: background 0.15s ease;
}

.sidebar-project-toggle:hover {
  background: #dee2e6;
  color: #212529;
}

.sidebar-project-toggle i {
  font-size: 0.65rem;
  transition: transform 0.2s ease;
}

.sidebar-project-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #adb5bd;
}

.sidebar-project-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.sidebar-sprint-list {
  overflow: hidden;
  transition: height 0.2s ease;
}

.sidebar-sprint-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 1.25rem 0.3rem 2.5rem;
  color: #6c757d;
  text-decoration: none;
  font-size: 0.8rem;
  transition: background 0.15s ease;
}

.sidebar-sprint-link:hover {
  background: #e9ecef;
  color: #212529;
}

.sidebar-sprint-icon {
  font-size: 0.65rem;
  flex-shrink: 0;
  opacity: 0.6;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1040;
  transition: opacity 0.25s ease;
}

.app-content {
  transition: margin-left 0.25s ease;
}

.app-content > header {
  position: sticky;
  top: 0;
  z-index: 1020;
}

#task-filters-sticky {
  position: sticky;
  top: 57px; /* updated dynamically by JS to match actual header height */
  z-index: 1019;
  background: #fff;
  padding-top: 0.5rem;
  padding-bottom: 0.25rem;
  margin-bottom: 0.25rem;
  transition: box-shadow 0.2s ease;
}

#task-filters-sticky.is-pinned {
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.07);
}

/* Navbar brand: show only when sidebar is hidden */
.navbar-brand-when-sidebar-hidden {
  display: inline-block;
}

@media (max-width: 767px) {
  /* Mobile: hide navbar brand when sidebar is open */
  body.sidebar-open .navbar-brand-when-sidebar-hidden {
    display: none !important;
  }
}

@media (min-width: 768px) {
  /* Desktop: hide navbar brand when sidebar is visible */
  .navbar-brand-when-sidebar-hidden {
    display: none !important;
  }

  body.sidebar-closed .navbar-brand-when-sidebar-hidden {
    display: inline-block !important;
  }
}

/* Mobile: sidebar hidden by default, show on .sidebar-open */
@media (max-width: 767px) {
  .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .sidebar-overlay {
    display: block;
  }
}

/* Desktop: sidebar visible by default, hide on .sidebar-closed */
@media (min-width: 768px) {
  .sidebar {
    transform: translateX(0);
  }

  .app-content {
    margin-left: var(--sidebar-width);
  }

  body.sidebar-closed .sidebar {
    transform: translateX(-100%);
  }

  body.sidebar-closed .app-content {
    margin-left: 0;
  }
}

/* ── Quill editor shared styles ── */
#panelDescriptionEditor,
#createDescriptionEditor {
  border: 1px solid #dee2e6;
  border-radius: .375rem;
}
#panelDescriptionEditor .ql-toolbar,
#createDescriptionEditor .ql-toolbar {
  border-radius: .375rem .375rem 0 0;
}
#panelDescriptionEditor .ql-container,
#createDescriptionEditor .ql-container {
  border-radius: 0 0 .375rem .375rem;
  font-family: inherit;
  font-size: .95rem;
}
#createDescriptionEditor .ql-editor {
  min-height: 140px;
}

/* ── Quill editor in task detail panel ── */
/* Header picker labels */
#panelDescriptionEditor .ql-header .ql-picker-label::before,
#panelDescriptionEditor .ql-header .ql-picker-item::before { content: 'Normal'; }
#panelDescriptionEditor .ql-header .ql-picker-label[data-value="1"]::before,
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="1"]::before { content: 'Heading 1'; }
#panelDescriptionEditor .ql-header .ql-picker-label[data-value="2"]::before,
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="2"]::before { content: 'Heading 2'; }
#panelDescriptionEditor .ql-header .ql-picker-label[data-value="3"]::before,
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="3"]::before { content: 'Heading 3'; }
#panelDescriptionEditor .ql-header .ql-picker-label[data-value="4"]::before,
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="4"]::before { content: 'Heading 4'; }
#panelDescriptionEditor .ql-header .ql-picker-label[data-value="5"]::before,
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="5"]::before { content: 'Heading 5'; }
#panelDescriptionEditor .ql-header .ql-picker-label[data-value="6"]::before,
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="6"]::before { content: 'Heading 6'; }
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="1"] { font-size: 1.5em; font-weight: 700; }
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="2"] { font-size: 1.3em; font-weight: 700; }
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="3"] { font-size: 1.15em; font-weight: 700; }
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="4"] { font-size: 1em; font-weight: 700; }
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="5"] { font-size: .9em; font-weight: 700; }
#panelDescriptionEditor .ql-header .ql-picker-item[data-value="6"] { font-size: .8em; font-weight: 700; }

/* Panel editor: borderless, flush with panel */
#panelDescriptionEditor { border: none !important; border-radius: 0 !important; }
#panelDescriptionEditor .ql-toolbar {
  border-left: none;
  border-right: none;
  border-top: none;
  border-bottom: 1px solid #dee2e6;
  border-radius: 0;
  padding: 4px 0;
}
#panelDescriptionEditor .ql-container { border: none; border-radius: 0; }
#panelDescriptionEditor .ql-editor { padding: 6px 0; min-height: 80px; color: #6c757d; }
#panelDescriptionEditor .ql-editor.ql-blank::before { color: #adb5bd; font-style: normal; left: 0; }

/* Apply header labels to modal editor too */
#createDescriptionEditor .ql-header .ql-picker-label::before,
#createDescriptionEditor .ql-header .ql-picker-item::before { content: 'Normal'; }
#createDescriptionEditor .ql-header .ql-picker-label[data-value="1"]::before,
#createDescriptionEditor .ql-header .ql-picker-item[data-value="1"]::before { content: 'Heading 1'; }
#createDescriptionEditor .ql-header .ql-picker-label[data-value="2"]::before,
#createDescriptionEditor .ql-header .ql-picker-item[data-value="2"]::before { content: 'Heading 2'; }
#createDescriptionEditor .ql-header .ql-picker-label[data-value="3"]::before,
#createDescriptionEditor .ql-header .ql-picker-item[data-value="3"]::before { content: 'Heading 3'; }
#createDescriptionEditor .ql-header .ql-picker-label[data-value="4"]::before,
#createDescriptionEditor .ql-header .ql-picker-item[data-value="4"]::before { content: 'Heading 4'; }
#createDescriptionEditor .ql-header .ql-picker-label[data-value="5"]::before,
#createDescriptionEditor .ql-header .ql-picker-item[data-value="5"]::before { content: 'Heading 5'; }
#createDescriptionEditor .ql-header .ql-picker-label[data-value="6"]::before,
#createDescriptionEditor .ql-header .ql-picker-item[data-value="6"]::before { content: 'Heading 6'; }
#createDescriptionEditor .ql-header .ql-picker-item[data-value="1"] { font-size: 1.5em; font-weight: 700; }
#createDescriptionEditor .ql-header .ql-picker-item[data-value="2"] { font-size: 1.3em; font-weight: 700; }
#createDescriptionEditor .ql-header .ql-picker-item[data-value="3"] { font-size: 1.15em; font-weight: 700; }
#createDescriptionEditor .ql-header .ql-picker-item[data-value="4"] { font-size: 1em; font-weight: 700; }
#createDescriptionEditor .ql-header .ql-picker-item[data-value="5"] { font-size: .9em; font-weight: 700; }
#createDescriptionEditor .ql-header .ql-picker-item[data-value="6"] { font-size: .8em; font-weight: 700; }

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}
/* ── Pages feature ───────────────────────────────────────────────────────── */

.page-title-input {
    border: none;
    background: transparent;
    outline: none;
    padding: 0;
    width: 100%;
    line-height: 1.2;
}

.page-title-input:focus {
    box-shadow: none;
    border-bottom: 2px solid #0d6efd;
}

.page-menu-btn {
    line-height: 1;
    opacity: 0.6;
}

.page-menu-btn:hover {
    opacity: 1;
}

#pageEditor .ql-container.ql-snow {
    font-size: 1rem;
}

#pageEditor .ql-editor {
    min-height: calc(100vh - 280px);
}

.page-readonly-content .ql-editor {
    padding: 0;
}

.page-readonly-content .ql-editor p,
.page-readonly-content .ql-editor ul,
.page-readonly-content .ql-editor ol,
.page-readonly-content .ql-editor h1,
.page-readonly-content .ql-editor h2,
.page-readonly-content .ql-editor h3 {
    margin-bottom: 0.75rem;
}

.sidebar-page-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    font-size: 0.75rem;
    margin-right: 4px;
    flex-shrink: 0;
    color: var(--bs-secondary-color, #6c757d);
}

.breadcrumb-sm {
    font-size: 0.8rem;
}

/* ── Sidebar Pages tree ──────────────────────────────────────────────────── */

.sidebar-page-group {
    position: relative;
}

.sidebar-page-toggle {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #6c757d;
    border-radius: 3px;
    transition: background 0.15s ease, color 0.15s ease;
    padding: 0;
    margin-right: 2px;
}

.sidebar-page-toggle:hover {
    background: #dee2e6;
    color: #212529;
}

.sidebar-page-toggle i {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.sidebar-page-toggle-placeholder {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-right: 2px;
}

.sidebar-page-link {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex: 1;
    min-width: 0;
    padding: 0.3rem 1rem 0.3rem 0.25rem;
    color: #495057;
    text-decoration: none;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    transition: background 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-page-link:hover {
    background: #e9ecef;
    color: #212529;
}

.sidebar-page-icon-sm {
    font-size: 0.75rem;
    flex-shrink: 0;
    opacity: 0.6;
}

.sidebar-page-children {
    overflow: hidden;
    transition: height 0.2s ease;
}

/* ── jsTree sidebar overrides ────────────────────────────────────────────── */

#sidebar-pages-tree {
    background: transparent !important;
    padding: 0 0.25rem;
}

#sidebar-pages-tree .jstree-default {
    background: transparent;
}

#sidebar-pages-tree .jstree-container-ul {
    margin: 0 !important;
    padding: 0 !important;
}

#sidebar-pages-tree .jstree-node {
    background: none !important;
    min-height: 26px;
}

#sidebar-pages-tree .jstree-children {
    background: none !important;
}

#sidebar-pages-tree .jstree-anchor {
    font-size: 0.8125rem !important;
    color: #495057 !important;
    height: auto !important;
    padding: 3px 8px 3px 2px !important;
    line-height: 1.5 !important;
    border-radius: 4px;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#sidebar-pages-tree .jstree-anchor:focus {
    background: transparent !important;
    box-shadow: none !important;
}

#sidebar-pages-tree .jstree-hovered {
    background: #e9ecef !important;
    box-shadow: none !important;
    border-radius: 4px !important;
}

#sidebar-pages-tree .jstree-clicked {
    background: #dee2e6 !important;
    box-shadow: none !important;
    border-radius: 4px !important;
    color: #212529 !important;
}

#sidebar-pages-tree .jstree-wholerow-ul li {
    background: none !important;
}

#sidebar-pages-tree .jstree-wholerow-hovered {
    background: #e9ecef !important;
    border-radius: 4px !important;
}

#sidebar-pages-tree .jstree-wholerow-clicked {
    background: #dee2e6 !important;
    border-radius: 4px !important;
}

#sidebar-pages-tree .jstree-icon.jstree-themeicon {
    color: #9ca3af;
    font-size: 0.75rem !important;
}

#sidebar-pages-tree .jstree-ocl {
    opacity: 0.55;
}

#sidebar-pages-tree .jstree-loading > .jstree-ocl {
    opacity: 1;
}

/* Pages tree expand */
.page-expand-spacer { display: inline-block; width: 1.1rem; }
.page-expand-btn { vertical-align: middle; line-height: 1; }

/* Favourite star button */
.favourite-btn { line-height: 1; opacity: .45; transition: opacity .15s, color .15s; }
.favourite-btn:hover, .favourite-btn .fa-solid.fa-star { opacity: 1; }
