/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.loading-content {
  text-align: center;
  max-width: 400px;
  padding: 2rem;
}

.loading-logo {
  margin-bottom: 1.5rem;
}

.loading-logo img {
  width: 150px;
  height: 150px;
  border-radius: 0;
  box-shadow: none;
  animation: pulse 2s ease-in-out infinite;
  object-fit: contain;
  background: transparent;
  border: none;
}

.loading-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(135deg, #5865f2, #7289da);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.loading-subtitle {
  font-size: 1.1rem;
  color: #b9bbbe;
  margin: 0 0 2rem 0;
  font-weight: 400;
}

.loading-progress {
  margin-top: 2rem;
}

.loading-bar {
  width: 100%;
  height: 8px;
  background: #40444b;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 1rem;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, #5865f2, #7289da);
  border-radius: 4px;
  width: 0%;
  animation: loadingProgress 2s ease-in-out infinite;
  box-shadow: 0 0 10px rgba(88, 101, 242, 0.5);
}

.loading-text {
  font-size: 0.9rem;
  color: #72767d;
  font-weight: 500;
  animation: loadingText 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: none;
  }
  50% {
    transform: scale(1.05);
    box-shadow: none;
  }
}

@keyframes loadingProgress {
  0% {
    width: 0%;
  }
  50% {
    width: 70%;
  }
  100% {
    width: 100%;
  }
}

@keyframes loadingText {
  0%, 100% {
    opacity: 0.7;
  }
  50% {
    opacity: 1;
  }
}

/* --- SIDEBAR FIXED-HEIGHT HEADER GUARANTEED FIX --- */
.sidebar {
  width: 280px;
  background: #2f3136;
  border-right: 1px solid #202225;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-logo {
  height: 120px; /* Adjust as needed */
  flex-shrink: 0;
  padding: 1rem;
  margin: 1rem 1rem 0.5rem 1rem;
  text-align: center;
  border: 1px solid #4f545c;
  background-color: #fdf6e3;
  border-radius: 8px;
  z-index: 2;
}

.sidebar-header {
  height: 48px;
  padding: 0.25rem 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-tools-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  flex-wrap: nowrap;
  width: 100%;
  overflow-x: visible; /* remove scrolling */
}

.search-container {
  height: 48px; /* Adjust as needed */
  flex-shrink: 0;
  padding: 8px 12px;
  border-bottom: 1px solid #202225;
  background: #2f3136;
  position: relative;
  z-index: 2;
}

#foldersContainer {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  padding: 10px 10px 20px 10px;
  z-index: 1;
  margin: 0;
}

.root-drop-zone {
  flex-shrink: 0;
  height: 40px;
  margin: 8px 12px;
  border: 2px dashed #40444b;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(64, 68, 75, 0.1);
  transition: all 0.2s ease;
  cursor: pointer;
  opacity: 0.6;
  z-index: 2;
}

.root-drop-zone:hover {
  border-color: #5865f2;
  background: rgba(88, 101, 242, 0.1);
  opacity: 1;
}

.root-drop-zone.drag-over {
  border-color: #57f287;
  background: rgba(87, 242, 135, 0.1);
  transform: scale(1.02);
  opacity: 1;
}

.root-drop-content {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #72767d;
  font-size: 0.8rem;
  font-weight: 500;
}

.root-drop-zone:hover .root-drop-content {
  color: #5865f2;
}

.root-drop-zone.drag-over .root-drop-content {
  color: #57f287;
}

.root-drop-content svg {
  width: 14px;
  height: 14px;
}
/* --- END SIDEBAR FIXED-HEIGHT HEADER GUARANTEED FIX --- */

.sidebar-top,
.sidebar-logo,
.sidebar-header,
.search-container {
  display: block !important;
  height: auto !important;
  min-height: 40px !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: static !important;
}
/* --- END FORCE VISIBILITY --- */

.sidebar-logo {
  background: #fdf6e3 !important;
}
.sidebar-header {
  background: #36393f !important;
}
.search-container {
  background: #2f3136 !important;
}
#foldersContainer {
  background: none !important;
}
/* --- END DIAGNOSTIC COLORS --- */

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  padding: 0;
  margin: 0;
  background: #1e1e1e;
  color: #dcddde;
}

.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar-logo img {
  max-width: 60%;
  height: auto;
}

.sidebar-logo .tagline {
  margin: 0.5rem 0 0.25rem 0;
  font-size: 0.8rem;
  color: #333;
  font-style: italic;
}

.sidebar-logo .version {
  margin: 0 0 0.5rem 0;
  font-size: 0.7rem;
  color: #72767d;
  text-align: center;
  font-family: monospace;
  opacity: 0.8;
}

.update-check-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #40444b;
  border: 1px solid #4f545c;
  color: #dcddde;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
  margin: 8px 0;
  transition: all 0.2s ease;
  width: 100%;
  justify-content: center;
}

.update-check-btn:hover {
  background: #4f545c;
  border-color: #5a5e66;
}

.update-check-btn svg {
  width: 12px;
  height: 12px;
}

.update-check-btn.loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.update-check-btn.loading svg {
  animation: spin 1s linear infinite;
}

.kofi-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #ff5f5f, #ff7b7b);
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 500;
  margin: 0.5rem 0 1rem 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(255, 95, 95, 0.2);
}

.kofi-link:hover {
  background: linear-gradient(135deg, #ff4444, #ff6666);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(255, 95, 95, 0.3);
  text-decoration: none;
  color: white;
}

.kofi-link svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: currentColor;
}

.sidebar-header .vr {
  width: 1px;
  height: 24px;
  background-color: #40444b;
  margin: 0 4px;
  align-self: center;
}

.search-container input {
  width: 100%;
  background: #40444b;
  border: 1px solid #202225;
  border-radius: 4px;
  padding: 8px 32px 8px 10px;
  color: #dcddde;
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
}

.search-container input:focus {
  border-color: #5865f2;
  background: #36393f;
}

.search-container input::placeholder {
  color: #72767d;
}

.search-clear-btn {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #72767d;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  line-height: 1;
  display: block;
  z-index: 2;
}

.search-clear-btn:hover {
  color: #dcddde;
  background: #40444b;
}

.search-clear-btn.visible {
  display: block;
}

.search-clear-btn svg {
  width: 16px;
  height: 16px;
}

.sidebar-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #ffffff;
}

.action-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: #36393f;
  border: 1px solid #4f545c;
  border-radius: 4px;
  color: #dcddde;
  transition: all 0.2s ease;
}
.action-button:hover {
  background-color: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.action-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  vertical-align: middle;
}

.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-content {
  display: none;
  position: fixed;
  background-color: #2f3136;
  min-width: 200px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
  z-index: 1000;
  border: 1px solid #202225;
  border-radius: 4px;
  max-width: calc(100vw - 20px);
  margin-top: 2px;
}

/* Ensure dropdown doesn't go off-screen */
.dropdown-content.position-left {
  transform: translateX(-100%);
}
.dropdown-content a {
  color: #dcddde;
  padding: 10px 14px;
  text-decoration: none;
  display: block;
  font-size: 0.9rem;
}
.dropdown-content a:hover {
  background-color: #40444b;
}
.dropdown-content a.active {
  background-color: #5865f2;
  color: white;
}

/* The old #foldersContainer rule will be replaced by the one above */

