/* ======================= Dark Mode Button Fix ======================= */
#showAllBtn, .label-button, .coinButton {
  color: var(--text-primary) !important;
}

/* Selected state for coin buttons */
.coinButton.highlight {
  background-color: #007bff !important;
  color: white !important;
  border-color: #007bff !important;
}

/* Range input styling for dark mode */
input[type="range"] {
  background: transparent;
}

input[type="range"]::-webkit-slider-track {
  background: var(--border-secondary);
  border-radius: 3px;
  height: 4px;
}

input[type="range"]::-webkit-slider-thumb {
  background: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-track {
  background: var(--border-secondary);
  border-radius: 3px;
  height: 4px;
}

input[type="range"]::-moz-range-thumb {
  background: var(--text-primary);
  border: 1px solid var(--border-primary);
  border-radius: 50%;
  cursor: pointer;
  border-width: 1px;
}

/* ======================= CSS Variables ======================= */
:root {
  /* Main colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f9f9f9;
  --bg-tertiary: #efefef;
  --bg-header: #f1f1f1;
  
  /* Text colors */
  --text-primary: #000000;
  --text-secondary: #333333;
  --text-muted: #666666;
  
  /* Border colors */
  --border-primary: #cccccc;
  --border-secondary: #dddddd;
  --border-table: #b7b7b7;
  
  /* Button colors */
  --btn-bg: #ffffff;
  --btn-border: #cccccc;
  --btn-hover: #e0e0e0;
  
  /* Special colors - personality types */
  --bg-type-red: #f4cccc;
  --bg-type-blue: #c9daf8;
  --bg-type-green: #d9ead3;
  
  /* Status colors */
  --status-success: #28a745;
  --status-danger: #dc3545;
  --status-neutral: #6c757d;
  
  /* Status dot colors */
  --dot-submitted: #28a745;
  --dot-unsubmitted: #dc3545;
  --dot-hover: #FFA500;
  
  /* Note action button colors */
  --btn-save-bg: #fee;
  --btn-save-hover: #fdd;
  --btn-submit-bg: #efe;
  --btn-submit-hover: #dfd;
  --btn-delete-bg: #f5f5f5;
  --btn-delete-hover: #e5e5e5;
  
  /* Shadows and overlays */
  --shadow-color: rgba(0, 0, 0, 0.2);
  --tooltip-bg: rgba(0, 0, 0, 0.75);
  
  /* Active states */
  --note-active-bg: #d0ebff;
}

/* Dark theme */
[data-theme="dark"] {
  /* Main colors */
  --bg-primary: #1a1a1a;
  --bg-secondary: #252525;
  --bg-tertiary: #2a2a2a;
  --bg-header: #2d2d2d;
  
  /* Text colors */
  --text-primary: #e0e0e0;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  
  /* Border colors */
  --border-primary: #444444;
  --border-secondary: #555555;
  --border-table: #666666;
  
  /* Button colors */
  --btn-bg: #2a2a2a;
  --btn-border: #444444;
  --btn-hover: #3a3a3a;
  
  /* Special colors - personality types (darker variants) */
  --bg-type-red: #5a3333;
  --bg-type-blue: #334455;
  --bg-type-green: #3a4a3a;
  
  /* Status colors (slightly muted for dark mode) */
  --status-success: #218838;
  --status-danger: #c82333;
  --status-neutral: #5a6268;
  
  /* Status dot colors */
  --dot-submitted: #218838;
  --dot-unsubmitted: #c82333;
  --dot-hover: #FFA500;
  
  /* Note action button colors */
  --btn-save-bg: #4a3333;
  --btn-save-hover: #5a4444;
  --btn-submit-bg: #334a33;
  --btn-submit-hover: #445a44;
  --btn-delete-bg: #3a3a3a;
  --btn-delete-hover: #4a4a4a;
  
  /* Shadows and overlays */
  --shadow-color: rgba(0, 0, 0, 0.5);
  --tooltip-bg: rgba(0, 0, 0, 0.9);
  
  /* Active states */
  --note-active-bg: #3a4a5a;
}

/* ======================= Basic Reset & Layout ======================= */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}
.main-container {
  display: flex;
  padding: 10px;
  flex: 1;
  position: relative;
  overflow: hidden;
}
.video-container {
  flex: 1 1 50%;
  margin-right: 0;
  min-width: 450px;
  overflow: hidden;
}
#player {
  width: 100%;
  height: 400px;
  border: 1px solid var(--border-primary);
}

