/*
@view-transition {
  navigation: auto;
}
*/

:root {
  scroll-behavior: smooth;
  /* Slightly more refined Glass for the darker background */
  --glass-bg: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.35);
  --glass-blur: blur(14px);
  --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);

  /* Darker Slate & Charcoal palette - more "midnight" feel for Light Mode */
  --bg-gradient: linear-gradient(135deg, #475569 0%, #1e293b 100%);

  /* Very subtle, dark-gray glows */
  --circle-purple: rgba(71, 85, 105, 0.25);
  --circle-primary: rgba(51, 65, 85, 0.2);

  /* Code snippet background for Light Mode - Darker */
  --code-bg: rgba(0, 0, 0, 0.5);
  --dropdown-bg: rgba(248, 250, 252, 0.96);
}

/* PERFORMANCE: HIGH-AGGRESSION OPTIMIZATION FOR INACTIVE WINDOW */
.animations-paused {
    /* Stop all CPU-intensive background movement */
    --circle-purple: rgba(50, 50, 50, 0.1);
    --circle-primary: rgba(40, 40, 40, 0.1);
}

.animations-paused #bgcircle-pruple,
.animations-paused #bgcircle-primary {
    animation-play-state: paused !important;
    display: none !important; /* Completely remove from layout when inactive */
}

.animations-paused .glass-card,
.animations-paused .navbar-glass,
.animations-paused .offcanvas-glass,
.animations-paused .help-submenu-inner {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(15, 23, 42, 0.95) !important; /* Solid dark background instead of blur */
    transform: none !important; /* Stop GPU transforms */
    transition: none !important; /* Stop keeping transition buffers in memory */
}

/* Visibility Optimization for Intersection Observer */
.off-screen {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
}

[data-bs-theme="dark"] {
  --glass-bg: rgba(0, 0, 0, 0.4);
  --glass-border: rgba(255, 255, 255, 0.1);
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6);

  /* Original dark mode preserved */
  --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  --circle-purple: rgba(69, 22, 105, 0.6);
  --circle-primary: rgba(0, 229, 130, 0.35);

  /* Code snippet background for Dark Mode */
  --code-bg: rgba(0, 0, 0, 0.3);
  --dropdown-bg: rgba(15, 23, 42, 0.98);
}

/* --- Font Size System --- */
/* Normal (Default) and fallback for larger modes on smaller screens */
body.font-size-normal .CodeMirror,
body.font-size-large .CodeMirror,
body.font-size-huge .CodeMirror {
  font-size: 15px !important;
}
body.font-size-normal .ql-container.ql-snow,
body.font-size-large .ql-container.ql-snow,
body.font-size-huge .ql-container.ql-snow {
  font-size: 1rem !important;
}

/* Larger sizes only applied on Desktop (lg and up) */
@media (min-width: 992px) {
  /* Large */
  body.font-size-large .CodeMirror {
    font-size: 18px !important;
  }
  body.font-size-large .ql-container.ql-snow {
    font-size: 1.15rem !important;
  }
  body.font-size-large .modal-title {
    font-size: 1.4rem;
  }
  body.font-size-large .modal-body {
    font-size: 1.1rem;
  }

  /* Huge */
  body.font-size-huge .CodeMirror {
    font-size: 21px !important;
  }
  body.font-size-huge .ql-container.ql-snow {
    font-size: 1.3rem !important;
  }
  body.font-size-huge .modal-title {
    font-size: 1.6rem;
  }
  body.font-size-huge .modal-body {
    font-size: 1.25rem;
  }
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  transition: background 0.5s ease;
}

nav .logo {
  width: 25px;
  height: auto;
  /* filter: brightness(5) invert(0); */
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 15px;
  box-shadow: var(--card-shadow);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  /* Layer Promotion: Tell browser to be ready for transforms/filters */
  will-change: transform, backdrop-filter;
  /* CSS Containment: Isolate rendering to avoid page-wide recalculations */
  contain: layout;
}

.glass-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.45);
}

.glass-card.no-jump:hover,
.modal-content.glass-card:hover,
.todo-item.glass-card:hover {
  transform: none;
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.45);
}

.navbar-glass {
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
}

.offcanvas-glass {
  background: var(--glass-bg) !important;
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border) !important;
}

