/* Glassmorphism Defaults */
.glass-panel {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  color: #fff;
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.25, 1), box-shadow 0.4s ease;
}

.glass-panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45);
}

.glass-input {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  color: #fff;
  outline: none;
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
}

.glass-input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
  transform: scale(1.01);
}

.glass-input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

select.glass-input option {
  background: #2a2a2a;
  color: #fff;
}

/* Layout */
.notes-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  height: calc(100vh - 120px);
  margin-top: 20px;
  opacity: 0;
  transform: translateY(30px) scale(0.98);
  animation: slideInUpNotes 0.7s cubic-bezier(0.2, 1, 0.25, 1) forwards;
}

@keyframes slideInUpNotes {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Scrollbar customization for webkit */
.notes-sidebar::-webkit-scrollbar {
  width: 6px;
}

.notes-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 10px;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.sidebar-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: #fff;
}

.icon-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.25, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  /* transform: scale(1.08) translateY(-2px); */
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2);
}

.icon-btn:active {
  transform: scale(0.95);
}

.sections-container {
  margin-top: 20px;
  flex: 1;
  overflow-y: auto;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.note-item {
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
  border-left: 4px solid transparent;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.note-item:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateX(6px);
}

.note-item.active {
  background: rgba(255, 255, 255, 0.2);
  border-left-color: var(--accent-color, #007bff);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  border-top-color: rgba(255, 255, 255, 0.15);
}

.note-title-display {
  font-weight: 600;
  margin-bottom: 6px;
  color: #fff;
  font-size: 1rem;
  word-break: break-word;
}

.note-section-display {
  font-size: 0.85rem;
  opacity: 0.65;
}

.notes-editor {
  display: flex;
  flex-direction: column;
  padding: 26px;
  position: relative;
}

.editor-toolbar-top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
  align-items: center;
}

.title-input {
  flex: 2;
  font-size: 1.4rem;
  font-weight: 600;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.08);
}

.section-input {
  flex: 1;
  padding: 14px 20px;
  font-size: 1rem;
}

#notebook-select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 1rem;
}

.editor-actions {
  display: flex;
  gap: 12px;
}

.control-btn {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  padding: 12px 20px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
  white-space: nowrap;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.control-btn:active {
  transform: translateY(1px) scale(0.98);
}

.primary-btn {
  background: linear-gradient(135deg, #007bff, #0056b3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 25px rgba(0, 123, 255, 0.45);
}

.primary-btn:hover {
  background: linear-gradient(135deg, #1a8cff, #0062cc);
  box-shadow: 0 10px 30px rgba(0, 123, 255, 0.6);
}

.danger-btn {
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.25);
}

.danger-btn:hover {
  background: rgba(255, 107, 107, 0.25);
  color: #ff8787;
  border-color: rgba(255, 107, 107, 0.4);
}

.danger-text-btn {
  background: rgba(255, 77, 77, 0.12);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 77, 77, 0.25);
  color: #ff6b6b;
  cursor: pointer;
  padding: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 14px;
  transition: all 0.3s cubic-bezier(0.2, 0.9, 0.25, 1);
  text-align: center;
  box-shadow: 0 4px 12px rgba(255, 77, 77, 0.1);
}

.danger-text-btn:hover {
  background: rgba(255, 77, 77, 0.25);
  transform: translateY(-2px);
  color: #ff8787;
  box-shadow: 0 6px 15px rgba(255, 77, 77, 0.2);
}

.editor-wrapper {
  flex: 1;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  border-radius: 18px;
  overflow: visible;
  /* Allow dropdowns to overflow */
  color: #2c2c2e;
  box-shadow: inset 0 2px 20px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
}

#quill-editor {
  flex: 1;
  border: none;
  font-size: 1.1rem;
}

.ql-toolbar {
  border: none !important;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12) !important;
  background: rgba(250, 250, 250, 0.85) !important;
  backdrop-filter: blur(15px);
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
  padding: 14px !important;
}

.ql-container {
  border: none !important;
  font-family: inherit !important;
  font-size: 1.1rem !important;
  border-bottom-left-radius: 18px;
  border-bottom-right-radius: 18px;
}

/* Fix Quill dropdowns */
.ql-snow .ql-picker-options {
  background-color: #ffffff !important;
  /* Fully opaque white */
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
  z-index: 99999 !important;
  /* Absolute top */
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
  padding: 10px 0 !important;
  pointer-events: auto !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Ensure the dropdown is visible when expanded */
.ql-snow .ql-picker.ql-expanded .ql-picker-options {
  display: block;
}

.ql-snow .ql-picker-item {
  padding: 8px 16px !important;
  color: #333 !important;
  transition: background 0.2s;
  cursor: pointer !important;
}

.ql-snow .ql-picker-item:hover {
  background-color: rgba(0, 0, 0, 0.08) !important;
}

.ql-snow .ql-picker.ql-expanded .ql-picker-label {
  color: var(--accent-color) !important;
  z-index: 10001 !important;
}

/* Ensure picker wrapper lets clicks through to the options */
.ql-snow .ql-picker {
  pointer-events: auto !important;
  z-index: 1001 !important;
}

/* Ensure the picker labels themselves are clickable */
.ql-snow .ql-picker-label {
  cursor: pointer !important;
  pointer-events: auto !important;
  z-index: 1002 !important;
}

/* Force icons to not swallow clicks */
.ql-snow .ql-picker-label svg {
  pointer-events: none !important;
}

.ql-toolbar.ql-snow {
  position: relative;
  z-index: 2000 !important;
  /* Ensure toolbar is above the content */
}

.ql-container.ql-snow {
  position: relative;
  z-index: 1000 !important;
}

.ql-editor {
  padding: 30px !important;
  line-height: 1.6;
}

.save-indicator {
  position: absolute;
  bottom: 35px;
  right: 45px;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  color: white;
  padding: 10px 20px;
  border-radius: 30px;
  font-size: 0.95rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(15px);
  transition: all 0.4s cubic-bezier(0.2, 0.9, 0.25, 1);
  pointer-events: none;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.save-indicator.active {
  opacity: 1;
  transform: translateY(0);
}