.tree-item {
  padding: 4px 8px;
  border-radius: 4px;
  user-select: none;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

.tree-item-header {
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}
.tree-item-header:hover {
  background-color: #36393f;
}
.tree-item-header.drag-over {
  background-color: #40444b;
  border: 1px dashed #5865f2;
}

.tree-item-actions {
  display: flex;
}

.tree-item-actions button {
  background: #36393f;
  border: 1px solid #4f545c;
  color: #b9bbbe;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
}
.tree-item-actions button:hover {
  background-color: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.tree-item-actions button svg {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

.tree-toggle {
  width: 16px;
  text-align: center;
  margin-right: 4px;
  color: #72767d;
}

.tree-name {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-item-children {
  padding-left: 20px;
}

.snippet-item {
  padding-left: 16px; /* Indent snippets */
  background-color: #282a36;
  border-radius: 4px;
  margin-top: 2px;
  margin-bottom: 2px;
}
.snippet-item:hover {
  background-color: #36393f;
  cursor: grab;
}

/* Character snippet styling */
.character-snippet {
  background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%) !important;
  border-left: 3px solid #e53e3e;
  position: relative;
}

.character-snippet:hover {
  background: linear-gradient(135deg, #5a6578 0%, #3d4758 100%) !important;
  border-left-color: #fc8181;
}

.character-indicator {
  color: #e53e3e !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.character-indicator i {
  color: #e53e3e;
  filter: drop-shadow(0 0 2px rgba(229, 62, 62, 0.3));
}

/* Character snippet text styling */
.character-snippet .snippet-text {
  font-weight: 600;
  color: #f7fafc;
  font-size: 14px;
}

.character-snippet .snippet-tags {
  font-size: 12px;
  opacity: 0.8;
  color: #e2e8f0;
  font-style: italic;
}

.snippet-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.snippet-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.tag {
  background-color: #4f545c;
  color: #dcddde;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.inline-edit-input {
  width: 100%;
  background-color: #40444b;
  border: 1px solid #5865f2;
  color: #dcddde;
  font-family: inherit;
  font-size: inherit;
  padding: 3px 7px;
  border-radius: 4px;
  outline: none;
  box-sizing: border-box;
}

.sidebar-buttons {
  padding: 0.75rem 1rem;
  border-top: 1px solid #202225;
  background: #36393f;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.sidebar-buttons button {
  padding: 0.4rem 0.6rem;
  background: #4f545c;
  color: #ffffff;
  border: 1px solid #5d6269;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-buttons button:hover {
  background: #5d6269;
  border-color: #6d737a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: #36393f;
  transition: margin-left 0.3s ease;
}

.board-header {
  background: linear-gradient(135deg, #2f3136 0%, #36393f 100%);
  border-bottom: 2px solid #40444b;
  padding: 0.75rem 1.25rem;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.board-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #007acc, #00b894, #f39c12);
  opacity: 0.7;
}

.header-container {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.board-section {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 140px;
  flex: 0 0 auto;
  padding: 0.6rem 0.8rem;
  background: rgba(47, 49, 54, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(79, 84, 92, 0.3);
  margin-right: 0.75rem;
  transition: all 0.2s ease;
  position: relative;
}

.board-section:hover {
  background: rgba(47, 49, 54, 0.8);
  border-color: rgba(79, 84, 92, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Make Reference Images section take up more space */
.reference-images-section {
  flex: 1;
  min-width: 200px;
}

.section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: #99aab5;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.2rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid rgba(79, 84, 92, 0.4);
  text-align: left;
}

.section-controls {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
}

.control-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: auto;
  flex: 0 0 auto;
  justify-content: flex-start;
  padding: 0.2rem;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.control-group:hover {
  background: rgba(79, 84, 92, 0.1);
}

.control-description {
  font-size: 0.6rem;
  color: #72767d;
  text-align: center;
  line-height: 1.1;
  max-width: 110px;
  font-weight: 400;
  white-space: normal;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #36393f;
  border: 1px solid #4f545c;
  border-radius: 6px;
  color: #dcddde;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 100px;
  justify-content: flex-start;
  height: 32px;
  box-sizing: border-box;
  margin: 0;
  line-height: 1;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.control-btn:hover {
  background: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.control-btn.primary {
  background: linear-gradient(135deg, #4f545c, #36393f);
  border-color: #5d6269;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-btn.primary:hover {
  background: linear-gradient(135deg, #5d6269, #4f545c);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.control-btn.secondary {
  background: #36393f;
  border-color: #4f545c;
  color: #dcddde;
}

.control-btn.secondary:hover {
  background: #da373c;
  border-color: #da373c;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(218, 55, 60, 0.2);
}

.control-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.control-btn span {
  font-weight: 500;
}

/* Board Select Dropdown Styling */
.board-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  background: #36393f;
  border: 1px solid #4f545c;
  border-radius: 6px;
  color: #dcddde;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-width: 100px;
  justify-content: flex-start;
  font-family: inherit;
  height: 32px;
  box-sizing: border-box;
  margin: 0;
  line-height: 1;
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
}

.board-select:hover {
  background: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.board-select:focus {
  outline: none;
  border-color: #007acc;
  background: #4f545c;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(0, 122, 204, 0.2);
}

.board-select option {
  background: #2a2a2a;
  color: #dcddde;
  padding: 8px;
}

/* Ensure board select dropdown matches control button styling exactly */
.board-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23dcddde' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  padding-right: 32px;
  vertical-align: top;
  position: relative;
  top: 0;
}

.board-tags-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-left: auto;
  padding-left: 1rem;
}

.board-tags-label {
  color: #dcddde;
  font-size: 0.8rem;
  font-weight: 500;
  margin-right: 6px;
  white-space: nowrap;
}

.board-tags-display .board-tag {
  background: rgba(255, 168, 0, 0.2);
  color: #ffa500;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid rgba(255, 168, 0, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  user-select: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.board-tags-display .board-tag:hover {
  background: rgba(255, 168, 0, 0.3);
  border-color: rgba(255, 168, 0, 0.6);
  color: #ffb733;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.board-container {
  flex: 1;
  padding: 0.75rem 1.25rem 0.75rem 0.75rem;
  overflow: visible;
  position: relative;
}

.board-layout {
  display: flex;
  gap: 0.75rem;
  height: 100%;
  overflow: visible;
}

/* Ensure the prompt board takes full height */
.prompt-board {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.prompt-board {
  flex: 1;
  min-width: 0;
}

.prompt-board {
  width: 100%;
  height: 100%;
  background: #2f3136;
  border: 2px dashed #40444b;
  border-radius: 8px;
  position: relative;
  overflow: auto;
  min-height: 350px;
  padding: 0.75rem;
}

/* Reference Images Container */
.reference-images-container {
  padding: 0.6rem;
  background: rgba(47, 49, 54, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(79, 84, 92, 0.2);
  min-height: 140px;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.reference-images-container:empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.reference-images-container:empty::before {
  content: 'No reference images added yet. Click "Images" above to add images.';
  color: #72767d;
  font-style: italic;
  font-size: 0.8rem;
  text-align: center;
  max-width: 250px;
  line-height: 1.3;
}

.reference-images-container:not(:empty)::before {
  content: 'Reference Images';
  color: #99aab5;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.25rem;
}

.reference-images-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: flex-start;
  justify-content: flex-start;
}

.board-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #72767d;
  font-size: 1rem;
  text-align: center;
  pointer-events: none;
}

.board-card {
  position: absolute;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  border: 1px solid #4f545c;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s ease;
  min-width: 220px; /* Ensure minimum width to prevent icon overflow (matches JS resize limit) */
  min-height: 140px; /* Ensure minimum height for proper layout (matches JS resize limit) */
  overflow: hidden; /* Ensure content stays within boundaries */
  box-sizing: border-box;
}

.board-card:hover {
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.board-card.locked {
  background: #2d3748;
  border-color: #5865f2;
}

.board-card .card-header {
  padding: 6px 10px;
  font-weight: 600;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  line-height: 1.2;
}

.board-card .card-header .tag-item {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
  user-select: none;
}

.board-card .card-header .tag-item:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  color: rgba(255, 255, 255, 1);
}

.board-card .card-header .tag-separator {
  color: rgba(255, 255, 255, 0.6);
  font-weight: normal;
  margin: 0 2px;
}

.board-card .card-content {
  padding: 6px 10px;
  flex-grow: 1;
  overflow: auto;
  font-size: 13px;
  word-wrap: break-word;
  line-height: 1.4;
}

.board-card .card-actions {
  display: flex;
  justify-content: flex-end;
  padding: 6px 10px;
  gap: 4px;
  overflow: hidden; /* Prevent icons from overflowing */
  flex-shrink: 0; /* Prevent actions from shrinking */
  min-height: 28px; /* Ensure minimum height for buttons */
  box-sizing: border-box; /* Include padding in width calculations */
}

.resize-handle {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 1L1 11' stroke='%23B9BBBE' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M6 1L1 6' stroke='%23B9BBBE' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M11 6L6 11' stroke='%23B9BBBE' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E%0A");
  background-repeat: no-repeat;
  background-position: bottom right;
  cursor: se-resize;
  opacity: 0.6;
  z-index: 999;
  /* Ensure resize handle doesn't interfere with actions */
  pointer-events: auto;
}

/* Make sure resize handle doesn't overlap actions on small cards */
.board-card.min-width .resize-handle {
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
}

.resize-handle:hover {
  opacity: 1;
}

.board-card.locked .resize-handle {
  display: none;
}

.compiled-prompt {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid #202225;
  background: #2f3136;
  position: relative;
  transition: all 0.3s ease;
}

.compiled-prompt-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 0.4rem;
  position: relative;
}

.compiled-prompt h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  position: absolute;
  left: 0;
}

.expand-button {
  background: #36393f;
  border: 1px solid #4f545c;
  color: #dcddde;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  margin: 0;
  transition: all 0.2s ease;
}

.expand-button:hover {
  background: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.expand-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.compiled-prompt-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Expanded state */
.compiled-prompt.expanded {
  position: fixed;
  top: 60px; /* Leave space at top for the shrink button to be visible */
  left: 320px; /* Account for default sidebar width */
  right: 0;
  bottom: 0;
  z-index: 999;
  padding: 2rem;
  border: 1px solid #4f545c;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

/* Adjust position when sidebar is expanded */
.sidebar.sidebar-expanded ~ .main-content .compiled-prompt.expanded {
  left: 480px; /* Account for expanded sidebar width */
}

.compiled-prompt.expanded .compiled-prompt-output {
  flex: 1;
  height: auto;
  min-height: 200px;
  max-height: none;
}

.compiled-prompt.expanded .compiled-prompt-header {
  margin-bottom: 1rem;
}

.compiled-prompt.expanded .compiled-prompt-buttons {
  margin-top: 1rem;
  justify-content: flex-start;
}

.compiled-prompt textarea {
  width: 100%;
  height: 100px;
  margin-bottom: 0.5rem;
  resize: vertical;
  background: #40444b;
  border: 1px solid #4f545c;
  border-radius: 4px;
  color: #dcddde;
  padding: 0.75rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.4;
}

.compiled-prompt textarea:focus {
  outline: none;
  border-color: #5865f2;
}

button {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  background: #4f545c;
  color: #ffffff;
  border: 1px solid #5d6269;
  border-radius: 4px;
  font-weight: 500;
  transition: all 0.2s ease;
}

button:hover {
  background: #5d6269;
  border-color: #6d737a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #2f3136;
  border: 1px solid #4f545c;
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 400px;
  max-width: 500px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}

.modal-content h3 {
  margin: 0 0 20px 0;
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
}

/* Modal Form Styling */
.modal-content label {
  display: block;
  margin-bottom: 5px;
  margin-top: 15px;
  font-weight: bold;
  color: #dcddde;
  font-size: 0.9rem;
}

.modal-content label:first-of-type {
  margin-top: 0;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid #4f545c;
  border-radius: 4px;
  background: #40444b;
  color: #dcddde;
  font-size: 0.9rem;
  margin-bottom: 15px;
  font-family: inherit;
}

.modal-content textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.4;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 1px #5865f2;
}

.modal-content .modal-buttons {
  margin-top: 20px;
  margin-bottom: 0;
}

/* Folder selector with new folder button */
.folder-selector-container {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 15px;
}

.folder-selector-container select {
  flex: 1;
  margin-bottom: 0;
}

.small-button {
  background: #4f545c;
  border: 1px solid #5d6269;
  color: #ffffff;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  transition: all 0.2s ease;
}

.small-button:hover {
  background: #5d6269;
  border-color: #6d737a;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.small-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.small-button.secondary {
  background: #36393f;
  border-color: #4f545c;
  color: #dcddde;
}

.small-button.secondary:hover {
  background: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
}

/* Inline folder creation */
.inline-folder-creation {
  margin-bottom: 15px;
  padding: 12px;
  background: #36393f;
  border: 1px solid #4f545c;
  border-radius: 6px;
}

.inline-folder-creation label {
  margin-top: 0;
  margin-bottom: 8px;
  color: #dcddde;
  font-size: 0.85rem;
}

.inline-folder-input-container {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-folder-input-container input {
  flex: 1;
  margin-bottom: 0;
  font-size: 0.9rem;
  padding: 6px 10px;
}

textarea {
  width: 100%;
  height: 100px;
  margin-bottom: 1rem;
  resize: vertical;
  background: #40444b;
  border: 1px solid #4f545c;
  border-radius: 4px;
  color: #dcddde;
  padding: 0.75rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.4;
}

textarea:focus {
  outline: none;
  border-color: #5865f2;
}

input,
select {
  padding: 0.75rem;
  border: 1px solid #4f545c;
  border-radius: 4px;
  background: #40444b;
  color: #dcddde;
  font-size: 0.9rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: #5865f2;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #2f3136;
}

::-webkit-scrollbar-thumb {
  background: #4f545c;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #5d6269;
}

.card-color-picker {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  background-color: transparent;
}
.card-color-picker::-webkit-color-swatch {
  border-radius: 50%;
  border: 1px solid #4f545c;
}
.card-color-picker::-moz-color-swatch {
  border-radius: 50%;
  border: 1px solid #4f545c;
}

.board-card .card-actions button {
  background: #36393f;
  border: 1px solid #4f545c;
  color: #b9bbbe;
  padding: 4px;
  border-radius: 3px;
  cursor: pointer;
  line-height: 1;
  transition: all 0.2s ease;
  min-width: 24px; /* Ensure minimum clickable area */
  min-height: 24px;
  flex-shrink: 0; /* Prevent buttons from shrinking too much */
  overflow: hidden; /* Hide any content that might overflow */
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}

.board-card .card-actions button:hover {
  background: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.board-card .card-actions button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  vertical-align: middle;
}

/* Better containment for card actions at minimum size */
.board-card .card-actions {
  /* Ensure actions wrap if needed on very narrow cards */
  flex-wrap: wrap;
}

/* When card is at minimum width, center the actions */
.board-card.min-width .card-actions {
  justify-content: center;
  gap: 3px;
}

.board-card.min-width .card-actions button {
  min-width: 22px;
  min-height: 22px;
  padding: 3px;
}

.board-card.min-width .card-actions button svg {
  width: 13px;
  height: 13px;
}

.compiled-prompt-output {
  width: 100%;
  height: 120px;
  margin-bottom: 0.5rem;
  resize: vertical;
  overflow-y: auto;
  background: #40444b;
  border: 1px solid #4f545c;
  border-radius: 4px;
  color: #dcddde;
  padding: 0.75rem;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  box-sizing: border-box;
}

.compiled-prompt-output:focus {
  outline: none;
  border-color: #5865f2;
}

.compiled-prompt-output span {
  padding: 0.1em 0.3em;
  border-radius: 3px;
  display: inline;
  line-height: 1.6;
}

#deleteDropZone.drag-over {
  background-color: #da373c;
  color: #ffffff;
}

.header-tool.drag-over {
  background-color: rgba(218, 55, 60, 0.2);
  border-radius: 8px;
  padding: 4px;
  margin: -4px;
}

.header-tool.drag-over .header-tool-label {
  color: #da373c;
  font-weight: bold;
}

.header-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  position: relative;
}

.header-tool-label {
  display: none;
}
.header-tool:hover .header-tool-label {
  display: flex;
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  background: #36393f;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  white-space: nowrap;
  z-index: 10;
  margin-left: 8px;
  font-size: 0.75rem;
}

.folder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  position: relative;
  padding: 2px 0;
}

.folder-header-left {
  display: flex;
  align-items: center;
  flex-grow: 1;
  overflow: hidden;
}

.folder-header .folder-icon {
  margin-right: 6px;
  color: #96989d;
  width: 18px;
  height: 18px;
}

.folder-header-left .collapse-icon {
  width: 20px;
  height: 20px;
  color: #72767d;
  flex-shrink: 0;
}

.folder-header-left span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.folder-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-left: 8px;
  gap: 1px; /* much tighter spacing between buttons */
  justify-content: flex-end;
  padding-right: 12px; /* keep space from sidebar edge */
}

.folder-actions button {
  background: none;
  border: none;
  color: #b9bbbe;
  padding: 0;
  border-radius: 4px;
  cursor: pointer;
  line-height: 1;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.folder-actions button svg {
  width: 14px;
  height: 14px;
  vertical-align: middle;
}

.folder .folder-content {
  padding-left: 22px; /* This creates the indentation */
}

.folder.collapsed .folder-content {
  display: none; /* Hide children when collapsed */
}

/* Make sure the hover effect covers the whole folder item */
.folder {
  padding: 2px 0;
}

.folder-header:hover {
  background-color: #36393f;
}
.folder-header.drag-over {
  background-color: #40444b;
  outline: 1px dashed #5865f2;
}

/* Context Menu */
.context-menu {
  position: fixed;
  background: #2f3136;
  border: 1px solid #4f545c;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  min-width: 180px;
  overflow: hidden;
  z-index: 999999;
}

.context-menu-item {
  padding: 8px 12px;
  color: #dcddde;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  transition: background-color 0.1s ease;
}

.context-menu-item:hover {
  background-color: #40444b;
}

.context-menu-item svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
}

.context-menu-separator {
  height: 1px;
  background: #4f545c;
  margin: 4px 0;
}

/* Text Selection Toolbar */
.text-selection-toolbar {
  position: fixed;
  background: #2f3136;
  border: 1px solid #202225;
  border-radius: 6px;
  padding: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  display: none;
  gap: 8px;
}

.text-selection-toolbar button {
  background: #36393f;
  border: 1px solid #40444b;
  color: #dcddde;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.text-selection-toolbar button:hover {
  background: #40444b;
  border-color: #5865f2;
  color: #ffffff;
}

.text-selection-toolbar button svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

/* Allow text selection in card content */
.board-card .card-content {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  cursor: text !important;
  position: relative;
  pointer-events: auto !important;
}

.board-card .card-content:hover {
  background: rgba(255, 255, 255, 0.02);
}

.board-card .card-content * {
  user-select: text !important;
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
}

.board-card .card-content::selection {
  background: #5865f2;
  color: white;
}

/* Make header clearly draggable */
.board-card .card-header {
  cursor: move;
  user-select: none;
  position: relative;
}

.board-card .card-header::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.05);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.board-card .card-header:hover::after {
  opacity: 1;
}

.board-card .card-header:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Toast Notifications */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #2f3136;
  color: #dcddde;
  padding: 12px 20px;
  border-radius: 6px;
  border: 1px solid #4f545c;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
  max-width: 300px;
  word-wrap: break-word;
}

.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.toast-success {
  border-color: #28a745;
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
}

.toast-error {
  border-color: #dc3545;
  background: linear-gradient(135deg, #dc3545, #fd7e14);
  color: white;
}

.toast-info {
  border-color: #5865f2;
  background: linear-gradient(135deg, #5865f2, #7289da);
  color: white;
}

/* Color Picker Modal */
.color-picker-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.color-picker-content {
  background: #36393f;
  border: 1px solid #202225;
  border-radius: 8px;
  padding: 1.5rem;
  min-width: 320px;
  max-width: 400px;
}

.color-picker-content h3 {
  margin: 0 0 1rem 0;
  color: #ffffff;
  font-size: 1.1rem;
  text-align: center;
}

.color-picker-wheel {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto 1rem auto;
  border-radius: 50%;
  background: conic-gradient(
    hsl(0, 100%, 50%),
    hsl(30, 100%, 50%),
    hsl(60, 100%, 50%),
    hsl(90, 100%, 50%),
    hsl(120, 100%, 50%),
    hsl(150, 100%, 50%),
    hsl(180, 100%, 50%),
    hsl(210, 100%, 50%),
    hsl(240, 100%, 50%),
    hsl(270, 100%, 50%),
    hsl(300, 100%, 50%),
    hsl(330, 100%, 50%),
    hsl(360, 100%, 50%)
  );
  cursor: crosshair;
}

.color-picker-wheel::before {
  content: '';
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  bottom: 20px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 1) 0%,
    rgba(255, 255, 255, 0) 70%
  );
}

.color-picker-wheel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 1) 100%
  );
}

.color-picker-pointer {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  pointer-events: none;
  z-index: 10;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.color-picker-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.color-preview-box {
  width: 60px;
  height: 40px;
  border: 2px solid #202225;
  border-radius: 4px;
  background: #ff0000;
}

.color-hex-input {
  flex: 1;
  background: #40444b;
  border: 1px solid #202225;
  border-radius: 4px;
  padding: 8px 10px;
  color: #dcddde;
  font-family: monospace;
  font-size: 0.9rem;
}

.color-hex-input:focus {
  border-color: #5865f2;
  outline: none;
}

.color-picker-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1rem;
}

.color-picker-buttons button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background-color 0.2s;
}

.color-picker-buttons .cancel-btn {
  background: #4f545c;
  color: #dcddde;
}

.color-picker-buttons .cancel-btn:hover {
  background: #5d6269;
}

.color-picker-buttons .apply-btn {
  background: #5865f2;
  color: #ffffff;
}

.color-picker-buttons .apply-btn:hover {
  background: #4752c4;
}

/* Preset Colors Section */
.preset-colors-section {
  margin-bottom: 20px;
}

.preset-colors-section h4 {
  margin: 0 0 12px 0;
  color: #dcddde;
  font-size: 0.9em;
  font-weight: 500;
}

.preset-colors-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.preset-color {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.preset-color:hover {
  background: rgba(88, 101, 242, 0.1);
  border-color: #5865f2;
}

.preset-color.selected {
  background: rgba(88, 101, 242, 0.2);
  border-color: #5865f2;
}

.preset-color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid #40444b;
  transition: all 0.2s ease;
}

.preset-color:hover .preset-color-swatch {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.preset-color span {
  font-size: 0.7em;
  color: #72767d;
  text-align: center;
  line-height: 1.2;
}

/* Custom Color Section */
.custom-color-section {
  margin-bottom: 20px;
}

.custom-color-section h4 {
  margin: 0 0 12px 0;
  color: #dcddde;
  font-size: 0.9em;
  font-weight: 500;
}

/* Reset Button */
.color-picker-buttons .reset-btn {
  background: #40444b;
  color: #dcddde;
  border: 1px solid #555;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85em;
  transition: all 0.2s ease;
}

.color-picker-buttons .reset-btn:hover {
  background: #555;
  border-color: #666;
}

/* Reference Image Styles */
.board-images-container {
  margin: 1rem 0;
  background: #36393f;
  border: 1px solid #202225;
  border-radius: 8px;
  padding: 1rem;
}

.board-images-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.board-images-header h4 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
}

.toggle-images-btn {
  background: #4f545c;
  border: none;
  color: #dcddde;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toggle-images-btn:hover {
  background: #5d6269;
}

.toggle-images-btn svg {
  width: 16px;
  height: 16px;
}

.board-images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.image-card {
  background: #2f3136;
  border: 1px solid #202225;
  border-radius: 6px;
  overflow: hidden;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  position: relative;
}

.image-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.image-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.image-card-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-card:hover .image-card-actions {
  opacity: 1;
}

.image-card-actions button {
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: #ffffff;
  padding: 4px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-card-actions button:hover {
  background: rgba(0, 0, 0, 0.9);
}

.image-card-actions button svg {
  width: 14px;
  height: 14px;
}

.image-card-filename {
  padding: 8px;
  font-size: 0.8rem;
  color: #b9bbbe;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Image Viewer Modal */
.image-viewer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3000;
  cursor: pointer;
}

.image-viewer-content {
  background: #36393f;
  border: 1px solid #202225;
  border-radius: 8px;
  padding: 1rem;
  max-width: 90vw;
  max-height: 90vh;
  cursor: default;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.image-viewer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #202225;
}

.image-viewer-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
}

.image-viewer-header button {
  background: #4f545c;
  border: none;
  color: #dcddde;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-viewer-header button:hover {
  background: #5d6269;
}

.image-viewer-header button svg {
  width: 16px;
  height: 16px;
}

.image-viewer-content img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 4px;
}