.sidebar-link {
  color: inherit;
  text-decoration: none;
  padding: 10px 15px;
  display: block;
  border-radius: 8px;
  transition: background 0.2s ease;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-link.active {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-weight: 600;
  position: relative;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 4px;
  background: #00e582;
  border-radius: 0 4px 4px 0;
  box-shadow: 0 0 10px rgba(0, 229, 130, 0.5);
}

.snippet-code-wrapper {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  color: #ffffff;
  transform: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.copy-btn:active {
  transform: translateY(0);
}

/* Syntax Highlighting Tweaks */
pre[class*="language-"],
pre.ql-syntax {
  background: var(--code-bg) !important;
  margin: 0 !important;
  border-radius: 0 !important;
  /* overflow: auto !important; */
  overflow: auto;
  overflow-x: hidden !important;
  white-space: pre; /* Ensure content is actually code-like */
}

/* Inline code tags (e.g. from AI) inside editor and AI box */
.ql-editor code,
.ai-insight-box code {
  background-color: rgba(255, 255, 255, 0.08) !important;
  color: #00e582 !important; /* DevBase Green/Cyan accent */
  padding: 2px 6px !important;
  border-radius: 4px !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  font-family: inherit !important;
  font-size: 0.9em !important;
}

/* Modal specific pre/code formatting */
.modal pre {
  white-space: pre-wrap !important;
  overflow-wrap: break-word !important;
  word-break: break-word !important;
}

.markdown-preview p {
  margin-top: 1rem;
}
.markdown-preview pre {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 8px;
  margin: 1rem 0;
  white-space: pre-wrap;
}

.tag-badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: inherit;
  font-size: 0.75rem;
  margin-right: 5px;
}

.snippet-card {
  max-height: 400px; /* Reduced to match original and keep it tight */
  overflow: hidden;
  cursor: pointer;
}

.snippet-card .card-body {
  padding: 1.25rem !important; /* Match standard Bootstrap card-body or adjust to top's feel */
}

.snippet-card .snippet-code-wrapper {
  max-height: 250px; /* Slightly tighter code preview */
  overflow: hidden;
  position: relative;
  margin-bottom: 0 !important; /* Remove bottom margin to let card padding handle it */
}

#bgcircle-pruple {
  z-index: -1;
  position: fixed;
  border-radius: 50%;
  -webkit-filter: blur(150px);
  filter: blur(150px);
  width: 500px;
  height: 500px;
  background-color: var(--circle-purple);
  -webkit-animation: purpleGradient 30s ease-in-out alternate infinite;
  animation: purpleGradient 30s ease-in-out alternate infinite;
  top: 10%;
  left: 20%;
  transition: background-color 0.5s ease;
}

@-webkit-keyframes purpleGradient {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30vw, 30vh) scale(1.2);
  }
  100% {
    transform: translate(-20vw, 10vh) scale(0.8);
  }
}

@keyframes purpleGradient {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(30vw, 30vh) scale(1.2);
  }
  100% {
    transform: translate(-20vw, 10vh) scale(0.8);
  }
}

#bgcircle-primary {
  z-index: -1;
  position: fixed;
  border-radius: 50%;
  -webkit-filter: blur(150px);
  filter: blur(150px);
  width: 300px;
  height: 300px;
  background-color: var(--circle-primary);
  -webkit-animation: primaryGradient 45s ease-in-out alternate infinite;
  animation: primaryGradient 45s ease-in-out alternate infinite;
  bottom: 10%;
  right: 15%;
  transition: background-color 0.5s ease;
}

@-webkit-keyframes primaryGradient {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-25vw, -25vh) scale(1.3);
  }
  100% {
    transform: translate(15vw, -15vh) scale(0.9);
  }
}