/* ======================= Person/Video Selector ======================= */
.person-video-selector {
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  margin-bottom: 10px;
  background: var(--bg-secondary);
  overflow: hidden;
}

.selector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-header);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border-primary);
  transition: background 0.2s ease;
}

.selector-header:hover {
  background: var(--btn-hover);
}

.selector-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9rem;
}

.selector-arrow {
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  font-size: 0.8rem;
}

.selector-content {
  padding: 12px;
  display: block;
  transition: all 0.3s ease;
}

.selector-content.collapsed {
  display: none;
}

.selector-row {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.selector-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 200px;
}

.selector-group label {
  font-weight: 500;
  color: var(--text-primary);
  min-width: 50px;
  font-size: 0.85rem;
}

.selector-group select {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.85rem;
  min-width: 120px;
}

.selector-group select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.2);
}

.selector-btn {
  padding: 6px 10px;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: var(--btn-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.selector-btn:hover {
  background: var(--btn-hover);
}

.video-nav-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  padding-top: 8px;
  border-top: 1px solid var(--border-primary);
}

.video-nav-controls button {
  padding: 6px 12px;
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  background: var(--btn-bg);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s ease;
}

.video-nav-controls button:hover:not(:disabled) {
  background: var(--btn-hover);
}

.video-nav-controls button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#videoIndicator {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Mobile optimizations for person-video selector */
@media screen and (max-width: 768px) {
  .person-video-selector {
    margin-bottom: 8px;
  }
  
  .selector-content {
    padding: 8px;
  }
  
  .selector-row {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 8px;
  }
  
  .selector-group {
    min-width: unset;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  
  .selector-group label {
    min-width: unset;
    font-size: 0.8rem;
  }
  
  .selector-group select {
    min-width: unset;
    width: 100%;
  }
  
  .selector-btn {
    align-self: flex-start;
    font-size: 0.8rem;
    padding: 5px 8px;
  }
  
  .video-nav-controls {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  
  .video-nav-controls button {
    width: 100%;
    padding: 8px;
    font-size: 0.85rem;
  }
  
  #videoIndicator {
    text-align: center;
    font-size: 0.8rem;
    padding: 4px 0;
  }
}

/* ======================= Resizer ======================= */
.resizer {
  width: 5px;
  background: var(--border-primary);
  cursor: ew-resize;
  position: relative;
  z-index: 1;
}
.resizer:hover {
  background: var(--text-muted);
}

/* ======================= Draggable Container (Tabs + Filters) ======================= */
.filters-container {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-width: 20%;
  width: 60%;
  overflow: auto;

  margin-top: 10px;
  border: 1px solid var(--border-primary);
  border-radius: 5px;
  background: var(--bg-primary);
  padding: 5px;
}

/* ======================= Various Buttons & Filters ======================= */
.filters {
  margin-bottom: 10px;
}
.filters button {
  display: inline-block;
  margin: 2px 2px;
  padding: 4px 8px;
  min-width: 0;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid var(--border-primary);
  background: var(--btn-bg);
  border-radius: 3px;
  transition: background-color 0.3s, color 0.3s;
}
.filters button.highlight {
  color: #fff;
  border-color: red;
  background-color: red;
}
.filters button:disabled {
  background: var(--bg-tertiary);
  color: darkred;
  cursor: not-allowed;
}
.savior-btn {
  background-color: var(--status-success);
  color: #fff;
}
.demon-btn {
  background-color: var(--status-danger);
  color: #fff;
}
.not-btn {
  background-color: var(--status-neutral);
  color: #fff;
}

/* ======================= Label Buttons ======================= */
#labelButtons {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  gap: 2px;
  margin-top: 10px;
}

#labelButtons button {
  min-width: 70px;
  min-height: 25px;
  text-align: center;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--border-primary);
  background: var(--btn-bg);
  border-radius: 3px;
  transition: background-color 0.3s, color 0.3s;
}

/* Hover effect to give a visual cue when hovering */
.label-button:hover {
  background-color: var(--btn-hover);
}

/* Style for the selected label button */
.label-button.selected {
  background-color: #007bff;
  color: white;
  border-color: #007bff;
  font-weight: bold;
  font-style: italic;
}