.image-viewer-info {
  color: #b9bbbe;
  font-size: 0.8rem;
  text-align: center;
  padding-top: 0.5rem;
  border-top: 1px solid #202225;
}

/* Image Preview Tooltip */
.image-preview-tooltip {
  position: fixed;
  background: #36393f;
  border: 1px solid #202225;
  border-radius: 8px;
  padding: 16px;
  z-index: 2000;
  pointer-events: none;
  max-width: 95vw;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Horizontal preview layout (multiple thumbnails) */
.preview-images.horizontal-preview {
  display: flex;
  flex-direction: row;
  gap: 16px;
  align-items: center;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 8px;
}

.preview-images.horizontal-preview::-webkit-scrollbar {
  height: 4px;
}

.preview-images.horizontal-preview::-webkit-scrollbar-track {
  background: #202225;
  border-radius: 2px;
}

.preview-images.horizontal-preview::-webkit-scrollbar-thumb {
  background: #4f545c;
  border-radius: 2px;
}

.preview-images.horizontal-preview::-webkit-scrollbar-thumb:hover {
  background: #5d6269;
}

.preview-image-wrapper {
  position: relative;
  flex-shrink: 0;
}

.image-preview-tooltip .preview-thumbnail {
  width: 300px !important;
  height: 300px !important;
  object-fit: cover !important;
  border-radius: 8px !important;
  border: 3px solid #202225 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
  background: #2f3136 !important;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease !important;
  cursor: pointer !important;
}

.image-preview-tooltip .preview-thumbnail:hover {
  transform: scale(1.3) !important;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5) !important;
  border-color: #7289da !important;
  z-index: 100 !important;
  position: relative !important;
}