@keyframes primaryGradient {
  0% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(-25vw, -25vh) scale(1.3);
  }
  100% {
    transform: translate(15vw, -15vh) scale(0.9);
  }
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.8) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.btn-add-snipet {
  background: rgba(0, 229, 130, 0.15);
  border: 1px solid rgba(0, 229, 130, 0.4);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-add-snipet:hover {
  background: rgba(0, 229, 130, 0.3);
  border-color: rgba(0, 229, 130, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 229, 130, 0.2);
}

.btn-add-snipet:active {
  transform: translateY(0);
}

.btn-danger-glass {
  background: rgba(220, 53, 69, 0.15);
  border: 1px solid rgba(220, 53, 69, 0.4);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-danger-glass:hover {
  background: rgba(220, 53, 69, 0.3);
  border-color: rgba(220, 53, 69, 0.6);
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(220, 53, 69, 0.2);
}

.btn-danger-glass:active {
  transform: translateY(0);
}

.badge-todo {
  background: rgba(0, 229, 130, 0.15);
  border: 1px solid rgba(0, 229, 130, 0.4);
  color: #fff;
  font-weight: 700;
  font-size: 0.65rem;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  line-height: 1;
  padding: 0;
  transform: translateY(-1px);
}

.btn-edit-order:active {
  transform: translateY(0);
}

.btn-primary-glass {
  background: rgba(71, 118, 230, 0.15);
  border: 1px solid rgba(71, 118, 230, 0.4);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary-glass:hover {
  background: rgba(71, 118, 230, 0.3);
  border-color: rgba(71, 118, 230, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(71, 118, 230, 0.2);
}

.btn-primary-glass:active {
  transform: translateY(0);
}

.btn-edit-order {
  background: rgba(71, 118, 230, 0.15);
  border: 1px solid rgba(71, 118, 230, 0.4);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-edit-order:hover {
  background: rgba(71, 118, 230, 0.3);
  border-color: rgba(71, 118, 230, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(71, 118, 230, 0.2);
}

.btn-edit-order:active {
  transform: translateY(0);
}

.btn-success-glass {
  background: rgba(0, 229, 130, 0.15);
  border: 1px solid rgba(0, 229, 130, 0.4);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-success-glass:hover {
  background: rgba(0, 229, 130, 0.3);
  border-color: rgba(0, 229, 130, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 229, 130, 0.2);
}

.btn-success-glass:active {
  transform: translateY(0);
}

.btn-info-glass {
  background: rgba(13, 202, 240, 0.15);
  border: 1px solid rgba(13, 202, 240, 0.4);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-info-glass:hover {
  background: rgba(13, 202, 240, 0.3);
  border-color: rgba(13, 202, 240, 0.6);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(13, 202, 240, 0.2);
}

.btn-info-glass:active {
  transform: translateY(0);
}

.btn-ai {
  background: rgba(142, 84, 233, 0.25);
  border: 1px solid rgba(142, 84, 233, 0.5);
  color: #fff;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-ai:hover,
.btn-ai:focus,
.btn-ai:active,
.btn-ai.show {
  background: rgba(142, 84, 233, 0.4) !important;
  border-color: rgba(142, 84, 233, 0.7) !important;
  color: #fff !important;
  transform: none;
  box-shadow: 0 5px 20px rgba(142, 84, 233, 0.3);
}

/* Specific styling for AI dropdown menus to improve readability */
.glass-dropdown-ai {
  background: rgba(15, 15, 20, 0.98) !important;
  backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(142, 84, 233, 0.3) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7) !important;
}

.btn-ai:active {
  transform: none;
}

.badge-primary-glass {
  background: rgba(71, 118, 230, 0.15);
  border: 1px solid rgba(71, 118, 230, 0.4);
  color: #fff;
}

.badge-success-glass {
  background: rgba(0, 229, 130, 0.15);
  border: 1px solid rgba(0, 229, 130, 0.4);
  color: #fff;
}

.badge-info-glass {
  background: rgba(13, 202, 240, 0.15);
  border: 1px solid rgba(13, 202, 240, 0.4);
  color: #fff;
}

.badge-secondary-glass {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.icon-success-glow {
  color: #00e582 !important;
  text-shadow: 0 0 8px rgba(0, 229, 130, 0.4);
}

/* Delete buttons and links jump prevention */
.btn-link.text-danger:hover,
.btn-outline-danger:hover,
.btn-tab-close:hover {
  transform: none !important;
}

.text-ai {
  color: #fff !important;
}

#tagFilters .btn.active,
#noteTagFilters .btn.active,
#manageTagFilters .btn.active,
#manageNotesTagFilters .btn.active {
  position: relative;
}

#tagFilters .btn-outline-light.active,
#noteTagFilters .btn-outline-light.active,
#manageTagFilters .btn-outline-light.active,
#manageNotesTagFilters .btn-outline-light.active {
  background-color: transparent !important;
  color: #fff !important;
}

#tagFilters .btn.active::after,
#noteTagFilters .btn.active::after,
#manageTagFilters .btn.active::after,
#manageNotesTagFilters .btn.active::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--tag-color, #fff);
  border-radius: 2px;
  opacity: 0.9;
}

.note-card {
  cursor: pointer;
  min-height: 300px;
  display: flex;
  flex-direction: column;
}

/* Sorting Mode Animations */
.sorting-mode .note-card,
.sorting-mode .snippet-card,
.sorting-mode .todo-item {
  cursor: grab !important;
  animation: jiggle 0.6s ease-in-out infinite !important;
  user-select: none;
}

.sorting-mode .note-item:nth-child(odd) .note-card,
.sorting-mode .snippet-card-wrapper:nth-child(odd) .snippet-card,
.sorting-mode .todo-item:nth-child(odd) {
  animation-duration: 0.5s !important;
  animation-delay: -0.1s !important;
}

.sorting-mode .note-item:nth-child(even) .note-card,
.sorting-mode .snippet-card-wrapper:nth-child(even) .snippet-card,
.sorting-mode .todo-item:nth-child(even) {
  animation-duration: 0.55s !important;
  animation-delay: 0.05s !important;
}

.sorting-mode .note-card:active,
.sorting-mode .snippet-card:active,
.sorting-mode .todo-item:active {
  cursor: grabbing;
  animation: none !important;
  transform: scale(1.02) !important;
  z-index: 100;
}

@keyframes jiggle {
  0% {
    transform: rotate(-0.3deg);
  }
  50% {
    transform: rotate(0.3deg);
  }
  100% {
    transform: rotate(-0.3deg);
  }
}

.glass-card-moving {
  opacity: 0.5;
  background: rgba(var(--bs-primary-rgb), 0.1) !important;
  transform: scale(1.05) !important;
}

/* Normal view: keep row borders (since we removed them from HTML inline classes) */
.manage-notes-table,
.manage-snippets-table {
  border-collapse: collapse !important;
}

.manage-note-row,
.manage-snippet-row,
.todo-item,
.editor-container {
  scroll-margin-top: 120px;
  overflow: visible !important;
}

.manage-notes-table tbody tr {
  transition:
    transform 0.3s ease,
    background 0.3s ease,
    box-shadow 0.3s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.manage-notes-table tbody tr:last-child {
  border-bottom: none;
}

/* Manage Notes Table Spacing ONLY in sorting mode */
.manage-notes-table:has(.sorting-mode),
.manage-snippets-table:has(.sorting-mode) {
  border-collapse: separate !important;
  border-spacing: 0 12px !important;
  margin-top: -12px;
}

.manage-notes-table:has(.sorting-mode) thead th {
  border-bottom: 2px solid rgba(255, 255, 255, 0.05) !important;
  padding-bottom: 12px;
}

.manage-notes-table .sorting-mode tr,
.manage-snippets-table .sorting-mode tr {
  background: rgba(255, 255, 255, 0.02);
  border-bottom: none;
}

.manage-notes-table .sorting-mode tr:hover,
.manage-snippets-table .sorting-mode tr:hover {
  background: rgba(255, 255, 255, 0.06) !important;
}

.manage-notes-table .sorting-mode td,
.manage-snippets-table .sorting-mode td {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.manage-notes-table .sorting-mode td:first-child,
.manage-snippets-table .sorting-mode td:first-child {
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}

.manage-notes-table .sorting-mode td:last-child,
.manage-snippets-table .sorting-mode td:last-child {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Todo Pinning */
.todo-item.pinned {
  border-left: 3px solid #ffc107;
  background: rgba(255, 193, 7, 0.05);
}

.todo-item.pinned:hover {
  background: rgba(255, 193, 7, 0.1);
}

.todo-item.deadline-approaching {
  border-left: 3px solid #fd7e14;
  background: rgba(253, 126, 20, 0.05);
}

.todo-item.deadline-approaching:hover {
  background: rgba(253, 126, 20, 0.1);
}

.todo-item.deadline-passed {
  border-left: 3px solid #dc3545;
  background: rgba(220, 53, 69, 0.05);
}

.todo-item.deadline-passed:hover {
  background: rgba(220, 53, 69, 0.1);
}

h6 i.bi-pin-angle-fill {
  color: #ffc107;
}

/* Custom layout for Add Todo form on mobile */
@media (max-width: 991.98px) {
  .todo-input-group-mobile {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    background: transparent !important;
    border: none !important;
  }
  .todo-input-group-mobile > * {
    width: 100% !important;
    max-width: none !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 10px !important;
    background: rgba(0, 0, 0, 0.2) !important;
    padding: 12px !important;
    margin: 0 !important;
  }
  .todo-input-group-mobile .input-group-text {
    display: none;
  }
}

#pinnedTodosList.sorting-mode,
#othersTodosList.sorting-mode,
#pinnedNotesGrid.sorting-mode,
#othersNotesGrid.sorting-mode,
#pinnedSnippetsGrid.sorting-mode,
#othersSnippetsGrid.sorting-mode {
  min-height: 50px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px;
}

.manage-notes-table .sorting-mode td:last-child,
.manage-snippets-table .sorting-mode td:last-child {
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}

/* Manage Notes Sorting Mode - Up and Down Animation */
.sorting-mode .manage-note-row,
.sorting-mode .manage-snippet-row {
  cursor: grab;
  animation: floatUpDown 1.2s ease-in-out infinite;
  user-select: none;
  background: rgba(255, 255, 255, 0.05) !important;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.sorting-mode .manage-note-row:nth-child(2n),
.sorting-mode .manage-snippet-row:nth-child(2n) {
  animation-duration: 1.1s;
  animation-delay: 0.1s;
}

.sorting-mode .manage-note-row:nth-child(3n),
.sorting-mode .manage-snippet-row:nth-child(3n) {
  animation-duration: 1.3s;
  animation-delay: -0.15s;
}

.sorting-mode .manage-note-row:active,
.sorting-mode .manage-snippet-row:active {
  cursor: grabbing;
  animation: none !important;
  transform: scale(1.02) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

@keyframes floatUpDown {
  0% {
    transform: translateY(-4px);
  }
  50% {
    transform: translateY(4px);
  }
  100% {
    transform: translateY(-4px);
  }
}

.nav-toggle-group {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 12px;
  display: flex;
  gap: 4px;
}

.nav-toggle-btn {
  padding: 6px 16px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
}

.nav-toggle-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav-toggle-btn.active {
  background: rgba(142, 84, 233, 0.25);
  color: #fff;
  box-shadow:
    0 4px 15px rgba(142, 84, 233, 0.3),
    inset 0 0 0 1px rgba(142, 84, 233, 0.4);
  font-weight: 600;
}

@media (max-width: 991.98px) {
  /* .nav-toggle-group {
    display: none;
  } */
}

/* Settings Tags Sorting Mode */
.sorting-mode .snippet-tag-row,
.sorting-mode .note-tag-row,
.sorting-mode .todo-tag-row {
  cursor: grab !important;
  animation: floatUpDown 1.2s ease-in-out infinite !important;
  user-select: none;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 10px 15px !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.sorting-mode .snippet-tag-row:nth-child(2n),
.sorting-mode .note-tag-row:nth-child(2n),
.sorting-mode .todo-tag-row:nth-child(2n) {
  animation-duration: 1.1s !important;
  animation-delay: 0.1s !important;
}

.sorting-mode .snippet-tag-row:nth-child(3n),
.sorting-mode .note-tag-row:nth-child(3n),
.sorting-mode .todo-tag-row:nth-child(3n) {
  animation-duration: 1.3s !important;
  animation-delay: -0.15s !important;
}

.sorting-mode .snippet-tag-row:active,
.sorting-mode .note-tag-row:active,
.sorting-mode .todo-tag-row:active {
  cursor: grabbing !important;
  animation: none !important;
  transform: scale(1.02) !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
  z-index: 100;
}

/* Quill.js Dark Theme adjustments */
.ql-toolbar.ql-snow {
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  background-color: rgba(255, 255, 255, 0.05);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}
.ql-container.ql-snow {
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  font-family: inherit;
  font-size: 1rem;
}
.ql-snow .ql-stroke {
  stroke: rgba(255, 255, 255, 0.8) !important;
}
.ql-snow .ql-fill,
.ql-snow .ql-stroke.ql-fill {
  fill: rgba(255, 255, 255, 0.8) !important;
}
.ql-snow .ql-picker {
  color: rgba(255, 255, 255, 0.8) !important;
}
.ql-snow .ql-picker-options {
  background-color: #1e293b !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}
.ql-editor {
  color: white;
}
.ql-editor.ql-blank::before {
  color: rgba(255, 255, 255, 0.5) !important;
}
[data-bs-theme="light"] .ql-toolbar.ql-snow,
[data-bs-theme="light"] .ql-container.ql-snow {
  border: 1px solid rgba(0, 0, 0, 0.25) !important;
}
[data-bs-theme="light"] .ql-snow .ql-stroke {
  stroke: #444 !important;
}
[data-bs-theme="light"] .ql-snow .ql-fill {
  fill: #444 !important;
}
[data-bs-theme="light"] .ql-editor {
  color: #333;
}

/* Formatted preview in cards */
.quill-preview {
  display: -webkit-box;
  line-clamp: 10;
  -webkit-line-clamp: 10;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap;
}

.quill-preview p,
.quill-preview h1,
.quill-preview h2,
.quill-preview h3,
.quill-preview ul,
.quill-preview ol,
.quill-preview blockquote {
  margin-bottom: 0.2rem !important;
}
.quill-preview h1,
.quill-preview h2,
.quill-preview h3 {
  font-size: 1.1em !important;
  font-weight: 600;
}
.quill-preview blockquote {
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  padding-left: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
}
.quill-preview pre {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  margin-bottom: 0.2rem !important;
  white-space: pre-wrap;
  font-size: 0.85em;
}
.btn-menu .navbar-toggler-icon {
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-menu:hover .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
  transform: rotate(90deg);
}

@keyframes card-highlight-glow {
  0% {
    box-shadow:
      0 0 0 0 rgba(0, 229, 130, 0),
      inset 0 0 0 0 rgba(0, 229, 130, 0);
    border-color: var(--glass-border);
    transform: scale(1);
  }
  20% {
    box-shadow:
      0 0 40px 10px rgba(0, 229, 130, 0.4),
      inset 0 0 20px 0 rgba(0, 229, 130, 0.3);
    border-color: rgba(0, 229, 130, 0.8) !important;
    transform: scale(1.01);
  }
  100% {
    box-shadow:
      0 0 0 0 rgba(0, 229, 130, 0),
      inset 0 0 0 0 rgba(0, 229, 130, 0);
    border-color: var(--glass-border);
    transform: scale(1);
  }
}

@keyframes row-highlight-glow {
  0% {
    border-left: 0px solid rgba(0, 229, 130, 0);
  }
  30% {
    background-color: rgba(0, 229, 130, 0.2) !important;
    border-left: 4px solid rgba(0, 229, 130, 1);
    outline: 1px solid rgba(0, 229, 130, 0.5);
  }
  100% {
    border-left: 0px solid rgba(0, 229, 130, 0);
    outline: 1px solid transparent;
  }
}

.updated-highlight .glass-card,
.updated-highlight.glass-card,
.updated-highlight.todo-item,
.updated-highlight.note-item {
  animation: card-highlight-glow 3s cubic-bezier(0.4, 0, 0.2, 1) !important;
  z-index: 50;
}

.updated-highlight.manage-note-row,
.updated-highlight.manage-snippet-row {
  animation: row-highlight-glow 2.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
  position: relative;
  z-index: 50;
}

/* Notification Dropdown & Pulse Animations */
.dropdown-menu-glass {
  background: rgba(25, 30, 45, 0.85) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  border-radius: 14px !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5) !important;
  overflow: hidden;
}

.dropdown-menu-glass .dropdown-item {
  color: rgba(255, 255, 255, 0.85);
  transition: all 0.2s ease;
}

.dropdown-menu-glass .dropdown-item:hover,
.dropdown-menu-glass .dropdown-item:focus,
.dropdown-menu-glass .dropdown-item:active,
.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item:active {
  background-color: rgba(142, 84, 233, 0.25) !important;
  color: #fff !important;
}


.reminder-list::-webkit-scrollbar {
  width: 4px;
}

.reminder-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.reminder-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.reminder-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Ensure updated elements aren't hidden under header */
.snippet-card-wrapper,
.note-item,
.todo-item,
.manage-note-row,
.manage-snippet-row {
  scroll-margin-top: 100px;
}

/* Help Submenu Styles */
.help-section,
.settings-section {
  scroll-margin-top: 90px;
}

.help-submenu-outer-wrapper {
  top: 72px; /* Fixed under main navbar */
  z-index: 900;
  margin-top: -1rem; /* Pull up to sit tighter */
  /* padding-top: 1rem; */
  /* padding-bottom: 1rem; */
  /* background: linear-gradient(to bottom, var(--bs-body-bg) 70%, transparent); */
}

.help-submenu-inner {
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px !important;
  transition: none; /* Disable transition to prevent jumpiness on hover */
}

.help-submenu-inner:hover {
  transform: none !important; /* Remove the jump effect from glass-card */
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2) !important;
}

.help-submenu-inner .collapse:not(.show) {
  display: none;
}

@media (min-width: 768px) {
  .help-submenu-inner .collapse:not(.show) {
    display: block;
  }
}

.submenu-link {
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.3s ease-out;
  white-space: nowrap;
  display: flex;
  align-items: center;
}

.submenu-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.submenu-link.active {
  background: rgba(142, 84, 233, 0.25);
  color: #fff;
  box-shadow:
    0 4px 15px rgba(142, 84, 233, 0.3),
    inset 0 0 0 1px rgba(142, 84, 233, 0.4);
  font-weight: 600;
}

#helpSubmenu.no-scrollbar::-webkit-scrollbar {
  display: none;
}

#helpSubmenu.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Fix for mobile toggle interaction */
@media (max-width: 767.98px) {
  .help-submenu-inner {
    padding: 0 !important;
  }

  .submenu-link {
    padding: 12px 20px;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }

  .submenu-link.active {
    box-shadow: inset 4px 0 0 rgba(142, 84, 233, 0.8);
    background: rgba(142, 84, 233, 0.1);
  }

  .submenu-link:last-child {
    border-bottom: none;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
  }

  #currentSectionLabel {
    font-weight: 600;
    color: #fff;
  }
}

/* Code Mirror */
.CodeMirror {
  border-radius: 0 !important;
}
/* Locked Note Styles */
.note-item.locked .quill-preview {
  filter: blur(8px) opacity(0.4);
  user-select: none;
  pointer-events: none;
  transition: filter 0.3s ease;
}

.note-item.locked .note-card {
  position: relative;
  overflow: hidden;
}

.note-item.locked .note-card::after {
  content: "\F471"; /* bi-lock-fill */
  font-family: "bootstrap-icons";
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.4);
  z-index: 1;
  pointer-events: none;
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.note-item.locked:hover .quill-preview {
  filter: blur(6px) opacity(0.5);
}

.note-item.locked .card-title i.bi-lock-fill {
  font-size: 0.9rem;
  vertical-align: middle;
  color: rgba(255, 255, 255, 0.5);
}
/* Locked Snippet Styles */
.snippet-card-wrapper.locked .snippet-code-wrapper,
.snippet-card-wrapper.locked .card-text {
  filter: blur(8px) opacity(0.4);
  user-select: none;
  pointer-events: none;
  transition: filter 0.3s ease;
}

.snippet-card-wrapper.locked .snippet-card {
  position: relative;
  overflow: hidden;
}

.snippet-card-wrapper.locked .snippet-card::after {
  content: "\F471"; /* bi-lock-fill */
  font-family: "bootstrap-icons";
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: rgba(255, 255, 255, 0.4);
  z-index: 1;
  pointer-events: none;
  text-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.snippet-card-wrapper.locked:hover .snippet-code-wrapper,
.snippet-card-wrapper.locked:hover .card-text {
  filter: blur(6px) opacity(0.5);
}

/* Locked Todo Styles */
.todo-item.locked .text-truncate {
  filter: blur(6px) opacity(0.4);
  user-select: none;
  pointer-events: none;
  transition: filter 0.3s ease;
}

.todo-item.locked:hover .text-truncate {
  filter: blur(4px) opacity(0.5);
}

.todo-item.locked {
  position: relative;
}

.todo-item.locked::after {
  content: "\F471"; /* bi-lock-fill */
  font-family: "bootstrap-icons";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  color: rgba(255, 255, 255, 0.2);
  z-index: 10;
  pointer-events: none;
}

/* AI Actions */
@keyframes flash-purple-glow {
  0% {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  }
  40% {
    box-shadow:
      0 0 60px 15px rgba(142, 84, 233, 0.7),
      0 10px 40px rgba(0, 0, 0, 0.6);
    border-color: rgba(142, 84, 233, 1) !important;
    background-color: rgba(142, 84, 233, 0.2) !important;
  }
  100% {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  }
}

.flash-purple {
  animation: flash-purple-glow 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) !important;
}

/* Custom non-blocking styles for AI inputs */
.form-control-ai {
  background-color: transparent;
  box-shadow: none;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.form-control-ai:focus {
  background-color: rgba(255, 255, 255, 0.05);
  border-color: rgba(142, 84, 233, 0.5);
  box-shadow: none;
  color: #fff;
}

.btn-ai-action {
  background: rgba(142, 84, 233, 0.2);
  border: 1px solid rgba(142, 84, 233, 0.5);
  color: #fff;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: bold;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.btn-ai-action:hover,
.btn-ai-action:focus,
.btn-ai-action:active {
  background: rgba(142, 84, 233, 0.35) !important;
  border-color: rgba(142, 84, 233, 0.7) !important;
  color: #fff !important;
  transform: none;
  box-shadow: 0 4px 12px rgba(142, 84, 233, 0.2);
}

#aiNoteInsightContent strong,
#aiInsightContent strong {
  color: #00e582;
  font-weight: 700;
}

/* Shake and Glow Notifications */
@keyframes shake-bell {
  0% {
    transform: rotate(0);
  }
  15% {
    transform: rotate(20deg);
  }
  30% {
    transform: rotate(-20deg);
  }
  45% {
    transform: rotate(15deg);
  }
  60% {
    transform: rotate(-15deg);
  }
  75% {
    transform: rotate(10deg);
  }
  100% {
    transform: rotate(0);
  }
}

.shake-bell {
  animation: shake-bell 0.8s ease-in-out !important;
  display: inline-block;
}

.import-glow {
  box-shadow: 0 0 20px rgba(0, 229, 130, 0.6) !important;
  transition: all 0.3s ease;
}

/* Quick Settings Dropdown */
.dropdown-menu-glass {
  background: var(--dropdown-bg) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5) !important;
}

.quick-settings-dropdown {
  width: 250px;
}

.quick-settings-dropdown .form-select {
  font-size: 0.85rem;
  padding: 0.4rem 0.75rem;
}

.quick-settings-dropdown .btn-link-settings {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.quick-settings-dropdown .btn-link-settings:hover {
  color: #fff;
}

#noteTagFilters button,
#tagFilters button {
  margin-bottom: 0.5rem;
}
@media only screen and (max-width: 1399px) {
}
@media only screen and (max-width: 1199px) {
}
@media only screen and (max-width: 991px) {
  #noteTagFilters button,
  #tagFilters button {
    margin-bottom: 0.5rem;
    font-size: 0.7rem;
  }
}
@media only screen and (max-width: 767px) {
}
@media only screen and (max-width: 576px) {
  .nav-toggle-btn {
    padding: 6px 12px;
    font-size: 1rem;
  }
  .nav-toggle-group {
    gap: 2px;
    padding: 2px;
  }
  .navbar .container-fluid {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  #notificationBellBtn i {
    font-size: 1.1rem !important;
  }
  .badge-todo {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    margin-left: 0px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    transform: translateY(0.5px);
  }
  #nav-todo-badge-container,
  #nav-inbox-badge-container {
    display: flex;
    align-items: center;
    margin-left: 0.2rem;
  }
}

@media only screen and (max-width: 767.98px) {
  .navbar-glass.sticky-top {
    position: fixed;
    top: auto;
    bottom: 0px;
    padding: 1rem 0;
    left: 0;
    right: 0;
    z-index: 1030;
    border-bottom: none;
    border-top: 1px solid var(--glass-border);
  }

  /* Dropdown behavior when navbar is at bottom */
  .navbar-glass.sticky-top .dropdown-menu {
    top: auto !important;
    bottom: 100% !important;
    margin-top: 0 !important;
    margin-bottom: 0.5rem !important;
    transform: none !important;
  }

  /* Body padding to accommodate the bottom navbar and safe areas */
  body:has(.navbar-glass.sticky-top) {
    padding-top: 0;
    padding-bottom: calc(48px + env(safe-area-inset-bottom));
  }

  /* Compact top spacing - just enough to clear the status bar icons */
  body:has(.navbar-glass.sticky-top) main.container-fluid {
    padding-top: calc(5px + env(safe-area-inset-top)) !important;
    padding-bottom: 1.5rem;
  }

  /* Push bottom menu lower: Smaller base height + icons shifted down */
  .navbar-glass.sticky-top {
    height: calc(48px + env(safe-area-inset-bottom)) !important;
    padding-top: 0 !important;
    padding-bottom: calc(env(safe-area-inset-bottom) * 0.2) !important;
    display: flex;
    align-items: center;
  }

  /* Align icons area to be as low as possible while keeping usability */
  .navbar-glass.sticky-top .container-fluid {
    height: 48px;
    display: flex;
    align-items: center;
    position: relative;
    padding-top: 5px; /* Subtle nudge even lower */
  }

  /* Offset for anchor jumps so they don't land behind the navbar */
  .manage-note-row,
  .manage-snippet-row,
  .todo-item,
  .editor-container {
    scroll-margin-top: 20px;
    scroll-margin-bottom: 120px;
  }

  /* Modal positioning fix for mobile status bar overlap */
  .modal-dialog {
    margin-top: calc(1.5rem + env(safe-area-inset-top)) !important;
    margin-bottom: 2rem !important;
    margin-left: 0.5rem !important;
    margin-right: 0.5rem !important;
  }
  
  .modal-dialog-centered {
    align-items: flex-start !important; /* Start from top to clear status bar predictably */
    min-height: calc(100% - (3rem + env(safe-area-inset-top))) !important;
  }

  .modal-content {
    border-radius: 15px !important;
  }
}

.ai-insight-box {
  background: rgba(15, 15, 25, 0.8) !important;
  border: 1px solid rgba(142, 84, 233, 0.4) !important;
  border-radius: 15px !important;
  backdrop-filter: blur(15px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}