/* ======================= Coin Buttons ======================= */
#coinButtons {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, auto);
  gap: 2px;
  margin-top: 10px;
}
.coinButton {
  min-width: 70px;
  min-height: 25px;
  text-align: center;
  font-size: 0.85rem;
  padding: 0;
  cursor: pointer;
  border: 1px solid var(--border-primary);
  background: var(--btn-bg);
  border-radius: 3px;
  transition: background-color 0.3s, color 0.3s;
}

/* Style for the selected label button */
.coinButtons.selected {
  background-color: #007bff;
  border-color: #007bff;
}

/* ======================= Additional Filters ======================= */
#additionalFilters {
  display: flex; /* Changed from column to row */
  flex-direction: row; /* Arrange filters in a row */
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
  align-items: center; /* Vertically center the filters */
}
/* Updated styling for individual filters to fit in one line */
#additionalFilters select,
#additionalFilters input[type="text"] {
  padding: 4px;
  font-size: 0.85rem;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  flex: 1; /* Allow filters to grow equally */
  min-width: 150px; /* Ensure minimum width */
  background: var(--btn-bg);
  color: var(--text-primary);
}
/* Updated Styling for User ID Filter */
#filter_user_id {
  width: 200px; /* Set a fixed width suitable for a dropdown */
  /* Removed height property to make it a standard dropdown */
  padding: 4px;
  font-size: 0.85rem;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--text-primary);
}

/* ======================= Note Section ======================= */
.note-section {
  border: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  padding: 5px;
  margin: 5px 0;
  max-width: 100%;
  border-radius: 5px;
}
.note-section textarea {
  width: 100%;
  margin-top: 5px;
  padding: 8px;
  resize: vertical;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  font-size: 0.85rem;
  min-height: 100px;
  background: var(--btn-bg);
  color: var(--text-primary);
}
.note-actions {
  display: flex;
  gap: 10px;
}

.note-actions button {
    padding: 5px;
}

/* Individual button styles */
#saveNoteBtn {
  background-color: var(--btn-save-bg);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#saveNoteBtn:hover {
  background-color: var(--btn-save-hover);
}

#submitNoteBtn {
  background-color: var(--btn-submit-bg);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#submitNoteBtn:hover {
  background-color: var(--btn-submit-hover);
}

#deleteNoteBtn {
  background-color: var(--btn-delete-bg);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  padding: 6px 12px;
  cursor: pointer;
  transition: background-color 0.3s;
}

#deleteNoteBtn:hover {
  background-color: var(--btn-delete-hover);
}