.preview-image-info.horizontal-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.preview-count-info {
  font-size: 0.8rem;
  color: #7289da;
  font-weight: 500;
  text-align: center;
}

/* Legacy single image preview styles (kept for backward compatibility) */
.preview-images.primary-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.preview-main-image {
  max-width: 200px;
  max-height: 200px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #202225;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  background: #2f3136;
}

.preview-image-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-filename {
  font-size: 0.8rem;
  font-weight: 500;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.preview-meta {
  font-size: 0.7rem;
  color: #b9bbbe;
}

.preview-count {
  font-size: 0.7rem;
  color: #7289da;
  font-weight: 500;
}

/* Legacy multi-image preview layout */
.preview-images:not(.primary-preview):not(.horizontal-preview) {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.preview-images:not(.primary-preview):not(.horizontal-preview) img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #202225;
}

.more-images {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: #2f3136;
  border: 1px solid #202225;
  border-radius: 4px;
  font-size: 0.7rem;
  color: #b9bbbe;
  text-align: center;
}

/* Board Image Indicator */
.board-image-indicator {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  color: #7289da;
  font-size: 0.8rem;
}

.board-image-indicator svg {
  width: 14px;
  height: 14px;
}

/* Enhanced Reference Image Thumbnails */
.reference-image-thumb {
  position: relative;
  width: 120px;
  height: 120px;
  background: #23272e;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(79, 84, 92, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
}

.reference-image-thumb:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border-color: rgba(79, 84, 92, 0.6);
}

.reference-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.reference-image-thumb:hover img {
  transform: scale(1.05);
}

/* Controls Overlay */
.controls-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  transition: opacity 0.3s ease;
  box-sizing: border-box;
}

.reference-image-thumb:hover .controls-overlay {
  opacity: 1;
}

.controls-overlay button {
  position: absolute;
  background: rgba(79, 84, 92, 0.8);
  border: none;
  color: white;
  border-radius: 4px;
  padding: 0.3rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
}

.controls-overlay button:hover {
  background: rgba(79, 84, 92, 1);
}

.controls-overlay button svg {
  width: 14px;
  height: 14px;
}

/* Position expand button at top-left */
.controls-overlay button:first-child {
  top: 0.3rem;
  left: 0.3rem;
}

/* Position remove button at bottom-left */
.controls-overlay button:last-child {
  bottom: 0.3rem;
  left: 0.3rem;
}

.controls-overlay .remove-btn:hover {
  background: rgba(220, 53, 69, 0.8) !important;
}

