/* note-category-selector.css - Styling for note categories and category selection */

/* ===== Note Category Label Styling ===== */
.note-category {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  background-color: rgba(98, 0, 238, 0.1);
  border-radius: 12px;
  font-size: 12px;
  color: var(--primary-color);
  cursor: pointer;
  transition: background-color 0.2s;
  max-width: fit-content;
  position: relative;
  margin-right: 25%;
}

.note-category:hover {
  background-color: rgba(98, 0, 238, 0.2);
}

.note-category-icon {
  margin-right: 4px;
  font-size: 14px;
}

.note-category-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Note Footer Positioning ===== */
/* Position within note footer - CENTERED CONTAINER (Non-Expanded Note) */
.note:not(.expanded) .note-footer {
  position: absolute !important;
  top: auto !important;
  bottom: 10px !important;
  left: 0 !important;
  right: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px !important;
  z-index: 5 !important;
  padding: 0 40px !important; /* Make room for buttons on sides */
  box-sizing: border-box !important;
}

/* Position the timestamp */
.note-timestamp {
  font-size: 12px !important;
  color: #757575 !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  text-align: right !important;
}

/* ===== Button Positioning ===== */
/* Expand button position - BOTTOM RIGHT (Non-Expanded Note) */
.note:not(.expanded) .note-expand {
  position: absolute !important;
  top: auto !important;
  left: auto !important;
  bottom: 10px !important;
  right: 10px !important;
  z-index: 10 !important;
}

/* Delete button position - BOTTOM LEFT (Non-Expanded Note) */
.note:not(.expanded) .note-delete {
  position: absolute !important;
  top: auto !important;
  right: auto !important;
  bottom: 10px !important;
  left: 10px !important;
  z-index: 10 !important;
}

/* ===== Core Fix for Modal Centering ===== */
/* Set relative positioning ONLY for NON-EXPANDED notes */
.note:not(.expanded) {
  position: relative;
}

/* Styles applying to ALL notes (normal and expanded) */
.note {
  padding-bottom: 40px !important;
  width: 100%;
  box-sizing: border-box;
  background-color: var(--surface-color);
  border-radius: var(--border-radius);
}

/* ===== Expanded Note Positioning ===== */
/* Footer position INSIDE the expanded note */
.note.expanded .note-footer {
  position: absolute !important;
  bottom: 15px !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 10 !important;
  padding: 0 50px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 10px !important;
}

/* Delete button in expanded note */
.note.expanded .note-delete {
  position: fixed !important;
  bottom: 15px !important;
  left: 15px !important;
  top: auto !important;
  right: auto !important;
  z-index: 9002 !important;
  opacity: 1 !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  border-radius: 50%;
  padding: 5px;
}

/* Expanded note expand/collapse button positioning */
.note.expanded .note-expand {
  position: fixed !important;
  bottom: 15px !important;
  right: 15px !important;
  z-index: 9002 !important;
}

/* ===== Category Selection Modal ===== */
.category-selection-list {
  margin-bottom: 15px;
  margin-top: 10px;
}

/* Two-column layout for category selection */
.category-selection-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* Two columns */
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid #e0e0e0;
  border-radius: var(--border-radius);
}

/* Category option styling */
.category-option {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  min-width: 0; /* Force each option to stay in its own cell */
}

.category-option:hover {
  background-color: rgba(98, 0, 238, 0.05);
}

.category-option.selected {
  background-color: rgba(98, 0, 238, 0.1);
}

/* Category option elements */
.category-option-icon {
  margin-right: 8px;
  font-size: 16px;
  flex-shrink: 0; /* Prevent icon from shrinking */
}

.category-option-name {
  flex-grow: 1;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* No categories message */
.no-categories-message {
  padding: 20px;
  text-align: center;
  color: #757575;
  font-style: italic;
}

/* Modal mode-specific styling */
#categoryModal[data-mode="note-category"] .modal-header {
  color: var(--primary-color);
}

#categoryModal[data-mode="note-category"] #categoryInput {
  display: none !important;
}

#categoryModal[data-mode="note-category"] .icon-selector {
  display: none !important;
}

/* ===== Dark Mode Support ===== */
body.dark-mode .note-category {
  background-color: rgba(187, 134, 252, 0.1);
}

body.dark-mode .note-category:hover {
  background-color: rgba(187, 134, 252, 0.2);
}

body.dark-mode .category-selection-options {
  border-color: var(--border-color);
}

body.dark-mode .category-option:hover {
  background-color: rgba(187, 134, 252, 0.05);
}

body.dark-mode .category-option.selected {
  background-color: rgba(187, 134, 252, 0.1);
}

body.dark-mode .no-categories-message {
  color: #aaaaaa;
}

body.dark-mode .note:not(.expanded) .note-delete {
  background-color: transparent !important;
  color: #DADCE0 !important;
  border: none !important;
}

/* ===== Responsive Design ===== */
/* Tablet and small desktops */
@media (max-width: 768px) {
  .note-category-name {
    max-width: 100px;
  }

  .category-option {
    padding: 10px 12px;
  }

  .category-option-icon {
    font-size: 16px;
  }

  .category-option-name {
    font-size: 14px;
  }

  /* Ensure footer layout works on mobile (non-expanded) */
  .note:not(.expanded) .note-footer {
    flex-wrap: wrap !important;
    justify-content: center !important;
    padding: 0 35px !important;
  }
}

/* Small mobile devices */
@media (max-width: 480px) {
  .note-category {
    padding: 3px 6px;
    font-size: 11px;
  }

  .note-category-icon {
    font-size: 12px;
  }

  .note-category-name {
    max-width: 80px;
  }

  /* Adjust delete button size on small screens */
  .note-delete {
    width: 24px !important;
    height: 24px !important;
    font-size: 14px !important;
  }
}

/* Very small mobile devices */
@media (max-width: 400px) {
  .category-selection-options {
    grid-template-columns: 1fr; /* Single column */
  }
}