/* ======================= Top Row: Dropdowns / Start-Stop ======================= */
.note-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.label-dropdowns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.label-dropdowns select {
  padding: 4px;
  font-size: 0.85rem;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  background: var(--btn-bg);
  color: var(--text-primary);
}
.start-stop {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.start-stop div {
  display: flex;
  align-items: center;
}
.start-stop input {
  width: 70px;
  padding: 4px;
  font-size: 0.85rem;
  margin-bottom: 4px;
  margin-right: 6px;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
}

/* ======================= Timeline & Markers ======================= */
.timeline-container {
  width: 100%;
  height: 80px;
  border-top: 2px solid var(--border-primary);
  position: relative;
  margin-top: auto;
  padding-top: 10px;
  background: var(--bg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
}
.timeline {
  width: 90%;
  height: 4px;
  background: var(--border-secondary);
  position: relative;
  cursor: pointer;
  border-radius: 2px;
}
.progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  background: #007bff;
  width: 0%;
  z-index: 1;
  border-radius: 2px;
}
.marker {
  position: absolute;
  top: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  cursor: default;
  transform: translateX(-50%);
  z-index: 2;
}

/* ======================= Tooltip ======================= */
.tooltip {
  position: absolute;
  background: var(--tooltip-bg);
  color: #fff;
  padding: 5px;
  border-radius: 3px;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
  font-size: 12px;
  display: none;
  transform: translate(-50%, -100%);
  width: 200px;
  min-height: 40px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ======================= Notes List ======================= */
#notesList {
  margin-top: 10px;
  max-height: 500px;
  min-height: 200px;
  overflow: auto;
  border: 1px solid var(--border-primary);
  background-color: var(--bg-primary);
  padding: 5px;
  border-radius: 5px;
}
.note-item {
  cursor: pointer;
  padding: 8px;
  border-bottom: 1px solid var(--border-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
  transition: background-color 0.3s;
}
.note-item:hover {
  background-color: var(--bg-tertiary);
}
.note-item span {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-left: 10px;
  flex-shrink: 0;
}

.note-status-dot.submitted {
  background-color: var(--dot-submitted);
}

.note-status-dot.unsubmitted {
  background-color: var(--dot-unsubmitted);
}
.note-item.active {
  background-color: var(--note-active-bg);
}

/* Cross-video notes styling */
.note-item.cross-video {
  opacity: 0.7;
  border-left: 3px solid #007bff;
}

.note-item.cross-video:hover {
  opacity: 1;
}

.video-context {
  color: #007bff;
  font-size: 0.85em;
  font-weight: bold;
}

/* ======================= Bottom Controls ======================= */
.bottom-section {
  padding: 10px;
  border-top: 1px solid var(--border-primary);
  background: var(--bg-header);
  border-radius: 5px 5px 0 0;
}
.controls-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.controls-container button {
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid var(--border-primary);
  background: var(--btn-bg);
  color: var(--text-primary);
  border-radius: 3px;
  transition: background-color 0.3s, color 0.3s;
}

.controls-container button:hover {
  background-color: var(--btn-hover);
}
.controls-container label {
  font-size: 0.85rem;
  color: var(--text-primary);
}
.controls-container input[type="range"] {
  width: 100px;
}

/* ======================= Gear Settings Popup ======================= */
.settings-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 450px;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  padding: 15px;
  z-index: 9999;
  display: none; /* hidden by default */
  box-shadow: 0 2px 10px var(--shadow-color);
}
.settings-popup h3 {
  margin-bottom: 10px;
  font-size: 1rem;
}
.settings-popup .shortcut-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.settings-popup .shortcut-row label {
  width: 180px;
  font-size: 0.85rem;
}
.settings-popup .shortcut-row input[type="text"] {
  flex: 1;
  padding: 3px;
  font-size: 0.85rem;
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  background-color: var(--bg-tertiary);
  color: var(--text-primary);
  cursor: pointer;
}
.settings-popup .shortcut-row input[type="text"]:focus {
  outline: none;
  background-color: var(--btn-bg);
}
.settings-popup .popup-buttons {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ======================= Responsive Adjustments ======================= */
@media (max-width: 768px) {
  .main-container {
    flex-direction: column;
  }
  .resizer {
    width: 100%;
    height: 5px;
    cursor: ns-resize;
  }
  .video-container {
    margin-right: 0;
    min-width: unset !important;
  }
  .filters-container {
    width: 100% !important; /* Occupies full width on smaller screens */
    margin-top: 10px;       /* Keep some top spacing */
  }
  .settings-popup {
    width: 90%; /* Adjust width for smaller screens */
  }
  
  /* When bottom-section is inside video-container on mobile */
  .video-container .bottom-section {
    margin-top: 10px;
    border-top: 1px solid var(--border-primary);
    border-radius: 0;
  }
  
  /* Hide certain buttons on mobile */
  #settingsBtn,
  #exportNotesBtn,
  #darkModeToggle {
    display: none !important;
  }
  
  /* Make controls single line and compact */
  .controls-container {
    flex-wrap: nowrap !important;
    gap: 5px;
  }
  
  .controls-container button {
    padding: 6px 8px;
    font-size: 0.8rem;
    flex-shrink: 1;
    min-width: 0;
  }
  
  /* Show only icons on mobile buttons */
  #prevMarkerBtn {
    font-size: 0;
  }
  #prevMarkerBtn:before {
    content: "◀◀";
    font-size: 0.8rem;
  }
  
  #back5Btn {
    font-size: 0;
  }
  #back5Btn:before {
    content: "⏪";
    font-size: 0.8rem;
  }
  
  #playPauseBtn {
    font-size: 0;
  }
  #playPauseBtn:before {
    content: "►";
    font-size: 0.8rem;
  }
  
  #forward5Btn {
    font-size: 0;
  }
  #forward5Btn:before {
    content: "⏩";
    font-size: 0.8rem;
  }
  
  #nextMarkerBtn {
    font-size: 0;
  }
  #nextMarkerBtn:before {
    content: "▶▶";
    font-size: 0.8rem;
  }
  
  /* Make speed control much smaller - hide text, show only slider */
  .controls-container label {
    font-size: 0;
    margin: 0 5px;
    white-space: nowrap;
  }
  
  #speedRange {
    width: 60px !important;
    flex-shrink: 0;
  }
  
  #speedValue {
    display: none;
  }
  
  /* Make timeline much shorter to save vertical space */
  .timeline-container {
    height: 40px !important;
    padding-top: 5px !important;
    border-top: 1px solid var(--border-primary) !important;
  }
  
  .timeline {
    height: 3px !important;
  }
  
  /* Make start/stop inputs compact on mobile */
  .start-stop input {
    width: 50px !important;
    padding: 5px 4px !important;
    font-size: 0.75rem !important;
    margin: 0 2px !important;
    min-height: 32px !important;
  }
  
  /* When start-stop is moved inside note-actions on mobile */
  .note-actions .start-stop {
    display: flex;
    gap: 5px;
  }
  
  .note-actions {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    padding: 5px 3px !important;
    width: 100%;
  }
  
  /* Push buttons to the right side */
  .note-actions #saveNoteBtn {
    margin-left: auto;
  }
  
  /* Keep buttons grouped together */
  .note-actions #submitNoteBtn,
  .note-actions #deleteNoteBtn {
    margin-left: 8px;
  }
  
  /* Make action buttons compact on mobile */
  .note-actions button {
    padding: 6px 10px !important;
    font-size: 0.8rem !important;
    min-height: 36px !important;
    min-width: 55px !important;
  }
  
  /* Abbreviate personality type buttons on mobile */
  .label-button,
  .coinButton {
    font-size: 0 !important;
  }
  
  /* Optimized for 375px width - ensure all 12 buttons fit */
  #labelButtons {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, auto) !important;
    gap: 1px !important;
    width: 100% !important;
    max-width: 375px !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Compact buttons to fit 375px width */
  .label-button {
    position: relative;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 26px !important;
    padding: 2px 1px !important;
    text-align: center !important;
    border-radius: 2px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    font-size: 0 !important;
    border: 1px solid var(--border-primary) !important;
  }
  
  /* Apply same optimization to coinButtons for 375px width */
  #coinButtons {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-template-rows: repeat(2, auto) !important;
    gap: 1px !important;
    width: 100% !important;
    max-width: 375px !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  
  /* Compact coinButtons to fit 375px width */
  .coinButton {
    position: relative;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 26px !important;
    padding: 2px 1px !important;
    text-align: center !important;
    border-radius: 2px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    font-size: 0 !important;
    border: 1px solid var(--border-primary) !important;
  }
  
  /* Show abbreviated text for compact label buttons */
  .label-button[data-label="Intuition"]:before {
    content: "N";
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Sensing"]:before {
    content: "S"; 
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Observer"]:before {
    content: "O";
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Decider"]:before {
    content: "D";
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Feeling"]:before {
    content: "F";
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Thinking"]:before {
    content: "T";
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Introvert"]:before {
    content: "I";
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Extrovert"]:before {
    content: "E";
    font-size: 0.7rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Di"]:before {
    content: "Di";
    font-size: 0.65rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="De"]:before {
    content: "De";
    font-size: 0.65rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Oi"]:before {
    content: "Oi";
    font-size: 0.65rem;
    color: var(--text-primary);
  }
  
  .label-button[data-label="Oe"]:before {
    content: "Oe";
    font-size: 0.65rem;
    color: var(--text-primary);
  }
  
  /* Ensure selected buttons show white text on mobile */
  .label-button.selected:before {
    color: white !important;
  }
  
  /* Abbreviate coin buttons - need to use nth-child since CSS can't select by text content */
  .coinButton {
    position: relative;
  }
  
  .coinButton:before {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    color: var(--text-primary);
  }
  
  /* Based on the button order in the HTML: Observer, Decider, Di, De, Oi, Oe, Intuition, Sensing, Feeling, Thinking, Introvert, Extrovert */
  #coinButtons .coinButton:nth-child(1):before { content: "O"; } /* Observer */
  #coinButtons .coinButton:nth-child(2):before { content: "D"; } /* Decider */
  #coinButtons .coinButton:nth-child(3):before { content: "Di"; } /* Di */
  #coinButtons .coinButton:nth-child(4):before { content: "De"; } /* De */
  #coinButtons .coinButton:nth-child(5):before { content: "Oi"; } /* Oi */
  #coinButtons .coinButton:nth-child(6):before { content: "Oe"; } /* Oe */
  #coinButtons .coinButton:nth-child(7):before { content: "N"; } /* Intuition */
  #coinButtons .coinButton:nth-child(8):before { content: "S"; } /* Sensing */
  #coinButtons .coinButton:nth-child(9):before { content: "F"; } /* Feeling */
  #coinButtons .coinButton:nth-child(10):before { content: "T"; } /* Thinking */
  #coinButtons .coinButton:nth-child(11):before { content: "Int"; } /* Introvert */
  #coinButtons .coinButton:nth-child(12):before { content: "Ext"; } /* Extrovert */
}