/* Add Image Button Styling */
#addImageBtn {
  background: #5865f2;
  border: none;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

#addImageBtn:hover {
  background: #4752c4;
}

#addImageBtn svg {
  width: 16px;
  height: 16px;
}

/* Board Modal Image Upload Section */
.board-images-section {
  margin: 1rem 0;
}

.board-images-upload-area {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.add-board-image-btn {
  background: #5865f2;
  border: none;
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.add-board-image-btn:hover {
  background: #4752c4;
}

.add-board-image-btn.disabled {
  background: #72767d;
  cursor: not-allowed;
}

.add-board-image-btn svg {
  width: 16px;
  height: 16px;
}

.image-count-display {
  font-size: 0.9rem;
  color: #b9bbbe;
  font-weight: 500;
}

.board-images-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.board-image-preview {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #40444b;
  border-radius: 4px;
  padding: 4px;
  border: 1px solid #202225;
}

.board-image-preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #202225;
}

.board-image-preview .image-name {
  font-size: 0.7rem;
  color: #dcddde;
  margin-top: 2px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.board-image-preview .remove-btn {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #dc3545;
  border: none;
  color: white;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.board-image-preview .remove-btn:hover {
  background: #c82333;
}

/* Responsive Design for Images */
@media (max-width: 768px) {
  .board-images-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.5rem;
  }

  .image-card img {
    height: 100px;
  }

  .image-viewer-content {
    max-width: 95vw;
    max-height: 95vh;
    padding: 0.5rem;
  }

  .image-viewer-content img {
    max-height: 60vh;
  }

  .preview-thumbnail {
    width: 180px;
    height: 180px;
  }

  .preview-thumbnail:hover {
    transform: scale(1.15);
  }

  .preview-images.horizontal-preview {
    gap: 12px;
  }

  .preview-count-info {
    font-size: 0.7rem;
  }

  .image-preview-tooltip {
    max-width: 90vw;
  }

  .preview-main-image {
    max-width: 150px;
    max-height: 150px;
  }

  .preview-filename {
    font-size: 0.7rem;
    max-width: 150px;
  }

  .preview-images:not(.primary-preview):not(.horizontal-preview) img {
    width: 50px;
    height: 50px;
  }

  .more-images {
    width: 50px;
    height: 50px;
    font-size: 0.6rem;
  }
}

/* Performance optimization: Shimmer loading animation for lazy loading */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading-shimmer {
  animation: shimmer 1.5s ease-in-out infinite;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
}

@media (max-width: 400px) {
  .header-tool-label {
    display: none;
  }
}

/* Sidebar expand/collapse button styles */
.sidebar-expand-btn {
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%) rotate(0deg);
  z-index: 100;
  background: #36393f;
  border: 1px solid #4f545c;
  color: #dcddde;
  padding: 6px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  margin: 0;
  transition: all 0.2s ease;
}
.sidebar-expand-btn:hover {
  background: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateY(-50%) rotate(0deg) translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.sidebar.sidebar-expanded .sidebar-expand-btn {
  transform: translateY(-50%) rotate(180deg);
}

.sidebar.sidebar-expanded .sidebar-expand-btn:hover {
  transform: translateY(-50%) rotate(180deg) translateY(-1px);
}
.sidebar-expand-btn i[data-feather] {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.sidebar {
  position: relative;
  width: 320px;
  min-width: 220px;
  max-width: 100vw;
  transition: width 0.2s cubic-bezier(0.4, 1.3, 0.6, 1);
}
.sidebar.sidebar-expanded {
  width: 480px;
}

/* Ensure foldersContainer fills width */
#foldersContainer {
  width: 100%;
}

.current-board-info {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #23272e;
  color: #fff;
  padding: 10px 18px 8px 18px;
  font-size: 1.1em;
  border-bottom: 1px solid #333;
  min-height: 38px;
  background: #23272e !important;
  z-index: 1000;
}
.current-board-label {
  font-weight: 500;
  margin-right: 6px;
  color: #b3b3b3;
}
.current-board-icon {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  color: #f7c873;
  font-size: 1.2em;
}
.current-board-name {
  font-weight: bold;
  font-size: 1.2em;
  color: #f7c873;
  margin-right: 10px;
}
.current-board-tags {
  margin-left: 8px;
}
.current-board-tags .board-tag {
  background: #444;
  color: #f7c873;
  border-radius: 4px;
  padding: 2px 8px;
  margin-right: 4px;
  font-size: 0.95em;
  display: inline-block;
}

/* Image thumbnail controls */
.reference-image-thumb {
  position: relative;
  cursor: pointer;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.reference-image-thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.reference-image-thumb .controls-overlay {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.reference-image-thumb .controls-overlay button {
  background: #40444b;
  border: none;
  border-radius: 4px;
  color: #dcddde;
  padding: 4px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.reference-image-thumb .controls-overlay button:hover {
  background: #5865f2;
  color: white;
  opacity: 1;
  transform: scale(1.1);
}

.reference-image-thumb .controls-overlay button.remove-btn:hover {
  background: #ed4245;
}

.reference-image-thumb .controls-overlay button svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

/* Character Images Display within Reference Images Section */
.character-images-display {
  background: rgba(47, 49, 54, 0.3);
  border: 1px solid rgba(79, 84, 92, 0.3);
  border-radius: 8px;
  margin-top: 12px;
  padding: 12px;
  transition: all 0.3s ease;
}

.character-images-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(79, 84, 92, 0.3);
}

.character-images-title {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.close-character-images-btn {
  background: rgba(79, 84, 92, 0.5);
  border: none;
  border-radius: 4px;
  color: #dcddde;
  padding: 0.25rem;
  cursor: pointer;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-character-images-btn:hover {
  background: #ed4245;
  color: white;
  transform: scale(1.1);
}

.close-character-images-btn svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

.character-images-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.character-image-thumb {
  position: relative;
  width: 100%;
  height: 150px;
  background: #23272e;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(79, 84, 92, 0.3);
  transition: all 0.3s ease;
  cursor: pointer;
}

.character-image-thumb:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  border-color: rgba(79, 84, 92, 0.6);
}

.character-image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.character-image-thumb:hover img {
  transform: scale(1.05);
}

.character-image-thumb .image-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 500;
  text-align: center;
}

/* Live Preview Container */
.live-preview-container {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(47, 49, 54, 0.2);
  border-radius: 8px;
  border: 1px solid rgba(79, 84, 92, 0.2);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.live-preview-container:empty {
  display: none;
}

.live-preview-container:not(:empty)::before {
  content: 'Live Preview';
  color: #99aab5;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
}

/* Live Preview Thumbnail Controls */
.live-preview-thumb .controls-overlay {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 10;
}

.live-preview-thumb .controls-overlay button {
  background: #40444b;
  border: none;
  border-radius: 4px;
  color: #dcddde;
  padding: 4px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  opacity: 0.8;
}

.live-preview-thumb .controls-overlay button:hover {
  background: #5865f2;
  color: white;
  opacity: 1;
  transform: scale(1.1);
}

/* Removed remove button styles since we no longer have a stop monitoring button */

.live-preview-thumb .controls-overlay button svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
}

/* Live Image Preview Styles */
#liveImagePreviewContainer {
  border-top: 1px solid #333;
  margin-top: 16px;
}

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

.live-preview-header h4 {
  margin: 0;
  color: #f7c873;
  font-size: 1.1em;
  font-weight: 600;
}

#setFolderBtn {
  background: #40444b;
  border: 1px solid #555;
  border-radius: 6px;
  color: #dcddde;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-left: 8px;
}

#setFolderBtn:hover {
  background: #5865f2;
  border-color: #5865f2;
  color: white;
}

#setFolderBtn.monitoring {
  background: #57f287;
  border-color: #57f287;
  color: white;
}

#setFolderBtn.monitoring:hover {
  background: #3ba55c;
  border-color: #3ba55c;
}

#setFolderBtn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

/* Legacy control styles - kept for backward compatibility */
.new-board-control,
.clear-board-control,
.add-image-control,
.folder-monitor-control,
.snippet-colors-control,
.background-color-control {
  display: none; /* Hide old controls since we're using new layout */
}

/* Special states for toggle buttons */
#toggleSnippetColorsBtn.active {
  background: #57f287;
  border-color: #57f287;
  color: white;
}

#toggleSnippetColorsBtn.active:hover {
  background: #3ba55c;
  border-color: #3ba55c;
}

#setFolderBtn.monitoring {
  background: #57f287;
  border-color: #57f287;
  color: white;
}

#setFolderBtn.monitoring:hover {
  background: #3ba55c;
  border-color: #3ba55c;
}

/* Background Color Control */
/* Background color button now uses .control-btn class */

.live-image-preview {
  background: #23272e;
  border: 1px solid #333;
  border-radius: 8px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.live-preview-placeholder {
  text-align: center;
  color: #72767d;
  padding: 20px;
}

.live-preview-placeholder svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.5;
  margin-bottom: 12px;
  opacity: 0.6;
}

.live-preview-placeholder p {
  margin: 8px 0 0 0;
  font-size: 1em;
}

.live-preview-subtitle {
  font-size: 0.85em !important;
  opacity: 0.7;
}

.live-preview-image {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 4px;
}

.live-preview-info {
  position: absolute;
  bottom: 8px;
  left: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.8em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.live-preview-filename {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.live-preview-time {
  color: #b9bbbe;
  font-size: 0.9em;
  margin-left: 8px;
}

.live-preview-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #72767d;
  font-size: 0.9em;
}

.live-preview-loading svg {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Update Modal Styles */
.update-modal-content {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

.update-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #40444b;
  margin-bottom: 20px;
}

.update-header h3 {
  margin: 0;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 600;
}

.close-btn {
  background: transparent;
  border: none;
  color: #72767d;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.close-btn:hover {
  background: #40444b;
  color: #ffffff;
}

.close-btn svg {
  width: 18px;
  height: 18px;
}

.update-info {
  margin-bottom: 24px;
}

.version-comparison {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}

.current-version,
.latest-version {
  flex: 1;
  padding: 12px;
  border-radius: 6px;
  background: #36393f;
  border: 1px solid #40444b;
}

.current-version {
  border-color: #72767d;
}

.latest-version {
  border-color: #57f287;
}

.version-label {
  display: block;
  font-size: 0.875rem;
  color: #72767d;
  margin-bottom: 4px;
}

.version-number {
  display: block;
  font-size: 1.125rem;
  font-weight: 600;
  color: #ffffff;
}

.release-info h4 {
  margin: 0 0 8px 0;
  color: #ffffff;
  font-size: 1.125rem;
}

.release-info p {
  margin: 0;
  color: #72767d;
  font-size: 0.875rem;
}

.changelog-container {
  margin-bottom: 24px;
}

.changelog-container h4 {
  margin: 0 0 12px 0;
  color: #ffffff;
  font-size: 1rem;
}

.changelog-content {
  background: #1e1e1e;
  border: 1px solid #40444b;
  border-radius: 6px;
  padding: 16px;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #dcddde;
  white-space: pre-wrap;
}

.changelog-content::-webkit-scrollbar {
  width: 8px;
}

.changelog-content::-webkit-scrollbar-track {
  background: #2f3136;
  border-radius: 4px;
}

.changelog-content::-webkit-scrollbar-thumb {
  background: #40444b;
  border-radius: 4px;
}

.changelog-content::-webkit-scrollbar-thumb:hover {
  background: #4f545c;
}

.update-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.primary-btn,
.secondary-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 120px;
  justify-content: center;
}

.primary-btn {
  background: #57f287;
  color: #000000;
}

.primary-btn:hover {
  background: #3ba55c;
  transform: translateY(-1px);
}

.secondary-btn {
  background: #40444b;
  color: #dcddde;
}

.secondary-btn:hover {
  background: #4f545c;
  transform: translateY(-1px);
}

.primary-btn svg,
.secondary-btn svg {
  width: 16px;
  height: 16px;
}

/* Responsive design for update modal */
@media (max-width: 768px) {
  .update-modal-content {
    width: 95%;
    max-height: 90vh;
  }

  .version-comparison {
    flex-direction: column;
    gap: 12px;
  }

  .update-actions {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }
}

/* Tutorial Styles */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tutorial-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
}

.tutorial-container {
  position: relative;
  background: #2f3136;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid #40444b;
}

.tutorial-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid #40444b;
  background: #36393f;
}

.tutorial-header h2 {
  margin: 0;
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 600;
}

.tutorial-skip-btn {
  background: transparent;
  border: 1px solid #72767d;
  color: #72767d;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.tutorial-skip-btn:hover {
  background: #72767d;
  color: #ffffff;
  border-color: #72767d;
}

.tutorial-content {
  padding: 24px;
  max-height: 400px;
  overflow-y: auto;
}

.tutorial-step {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tutorial-image {
  text-align: center;
  background: #1e1e1e;
  border-radius: 8px;
  padding: 20px;
  border: 1px solid #40444b;
}

.tutorial-image img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tutorial-text {
  color: #dcddde;
  line-height: 1.6;
}

.tutorial-text p {
  margin: 0;
  font-size: 1rem;
}

.tutorial-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px 24px 24px;
  border-top: 1px solid #40444b;
  background: #36393f;
}

.tutorial-progress {
  color: #72767d;
  font-size: 0.875rem;
  font-weight: 500;
}

.tutorial-buttons {
  display: flex;
  gap: 12px;
}

.tutorial-btn {
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 80px;
}

.tutorial-btn.primary {
  background: #5865f2;
  color: #ffffff;
}

.tutorial-btn.primary:hover {
  background: #4752c4;
  transform: translateY(-1px);
}

.tutorial-btn.secondary {
  background: #40444b;
  color: #dcddde;
}

.tutorial-btn.secondary:hover {
  background: #4f545c;
  transform: translateY(-1px);
}

.tutorial-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.tutorial-btn:disabled:hover {
  transform: none;
}