/* ======================= Tabs ======================= */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: 5px;
}
.tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  cursor: pointer;
  border-right: 1px solid var(--border-primary);
  font-weight: bold;
  background-color: var(--bg-secondary);
  transition: background-color 0.3s;
}
.tab:last-child {
  border-right: none;
}
.tab.active {
  background-color: var(--btn-hover);
}
.tabs-content {
  padding: 5px;
}
.hidden {
  display: none;
}
/* Some styling for AI Notes container */
#aiNotesContainer input[type="text"],
#aiNotesContainer input[type="number"] {
  width: 100%;
  max-width: 300px;
  margin-bottom: 10px;
}
#aiNotesContainer button {
  margin-bottom: 10px;
}
#clips {
  margin-top: 10px;
  border-top: 1px solid var(--border-primary);
  padding-top: 10px;
  max-height: 200px;
  overflow-y: auto;
}
.ai-clip-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 3px;
  padding: 8px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}
.ai-clip-item:hover {
  background-color: var(--bg-tertiary);
}
.ai-clip-item strong {
  margin-right: 5px;
}



/* Flex Container Styling */
.tables-container {
  display: flex;
  justify-content: center; /* Centers the tables horizontally */
  align-items: flex-start; /* Aligns tables at the top */
  gap: 20px; /* Space between the tables */
  /* flex-wrap: wrap; */ /* Remove or comment out to prevent wrapping */
  padding: 20px; /* Optional: Adds padding around the tables */
}

/* Vertical stacking when resizer crosses threshold */
.tables-container.vertical-stack {
  flex-direction: column;
  align-items: center;
}

/* Table styling */
.main-table {
  border-spacing: 0;
  border-collapse: collapse;
  text-align: center;
  
  /* Remove width: 100%; and set a specific width */
  width: 450px; /* Adjust as needed */
  
  /* Optional: Add responsive behavior */
  /* max-width: 100%; */
}

/* Responsive Adjustments (Optional) */
@media (max-width: 1000px) {
  .main-table {
    width: 100%; /* Tables will stack on smaller screens */
  }
  .tables-container {
    flex-direction: column;
    align-items: center;
  }
}

.cell, .wide-cell {
  padding: 2pt;
  border: 1px solid var(--border-table);
  vertical-align: top;
  font-size: 10pt;
  color: var(--text-primary);            /* Default text color */
  background-color: var(--bg-tertiary);
  cursor: pointer;
  transition: color 0.2s;
}
.cell { width: 43pt; }
.wide-cell { vertical-align: middle; }

/* Specific background colors */
.bg-f4cccc { background-color: var(--bg-type-red); }
.bg-c9daf8 { background-color: var(--bg-type-blue); }
.bg-d9ead3 { background-color: var(--bg-type-green); }
.bg-efefef { background-color: var(--bg-tertiary); }
.bg-white   { background-color: var(--bg-primary); }

/* Highlight types that appear in filtered notes */
/* No longer using outline - using text visibility instead
.type-highlighted {
  outline: 3px solid #FFD700 !important;
  outline-offset: -3px;
  box-shadow: inset 0 0 5px rgba(255, 215, 0, 0.3);
}
*/

/* New class to hide text within a cell */
.hidden-text {
    color: transparent; /* Hide the text */
    position: relative; /* For positioning pseudo-elements if needed */
    transition: color 0.3s ease; /* Smooth transition */
}

/* Optional: Add a visual indicator that the text is hidden */
.hidden-text::after {
    
    color: #888; /* Placeholder text color */
}

/* Styles for eliminated types based on filtering */
td[data-eliminated="true"] {
    opacity: 0.3;
    transition: opacity 0.3s ease, color 0.3s ease;
}

/* Hover effect for eliminated types to show what they are */
td[data-eliminated="true"]:hover {
    opacity: 0.7;
    color: var(--text-primary) !important;
}

/* Filter indicator styling */
#type-table-filter-indicator {
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#type-table-filter-indicator:hover {
    background: #f57c00 !important;
    transform: scale(1.05);
}
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 8pt;
}