/* Tutorial step animations */
.tutorial-step {
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive design for tutorial */
@media (max-width: 768px) {
  .tutorial-container {
    width: 95%;
    max-height: 90vh;
  }

  .tutorial-header {
    padding: 16px 16px 12px 16px;
  }

  .tutorial-header h2 {
    font-size: 1.25rem;
  }

  .tutorial-content {
    padding: 16px;
    max-height: 300px;
  }

  .tutorial-footer {
    padding: 12px 16px 16px 16px;
    flex-direction: column;
    gap: 12px;
  }

  .tutorial-buttons {
    width: 100%;
    justify-content: space-between;
  }

  .tutorial-btn {
    flex: 1;
    max-width: 120px;
  }
}

/* Auto-updater progress bar styles */
.progress-container {
  margin: 20px 0;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: #40444b;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #5865f2, #7289da);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

#autoUpdateProgressText {
  text-align: center;
  color: #dcddde;
  font-size: 0.9rem;
  margin: 0;
}

/* Metadata Panel Styles */
.metadata-panel {
  width: 320px;
  height: 700px; /* Increased height to 700px */
  background: #1e1e1e;
  border: 1px solid #40444b;
  border-radius: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: visible;
  transition: all 0.3s ease;
  z-index: 10;
  position: relative;
}

.metadata-panel.collapsed {
  width: 50px;
  min-height: 60px;
  z-index: 100;
  position: relative;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
}

.metadata-panel.collapsed:hover {
  background: #2a2d31;
}

.metadata-panel.collapsed .metadata-content {
  display: none;
}

.metadata-panel.collapsed .metadata-header h3 {
  display: none;
}

.metadata-panel.collapsed .metadata-header-controls {
  justify-content: center;
  width: 100%;
  height: 100%;
}

.metadata-panel.collapsed .metadata-toggle-btn {
  left: 50%;
  bottom: -16px;
  transform: translateX(-50%);
  background: #36393f;
  border-radius: 4px;
  min-width: 32px;
  height: 32px;
}

.metadata-panel.collapsed .metadata-toggle-btn i {
  transform: rotate(180deg);
  width: 16px;
  height: 16px;
  color: #ffffff;
  stroke: currentColor;
}

.metadata-header {
  background: #2f3136;
  padding: 12px 16px;
  border-bottom: 1px solid #40444b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metadata-header-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.metadata-header h3 {
  margin: 0;
  color: #dcddde;
  font-size: 1rem;
  font-weight: 600;
}

.metadata-toggle-btn {
  position: absolute;
  left: 50%;
  bottom: -16px;
  transform: translateX(-50%);
  background: #36393f;
  border: 1px solid #4f545c;
  color: #dcddde;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
  min-width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  margin: 0;
}

.metadata-toggle-btn:hover {
  background: #4f545c;
  border-color: #5d6269;
  color: #ffffff;
  transform: translateX(-50%) translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.metadata-toggle-btn i {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  transition: transform 0.3s ease;
}

.metadata-lock-btn {
  background: none;
  border: none;
  color: #72767d;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.metadata-lock-btn:hover {
  background: #40444b;
  color: #dcddde;
}

.metadata-lock-btn.locked {
  color: #5865f2;
}

.metadata-lock-btn.locked:hover {
  background: #40444b;
  color: #4752c4;
}

.metadata-lock-btn i {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}

.metadata-content {
  padding: 16px;
  flex: 1;
  overflow-y: auto;
  max-height: calc(700px - 60px); /* Updated to match new 700px panel height */
}

/* Custom scrollbar for metadata content */
.metadata-content::-webkit-scrollbar {
  width: 8px;
}

.metadata-content::-webkit-scrollbar-track {
  background: #2f3136;
  border-radius: 4px;
}

.metadata-content::-webkit-scrollbar-thumb {
  background: #40444b;
  border-radius: 4px;
}

.metadata-content::-webkit-scrollbar-thumb:hover {
  background: #4f545c;
}

.metadata-field {
  margin-bottom: 16px;
}

.metadata-field label {
  display: block;
  margin-bottom: 6px;
  color: #b9bbbe;
  font-size: 0.9rem;
  font-weight: 500;
}

.metadata-field input,
.metadata-field select,
.metadata-field textarea {
  width: 100%;
  padding: 8px 12px;
  background: #2f3136;
  border: 1px solid #40444b;
  border-radius: 4px;
  color: #dcddde;
  font-size: 0.9rem;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.metadata-field input:focus,
.metadata-field select:focus,
.metadata-field textarea:focus {
  outline: none;
  border-color: #5865f2;
  box-shadow: 0 0 0 2px rgba(88, 101, 242, 0.2);
}

.metadata-field input:disabled,
.metadata-field select:disabled,
.metadata-field textarea:disabled {
  background: #1e1e1e;
  color: #72767d;
  cursor: not-allowed;
  opacity: 0.6;
}

.metadata-field input::placeholder,
.metadata-field textarea::placeholder {
  color: #72767d;
}

.metadata-field textarea {
  resize: vertical;
  min-height: 60px;
  font-family: inherit;
}

.metadata-field .small-btn {
  background: #40444b;
  border: none;
  color: #dcddde;
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 8px;
  transition: all 0.2s ease;
}

.metadata-field .small-btn:hover {
  background: #5865f2;
  color: white;
}

.metadata-field .small-btn i {
  width: 14px;
  height: 14px;
}

.metadata-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metadata-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 4px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.metadata-btn.primary {
  background: #5865f2;
  color: white;
}

.metadata-btn.primary:hover {
  background: #4752c4;
}

.metadata-btn.secondary {
  background: #40444b;
  color: #dcddde;
}

.metadata-btn.secondary:hover {
  background: #4f545c;
}

.metadata-btn:disabled {
  background: #2f3136 !important;
  color: #72767d !important;
  cursor: not-allowed !important;
  opacity: 0.6;
}

.metadata-btn:disabled:hover {
  background: #2f3136 !important;
  color: #72767d !important;
}

.metadata-btn i {
  width: 16px;
  height: 16px;
}

/* Responsive design for metadata panel */
@media (max-width: 1200px) {
  .metadata-panel {
    width: 280px;
  }
}

@media (max-width: 768px) {
  .board-layout {
    flex-direction: column;
  }
  
  .metadata-panel {
    width: 100%;
    height: auto;
    max-height: 400px;
  }
  
  .metadata-panel.collapsed {
    width: 100%;
    height: 50px;
  }
}

/* PromptKit Modal Styles */
.promptkit-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.promptkit-modal-content {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 24px;
  max-width: 1200px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  display: grid;
  grid-template-columns: 380px 1fr;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  grid-template-areas:
    "header header"
    "left right"
    "actions actions";
  align-items: start;
}

.promptkit-header {
  grid-area: header;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid #444;
  padding-bottom: 16px;
  margin-bottom: 8px;
}

.promptkit-header h2 {
  color: #fff;
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}



/* Left Column */
.promptkit-left {
  grid-area: left;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Right Column */
.promptkit-right {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
}

/* Section Styles */
.promptkit-section {
  background: #333;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #444;
}

.promptkit-profile-creator.promptkit-section {
  border: none;
  border-top: none;
  border-bottom: none;
  border-left: none;
  border-right: none;
}

.promptkit-section h3 {
  color: #fff;
  margin: 0 0 12px 0;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.promptkit-section h3::before {
  content: '';
  width: 4px;
  height: 16px;
  background: #007acc;
  border-radius: 2px;
}

/* Defaults Profile */
.promptkit-defaults select {
  width: 100%;
  padding: 10px 12px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  transition: border-color 0.2s;
}

.promptkit-defaults select:focus {
  outline: none;
  border-color: #007acc;
}

/* Generated Prompt */
.promptkit-output {
  flex: 1;
  min-height: 120px;
  display: flex;
  flex-direction: column;
}

.promptkit-prompt-sections {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.promptkit-section-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.promptkit-section-group label {
  font-size: 12px;
  font-weight: 600;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.promptkit-output textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  font-family: 'Consolas', 'Monaco', monospace;
  resize: vertical;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.promptkit-output textarea:last-child {
  min-height: 120px;
  background: #1a1a1a;
  border-color: #666;
  font-weight: 600;
}

.promptkit-output textarea:focus {
  outline: none;
  border-color: #007acc;
}

/* Save Options */
.promptkit-save-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
  max-width: 100%;
}

.promptkit-save-options input,
.promptkit-save-options select {
  width: 100%;
  padding: 10px 12px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
  max-width: 100%;
  overflow: hidden;
}

.promptkit-save-options input:focus,
.promptkit-save-options select:focus {
  outline: none;
  border-color: #007acc;
}

.promptkit-save-options label {
  color: #ccc;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}

/* Action Buttons */
.promptkit-actions {
  grid-area: actions;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid #444;
}

.promptkit-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 80px;
}

.promptkit-btn-primary {
  background: #007acc;
  color: #fff;
}

.promptkit-btn-primary:hover {
  background: #005a9e;
}

.promptkit-btn-secondary {
  background: #555;
  color: #fff;
}

.promptkit-btn-secondary:hover {
  background: #666;
}

.promptkit-btn-danger {
  background: #dc3545;
  color: #fff;
}

.promptkit-btn-danger:hover {
  background: #c82333;
}

/* Save Modal */
.promptkit-save-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1100;
}

.promptkit-save-content {
  background: #2a2a2a;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.promptkit-save-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.promptkit-save-header h3 {
  color: #fff;
  margin: 0;
  font-size: 20px;
}

.promptkit-save-close {
  background: none;
  border: none;
  color: #888;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s;
}

.promptkit-save-close:hover {
  color: #fff;
  background: #444;
}

/* Wildcard Categories - Improved Design */
.promptkit-wildcard-categories {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px; /* Space for scrollbar */
}

.promptkit-wildcard-category {
  background: #2a2a2a;
  border-radius: 8px;
  border: 1px solid #444;
  overflow: visible; /* Allow content to be visible for proper scrolling */
}

.promptkit-wildcard-category-header {
  background: #3a3a3a;
  padding: 8px 12px;
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  border-bottom: 1px solid #444;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.promptkit-wildcard-category-header:hover {
  background: #444;
}

.promptkit-wildcard-category-header .header-content {
  flex: 1;
  cursor: pointer;
}

.promptkit-wildcard-category-header .category-randomize-btn {
  background: #ff6b35;
  color: #fff;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 12px;
}

.promptkit-wildcard-category-header .category-randomize-btn:hover {
  background: #e55a2b;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.promptkit-wildcard-category-header .category-randomize-btn:active {
  transform: scale(0.95);
}

.promptkit-wildcard-category-header .category-randomize-btn i {
  font-size: 14px;
}

.promptkit-wildcard-category-header::after {
  content: '▼';
  font-size: 12px;
  color: #888;
  transition: transform 0.2s;
}

.promptkit-wildcard-category.expanded .promptkit-wildcard-category-header::after {
  transform: rotate(180deg);
}

.promptkit-wildcard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  padding: 20px;
  max-height: 400px;
  background: #2a2a2a;
  align-items: start;
  justify-items: stretch;
}

.promptkit-wildcard-item {
  background: #333;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  cursor: pointer;
  min-height: 36px;
  position: relative;
  width: 100%;
  box-sizing: border-box;
  max-width: 100%;
}

.promptkit-wildcard-item:hover {
  background: #3a3a3a;
  border-color: #007acc;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.wildcard-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  flex: 1;
  min-width: 0;
}

.wildcard-name {
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  word-wrap: break-word;
  overflow-wrap: break-word;
  white-space: normal;
  overflow: visible;
}

.wildcard-count {
  color: #aaa;
  font-size: 11px;
  font-weight: 400;
}

.wildcard-section-selector {
  background: #2a2a2a;
  color: #fff;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  width: 60px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wildcard-section-selector:focus {
  outline: none;
  border-color: #007acc;
}

.wildcard-section-selector:hover {
  border-color: #007acc;
  background: #333;
}

.dice-button {
  background: #007acc;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  position: relative;
}

.dice-button:hover {
  background: #005a9e;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0, 122, 204, 0.4);
}

.dice-button:active {
  transform: scale(0.95);
}

.dice-button i {
  font-size: 16px;
}

/* Wildcard Lock Button */
.wildcard-lock-btn {
  background: #6c757d;
  color: #fff;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  margin-left: 0;
}

.wildcard-lock-btn:hover {
  background: #5a6268;
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(108, 117, 125, 0.4);
}

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

.wildcard-lock-btn.locked {
  background: #dc3545;
}

.wildcard-lock-btn.locked:hover {
  background: #c82333;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.4);
}

.wildcard-lock-btn i {
  font-size: 16px;
}

/* Wildcard Controls Row */
.wildcard-controls-row {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

/* Adjust individual button margins since they're now in a flex container */
.wildcard-section-selector {
  margin: 0;
}

/* Category Collapse/Expand Animation */
.promptkit-wildcard-grid {
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease-out;
  padding: 0 16px;
  opacity: 0;
}

.promptkit-wildcard-category.expanded .promptkit-wildcard-grid {
  max-height: 400px;
  padding: 8px;
  transition: all 0.3s ease-in;
  overflow-y: auto !important;
  overflow-x: hidden;
  opacity: 1;
}

/* Improved Scrollbar Styling */
.promptkit-wildcard-categories::-webkit-scrollbar,
.promptkit-wildcard-grid::-webkit-scrollbar {
  width: 8px;
}

.promptkit-wildcard-categories::-webkit-scrollbar-track,
.promptkit-wildcard-grid::-webkit-scrollbar-track {
  background: #2a2a2a;
  border-radius: 4px;
}

.promptkit-wildcard-categories::-webkit-scrollbar-thumb,
.promptkit-wildcard-grid::-webkit-scrollbar-thumb {
  background: #555;
  border-radius: 4px;
}

.promptkit-wildcard-categories::-webkit-scrollbar-thumb:hover,
.promptkit-wildcard-grid::-webkit-scrollbar-thumb:hover {
  background: #666;
}

/* Ensure scrolling works in expanded categories */
.promptkit-wildcard-category.expanded .promptkit-wildcard-grid {
  scrollbar-width: thin;
  scrollbar-color: #555 #2a2a2a;
}

/* Profile Creator Styles */
.promptkit-profile-creator {
  margin-top: 16px;
  border: none;
  border-top: none;
  border-bottom: none;
}

.profile-creator-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: none;
  border-top: none;
  border-bottom: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: none;
}

.form-group label {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

.form-group input,
.form-group textarea {
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 10px 12px;
  color: #fff;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #007acc;
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.profile-creator-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  border-top: none;
}

.profile-creator-actions .promptkit-btn {
  flex: 1;
  padding: 10px 16px;
  font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .promptkit-modal-content {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "left"
      "right"
      "actions";
    width: 98%;
    padding: 16px;
  }
  
  .promptkit-wildcard-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    padding: 12px;
  }
  
  .promptkit-wildcard-item {
    min-height: 50px;
    padding: 10px;
  }
  
  .wildcard-name {
    font-size: 13px;
  }
  
  .dice-button {
    width: 32px;
    height: 32px;
  }
  
  .dice-button i {
    font-size: 14px;
  }
}

/* Profile Selection Section - Constrain width for better layout */
.promptkit-profiles {
  max-width: 350px;
  min-width: 300px;
}

.promptkit-profiles select {
  width: 100%;
  padding: 10px 12px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 6px;
  color: #fff;
  font-size: 14px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.promptkit-profiles select:focus {
  outline: none;
  border-color: #007acc;
}

/* ========================================
   CHARACTER BUILDER STYLES
   ======================================== */

/* Character Builder Modal */
.character-builder-modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
}

.character-builder-modal-content {
  background: #2a2a2a;
  margin: 2% auto;
  padding: 0;
  border: 1px solid #555;
  border-radius: 8px;
  width: 90%;
  max-width: 1200px;
  height: 85vh;
  max-height: 900px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  position: relative;
  cursor: default;
}

/* Character Builder Header */
.character-builder-header {
  background: #1e1e1e;
  padding: 12px 16px;
  border-bottom: 1px solid #555;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  cursor: move;
  user-select: none;
}

.character-builder-header h2 {
  color: #fff;
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.character-builder-header .close-btn {
  background: none;
  border: none;
  color: #aaa;
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.character-builder-header .close-btn:hover {
  background: #333;
  color: #fff;
}

/* Character Builder Body */
.character-builder-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.character-builder-left {
  flex: 0 0 220px;
  padding: 8px;
  overflow-y: auto;
  border-right: 1px solid #555;
  display: flex;
  flex-direction: column;
}

.character-builder-right {
  flex: 1;
  padding: 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Character Builder Sections */
.character-builder-section {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.character-builder-section h3 {
  color: #fff;
  margin: 0 0 12px 0;
  font-size: 16px;
  flex-shrink: 0;
  font-weight: 600;
  border-bottom: 1px solid #555;
  padding-bottom: 8px;
}

/* Character Library */
.character-library {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 12px;
  border: 1px solid #555;
  border-radius: 6px;
  background: #1e1e1e;
  min-height: 200px;
}

.character-item {
  padding: 10px 12px;
  border-bottom: 1px solid #333;
  cursor: pointer;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.character-item:last-child {
  border-bottom: none;
}

/* Character Library Image Styling */
.character-image-container {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  overflow: hidden;
  background: #333;
}

.character-library-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.character-library-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  background: #2a2a2a;
  border-radius: 6px;
}

.character-library-image-placeholder i {
  width: 20px;
  height: 20px;
}

.character-item:hover {
  background: #333;
}

.character-item.selected {
  background: #007acc;
}

.character-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.character-name {
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.character-description {
  color: #aaa;
  font-size: 12px;
  line-height: 1.3;
}

.character-actions {
  display: flex;
  gap: 4px;
  flex-direction: column;
  flex-shrink: 0;
}

.character-action-btn {
  background: #555;
  border: none;
  color: #fff;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
}

.character-action-btn:hover {
  background: #666;
}

.character-action-btn.danger:hover {
  background: #dc3545;
}

.character-action-btn.secondary {
  background: #6c757d;
}

.character-action-btn.secondary:hover {
  background: #5a6268;
}

/* Character Editor */
.character-editor {
  background: #1e1e1e;
  border: 1px solid #555;
  border-radius: 6px;
  padding: 6px;
  margin-bottom: 6px;
  flex: 1;
  overflow-y: auto;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 8px;
}

.character-form-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group {
  margin-bottom: 1px;
  flex-shrink: 0;
}

/* Make image sections span both columns */
.character-image-sections {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
}

.form-group label {
  display: block;
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 1px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 3px 6px;
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-size: 11px;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #007acc;
}

/* Character Image Sections - removed duplicate, defined above */

.character-image-section {
  border: 2px solid #555;
  border-radius: 6px;
  background: #1e1e1e;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px;
}

.character-image-section .character-image-preview {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  overflow: hidden;
}

.character-image-section .character-image-preview img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #555;
}

/* Character Image Upload */
.character-image-upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.character-image-btn {
  background: #4a5568;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: background-color 0.2s;
  align-self: flex-start;
  margin: 1px;
}

.character-image-btn:hover {
  background: #5a6578;
}

.image-section-buttons {
  display: flex;
  gap: 4px;
  justify-content: center;
  flex-wrap: wrap;
}

.character-image-remove {
  background: #dc3545;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: background-color 0.2s;
}

.character-image-remove:hover {
  background: #c82333;
}

.character-image-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.character-image-preview img {
  border-radius: 4px;
  border: 1px solid #555;
}

.character-image-remove {
  background: #e53e3e;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  transition: background-color 0.2s;
  align-self: flex-start;
}

.character-image-remove:hover {
  background: #fc8181;
}


#updateCharacterImageBtn {
  background: #28a745;
  color: white;
  border-color: #28a745;
}

#updateCharacterImageBtn:hover {
  background: #218838;
  border-color: #1e7e34;
}

.form-group input::placeholder {
  color: #666;
}

/* Character Builder Buttons */
.character-builder-btn {
  padding: 6px 12px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-right: 6px;
  margin-bottom: 4px;
}

.character-builder-btn-primary {
  background: #007acc;
  color: #fff;
}

.character-builder-btn-primary:hover {
  background: #005a9e;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
}

.character-builder-btn-secondary {
  background: #6c757d;
  color: #fff;
}

.character-builder-btn-secondary:hover {
  background: #545b62;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.character-builder-btn-info {
  background: #17a2b8;
  color: #fff;
}

.character-builder-btn-info:hover {
  background: #138496;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.3);
}

.character-builder-btn-warning {
  background: #ffc107;
  color: #212529;
}

.character-builder-btn-warning:hover {
  background: #e0a800;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.character-builder-btn-danger {
  background: #dc3545;
  color: #fff;
}

.character-builder-btn-danger:hover {
  background: #c82333;
}

.character-builder-btn-success {
  background: #28a745;
  color: #fff;
}

.character-builder-btn-success:hover {
  background: #218838;
}

.character-builder-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.image-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.main-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* Character Builder Footer */
.character-builder-footer {
  background: #1e1e1e;
  border-top: 1px solid #555;
  padding: 8px 12px;
  flex-shrink: 0;
}

.character-preview h4 {
  color: #fff;
  margin: 0 0 4px 0;
  font-size: 12px;
  font-weight: 600;
}

.character-preview-text {
  background: #2a2a2a;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 8px;
  color: #fff;
  font-size: 11px;
  line-height: 1.3;
  min-height: 120px;
  white-space: pre-wrap;
  width: 100%;
  box-sizing: border-box;
}

/* Character Preview Section (positioned under reference images) */
.character-preview-section {
  grid-column: 1 / -1;
  margin-top: 8px;
  margin-bottom: 8px;
}

.character-preview-section h4 {
  color: #fff;
  margin: 0 0 4px 0;
  font-size: 11px;
  font-weight: 600;
}

.preview-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.preview-actions .character-builder-btn {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  padding: 4px 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .character-builder-modal-content {
    width: 95%;
    height: 95vh;
    margin: 2.5% auto;
  }
  
  .character-builder-body {
    flex-direction: column;
  }
  
  .character-builder-left {
    flex: 0 0 250px;
    border-right: none;
    border-bottom: 1px solid #555;
    max-height: 50vh;
  }
  
  .character-builder-right {
    border-bottom: none;
  }
  
  .character-editor {
    grid-template-columns: 1fr;
  }
}

