/* General body style */
body {
  margin: 0;

  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #1a1a1a;
  color: #e0e0e0;
  line-height: 1.5;
}

/* App container */
#appContent {
  width: 100%;
  padding: 20px;
  box-sizing: border-box;
}


/* Header */
h2 {
  color: #ffffff;
  text-align: center;
  margin-top: 20px;
  margin-bottom: 10px;
}

/* Controls */
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 20px 0;
}

/* Search input */
#searchInput {
  flex: 1;
  min-width: 250px;
  padding: 8px 10px;
}

/* Inputs and buttons */
input,
button {
  background: #13161d;
  border: 1px solid #444;
  color: #e0e0e0;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 14px;
}

input:focus,
button:focus {
  outline: none;
  border-color: #433e67;
}

button {
  cursor: pointer;
  transition: background 0.3s, border 0.3s;
}



/* Progress summary */
#progressSummary div {
  font-size: 14px;
  margin-bottom: 10px;
}

#progressSummary .bar-bg {
  background: #333;
  border-radius: 10px;
  overflow: hidden;
  height: 20px;
}



/* Details wrapper */
details {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  margin-bottom: 14px;
  padding: 8px 12px;
  transition: all 0.2s;
}

summary {
  font-weight: 600;
  cursor: pointer;
  font-size: 16px;
  color: #a3a5a3;
  margin-bottom: 10px;
}

/* Table layout */
table {
  width: 100%;
  border-collapse: collapse;
  background: #212331;
  margin-bottom: 10px;
}

th,
td {
  padding: 10px;
  border: 1px solid #333;
  text-align: left;
  font-size: 14px;
  font-weight: bold;
}

/* Table hover */
table tr {
  transition: background 0.2s ease;
}

table tr:hover {
  background-color: rgba(0, 0, 0, 0.2);
}

/* Action cell */
td.actions-cell {
  text-align: center;
  vertical-align: middle;
}

/* Icons */
.problem-link-icon,
.article-link-icon {
  font-size: 18px;
  text-decoration: none;
}


.problem-link-icon:hover {
  color: #81c784;
}

.article-link-icon {
  color: #2196f3;
}

.article-link-icon:hover {
  color: #64b5f6;
}

/* Input under each heading */
.heading-input-row {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed #333;
}

/* Clean, horizontal layout for summary bar */
.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 6px 8px;
}

/* Left side: triangle + heading title */
.summary-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Triangle icon simulated using pseudo-elements */
.arrow-icon::before {
  content: "▸";
  transition: transform 0.2s ease;
}

/* Rotate when expanded */
details[open] .arrow-icon::before {
  content: "▾";
}

/* Fix spacing and look of heading text */
.heading-text {
  font-size: 16px;
  font-weight: bold;
}

/* Right-side Add Problem button */

/* Existing row hover */
table tr:hover {
  background-color: rgba(76, 175, 80, 0.2); /* Soft green */
}

/* Add this: Change button appearance when its row is hovered */
table tr:hover button {
  background-color: rgba(16, 19, 39, 0.418); /* Darker green */
  border-color: rgba(224, 224, 224, 0.418);

}
.clickable-row {
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.clickable-row:hover {
  background-color: rgba(16, 19, 39, 0.418);
}

.addform {
  display: none;
  margin: 12px 0;
  padding: 8px;
  border: 1px solid #9c9999;
  border-radius: 8px;
  
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}
#appContent {
  padding-top: 0px;
}
#collapseAll {
  background-color: #2e3549;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
}
/* Dropdown container */
.dropdown {
  position: relative;
}

/* Three dots button */
.dropdown-toggle {
  background: transparent;
  border: 1px solid #444;
  font-size: 20px;
  color: #e0e0e0;
  cursor: pointer;
  padding: 4px 8px;
}

/* Dropdown menu styling */
.dropdown-menu {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 6px;
  background: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 6px 0;
  z-index: 1000;
  min-width: 160px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Dropdown menu buttons */
.dropdown-menu button {
  background: none;
  border: none;
  color: #e0e0e0;
  padding: 8px 16px;
  width: 100%;
  text-align: left;
  font-size: 14px;
  font-weight: normal;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background-color: #4caf50;
  color: rgb(245, 13, 13);
}
/* Hover effect for heading summary */

/* Make the entire details box react on hover */
details:hover {
  background-color: rgba(76, 175, 80, 0.1); /* light green glow */
  box-shadow: 0 2px 8px rgba(26, 133, 175, 0.2);
  border-color: #4c93af;
  transition: background-color 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
details {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 6px;
  margin-bottom: 14px;
  padding: 8px 12px;
  transition: all 0.2s ease; /* already present? good */
}
/* Style the menu (three-dot) button */
.dropdown-toggle {
  background-color: #2c2c2c;
  border: 1px solid #444;
  padding: 4px 10px;
  border-radius: 4px;
  color: #e0e0e0;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

/* Hover effect like Add Problem */
.dropdown-toggle:hover {
  background-color: #ffffff;
  border-color: #444444;
  color: rgb(0, 0, 0);
}
/* Dropdown wrapper */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Initially hide the dropdown menu */
.dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background-color: #1e1e1e;
  border: 1px solid #444;
  padding: 6px;
  border-radius: 6px;
  z-index: 999;
  box-shadow: 0 4px 6px rgba(0,0,0,0.2);
  min-width: 160px;
}

/* Dropdown menu above toggle */
.dropdown-menu-up {
  top: auto !important;
  bottom: 100%;
  margin-bottom: 6px;
  margin-top: 0 !important;
}

/* Show on hover */
.dropdown:hover .dropdown-menu {
  display: block;
}

/* Optional: button style inside menu */
.dropdown-menu button {
  background-color: transparent;
  border: none;
  color: #e0e0e0;
  text-align: left;
  width: 100%;
  padding: 8px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background-color: #4caf50;
  color: black;
}
/* Wrapper for Add button + More Options */
.dropdown-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

/* The three-dot menu container */
.dropdown {
  position: relative;
}

/* The dropdown menu itself */
.dropdown-menu {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  background-color: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 999;
  min-width: 140px;
}

/* Show dropdown on hover */
.dropdown:hover .dropdown-menu {
  display: block;
}

/* Dropdown button styling */
.dropdown-toggle {
  background-color: #2c2c2c;
  border: 1px solid #444;
  color: #e0e0e0;
  border-radius: 4px;
  padding: 4px 10px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dropdown-toggle:hover {
  background-color: #ffffff;
  color: #000;
}

/* Dropdown menu items */
.dropdown-menu button {
  background: transparent;
  color: #e0e0e0;
  border: none;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background-color: #4caf50;
  color: black;
}
.dropdown-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.dropdown {
  position: relative;
}

.dropdown-toggle {
  background-color: #2c2c2c;
  border: 1px solid #444;
  color: #e0e0e0;
  border-radius: 4px;
  padding: 4px 10px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.dropdown:hover .dropdown-menu {
  display: block;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  background-color: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 999;
  min-width: 140px;
}

.dropdown-menu button {
  background: transparent;
  color: #e0e0e0;
  border: none;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 4px;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background-color: #4caf50;
  color: black;
}
.dropdown {
  position: relative;
}

.dropdown-toggle {
  background-color: #2c2c2c;
  border: 1px solid #444;
  color: #e0e0e0;
  border-radius: 4px;
  padding: 4px 10px;
  font-weight: bold;
  cursor: pointer;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 110%;
  right: 0;
  background-color: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  box-shadow: 0 4px 8px rgba(0,0,0,0.3);
  z-index: 999;
  min-width: 140px;
}

.dropdown:hover .dropdown-menu {
  display: block;
}
.arrow-icon::before {
  content: "▸";
  display: inline-block;
  width: 1em;  /* ensures stable width */
  transition: transform 0.2s ease;
}

details[open] .arrow-icon::before {
  content: "▾";
}
.summary-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  gap: 10px;
  user-select: none;
}
details > summary::marker {
  display: none;
}
summary {
  list-style: none;
  margin: 0;
}
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  cursor: pointer;
  padding: 4px;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 8px 0;
  z-index: 1000;
  min-width: 140px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* ✅ Show dropdown on hover */
.dropdown:hover .dropdown-menu {
  display: block;
}

/* Menu button styling */
.dropdown-menu button {
  display: block;
  background: none;
  border: none;
  color: #e0e0e0;
  padding: 8px 16px;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background-color: #4caf50;
  color: black;
}
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-toggle {
  cursor: pointer;
  padding: 6px;
  background-color: #000000;  /*found*/
  border: 1px solid #444;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #1e1e1e;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 6px 0;
  z-index: 1000;
  min-width: 140px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.dropdown-menu button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 8px 12px;
  color: #e0e0e0;
  text-align: left;
  cursor: pointer;
}

.dropdown-menu button:hover {
  background-color: #e9e9e9;
  border-color: #444444;
  color: rgb(0, 0, 0);
}
/* === Styled Toggle Checkbox === */
.toggle-children-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #e0e0e0;
  background-color: #1e1e1e;
  border: 1px solid #444;
  padding: 12px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s, border 0.3s;
  user-select: none;
}

.toggle-children-label:hover {
  background-color: #2c2c2c;
  border-color: #4caf50;
}

/* Match checkbox style to dark mode */
.toggle-children-label input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #4c93af;
  border-radius: 3px;
  background-color: transparent;
  display: inline-block;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.toggle-children-label input[type="checkbox"]:checked {
  background-color: #4c93af;
}

.toggle-children-label input[type="checkbox"]:checked::after {
  content: "✔";
  color: black;
  font-size: 12px;
  position: absolute;
  top: 0px;
  left: 2px;
  font-weight: bold;
}
/* Minimal checkbox with tooltip */
.checkbox-tooltip {
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid #4c93af;
  border-radius: 4px;
  background-color: transparent;
  cursor: pointer;
  position: relative;
  transition: background-color 0.2s ease;
}

/* Checked state */
.checkbox-tooltip:checked {
  background-color: #4c93af;
}



/* Tooltip on hover */
.checkbox-tooltip::before {
  content: "Show all children when heading matches";
  position: absolute;
  top: -36px;
  left: 0;
  background-color: #2a2a2a;
  color: #e0e0e0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
  border: 1px solid #444;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Show tooltip on hover */
.checkbox-tooltip:hover::before {
  opacity: 1;
}
#toggleShowChildren {
  padding: 12px;
}

/* Minimal checkbox with tooltip */
.checkbox-tooltip {
  appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid #404758;
  border-radius: 4px;
  background-color: transparent;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  vertical-align: middle;
}

/* Checked state */
.checkbox-tooltip:checked {
  background-color: #21283d;
}

/* Centered tick inside checkbox */
.checkbox-tooltip:checked::after {
  content: "✔";
  color: #727171;
  font-size: 13px;
  font-weight: bold;
  line-height: 1;
}

/* Tooltip on hover */
.checkbox-tooltip::before {
  content: "Show all children when heading matches";
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2a2a2a;
  color: #e0e0e0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
  border: 1px solid #444;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Show tooltip on hover */
.checkbox-tooltip:hover::before {
  opacity: 1;
}

/* --- CodeVault Header Bar --- */
.codevault-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 32px;
  background: linear-gradient(90deg, #181c24 60%, #232b3a 100%);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
  margin-bottom: 32px;
  border: 1px solid #232b3a;
}

.codevault-header h2 {
  margin: 0;
  color: #5ad1e6;
  font-family: 'Segoe UI', 'Inter', sans-serif;
  font-size: 2.1rem;
  letter-spacing: 0.03em;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(90,209,230,0.08);
}

.codevault-header button {
  background: linear-gradient(90deg, #5ad1e6 60%, #4ecdc4 100%);
  color: #181c24;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 1rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(90,209,230,0.10);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.codevault-header button:hover {
  background: linear-gradient(90deg, #4ecdc4 60%, #5ad1e6 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(90,209,230,0.18);
}
/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Header container */
.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #0a0b0d;
  border-bottom: 1px solid #1e1e1e;
  padding: 14px 24px;
  font-family: 'Inter', -apple-system, sans-serif;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Brand/Title */
.header-title {
  flex: 1;
  display: flex;
  justify-content: center;
}

.header-title h2 {
  margin: 0;
  color: #000000;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Buttons - Clean modern style */
.header-btn, #logoutBtn {
  background: #1a1a1a;
  color: #e4e4e7;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.header-btn:hover, #logoutBtn:hover {
  background: #262626;
  border-color: #3a3a3a;
  color: #ffffff;
}

.header-btn:active, #logoutBtn:active {
  background: #1f1f1f;
  transform: translateY(1px);
}

/* Logout button variant */
.logout-btn, #logoutBtn {
  background: #1a1617;
  color: #fca5a5;
  border-color: #2a1f20;
}

.logout-btn:hover, #logoutBtn:hover {
  background: #2a1f20;
  border-color: #3a2526;
  color: #fecaca;
}

/* User badge */
.user-badge, #usernameDisplay {
  background: #161616;
  color: #a1a1aa;
  border: 1px solid #262626;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Server status indicator */

/* Responsive design */
@media (max-width: 768px) {
  .header-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 16px;
  }
  
  .header-title {
    justify-content: flex-start;
  }
  
  .header-title h2 {
    font-size: 1.25rem;
  }
  
  .header-btn, #logoutBtn {
    width: 100%;
    justify-content: center;
  }
  
  .user-badge, #usernameDisplay {
    align-self: flex-start;
  }

}

@media (max-width: 480px) {
  .header-bar {
    padding: 12px;
  }
  
  .header-btn, #logoutBtn {
    padding: 10px 16px;
    font-size: 15px;
  }
}
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.header-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  margin-top: 0;                /* Remove margin to avoid offset */
  z-index: 1000;
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 0 rgba(255,255,255,0.05);
  padding: 12px 24px;
  border: none !important;
  font-family: 'Inter', -apple-system, sans-serif;
  /* Optional border for theme: */
  border-bottom: 1px solid #23232e;
}
body {
  padding-top: 140px; /* Set this to the pixel height of your header-bar */
}

/* Logo and Brand */
.header-title {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  
}
.brand-text {
    background: linear-gradient(135deg, #00d2ff, #3a47d5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
.logo-icon {
  width: 28px;
  height: 28px;
  color: #58a6ff;
  filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.3));
}

.header-title h2 {
  margin: 0;
  color: #000000;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* Actions Container */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Modern Button Style */
.header-btn, #logoutBtn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #21262d;
  color: #f0f6fc;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  position: relative;
  overflow: hidden;
}

.header-btn svg, #logoutBtn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2;
}

.header-btn:hover, #logoutBtn:hover {
  background: #30363d;
  border-color: #58a6ff;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.header-btn:active, #logoutBtn:active {
  transform: translateY(0);
}

/* Logout Button Variant */
.logout-btn, #logoutBtn {
  color: #ffa198;
  border-color: #da3633;
}

.logout-btn:hover, #logoutBtn:hover {
  background: #da3633;
  border-color: #f85149;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(218, 54, 51, 0.3);
}

/* User Badge */
.user-badge, #usernameDisplay {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #161b22;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 50px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

.user-badge svg, #usernameDisplay svg {
  width: 16px;
  height: 16px;
  color: #58a6ff;
}

/* Server Status with Animated Dot */



@keyframes pulse {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(63, 185, 80, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(63, 185, 80, 0);
  }
}

/* Offline status */

/* Responsive Design */
@media (max-width: 768px) {
  .header-bar {
    padding: 12px 16px;
  }
  
  .header-actions {
    gap: 6px;
  }
  
  .header-btn span, #logoutBtn span {
    display: none;
  }
  
  .header-btn, #logoutBtn {
    padding: 8px;
    min-width: 40px;
    justify-content: center;
  }
  
  .user-badge span, #usernameDisplay span {
    display: none;
  }
}

@media (max-width: 480px) {
  .header-bar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }
  
  .header-title {
    justify-content: center;
  }
  
  .header-actions {
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .header-btn span, #logoutBtn span,
  .user-badge span, #usernameDisplay span {
    display: inline;
  }
  
  .header-btn, #logoutBtn {
    flex: 1;
    justify-content: center;
    min-width: 120px;
  }
}

/* Focus states for accessibility */
.header-btn:focus-visible, #logoutBtn:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

/* Tooltip styles */
[title] {
  position: relative;
}
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* Account Section Container */
.account-section {
  background: #0d1117;
  border: 1px solid #21262d;
  border-radius: 12px;
  padding: 0;
  margin: 16px 0;
  overflow: hidden;
}

/* User Profile Layout */
.user-profile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #161b22 0%, #0d1117 100%);
  position: relative;
}

/* Avatar with Status */
.avatar-container {
  position: relative;
  flex-shrink: 0;
}

.user-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid #30363d;
  background: #21262d;
  transition: all 0.2s ease;
}

.user-avatar:hover {
  border-color: #58a6ff;
  transform: scale(1.05);
}


/* User Information */
.user-info {
  flex: 1;
  min-width: 0;
}

.user-details {
  margin-bottom: 12px;
}

.username {
  color: #f0f6fc;
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.user-role {
  display: inline-block;
  background: #1f6feb;
  color: #ffffff;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.user-role.premium {
  background: linear-gradient(135deg, #ffd700, #ffb347);
  color: #000;
}

/* Account Stats */
.account-stats {
  display: flex;
  gap: 24px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stat-value {
  color: #f0f6fc;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
}

.stat-label {
  color: #8b949e;
  font-size: 13px;
  font-weight: 400;
  margin-top: 2px;
}

/* Action Buttons */
.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: #21262d;
  color: #8b949e;
  border: 1px solid #30363d;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  outline: none;
}

.action-btn svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.action-btn:hover {
  background: #30363d;
  color: #58a6ff;
  border-color: #58a6ff;
  transform: translateY(-1px);
}

.action-btn:active {
  transform: translateY(0);
}

/* Dropdown Menu */
.account-dropdown {
  position: relative;
}

.account-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 8px 0;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1000;
}

.account-dropdown:hover .account-menu {
  display: block;
}

.account-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: none;
  border: none;
  color: #f0f6fc;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.account-menu button svg {
  width: 16px;
  height: 16px;
  color: #8b949e;
  flex-shrink: 0;
}

.account-menu button:hover {
  background: #21262d;
  color: #58a6ff;
}

.account-menu button:hover svg {
  color: #58a6ff;
}

.menu-divider {
  height: 1px;
  background: #21262d;
  margin: 8px 0;
}

.export-btn:hover {
  color: #3fb950 !important;
}

.export-btn:hover svg {
  color: #3fb950 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
  .user-profile {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .account-stats {
    justify-content: space-around;
    width: 100%;
  }
  
  .account-actions {
    align-self: stretch;
    justify-content: flex-end;
  }
}

@media (max-width: 480px) {
  .user-profile {
    padding: 16px;
  }
  
  .account-stats {
    gap: 16px;
  }
  
  .action-btn {
    width: 36px;
    height: 36px;
  }
  
  .action-btn svg {
    width: 16px;
    height: 16px;
  }
}

/* Focus states for accessibility */
.action-btn:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

.user-badge, #usernameDisplay {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #1a1f2e 0%, #16213a 50%, #0f1419 100%);
  border: 1px solid rgba(88, 166, 255, 0.2);
  border-radius: 24px;
  padding: 8px 18px 8px 8px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  box-shadow: 
    0 4px 20px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.user-badge:hover, #usernameDisplay:hover {
  background: linear-gradient(135deg, #1e2337 0%, #1a2441 50%, #131822 100%);
  border-color: rgba(88, 166, 255, 0.4);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(88, 166, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* Avatar Wrapper */
.user-avatar-wrapper {
  position: relative;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
  transition: all 0.3s ease;
}

.user-badge:hover .user-avatar-wrapper {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
  transform: scale(1.05);
}

/* User Icon */
.user-icon {
  width: 20px;
  height: 20px;
  color: #ffffff;
  stroke-width: 2.5;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}


/* User Info */
.user-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.username {
  color: #f1f5f9;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.user-type {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

/* Glowing background effect */
.user-badge-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, 
    rgba(88, 166, 255, 0.1) 0%, 
    rgba(124, 58, 237, 0.1) 100%);
  border-radius: 24px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.user-badge:hover .user-badge-glow {
  opacity: 1;
}

/* Premium version styles */
.user-badge.premium, #usernameDisplay.premium {
  background: linear-gradient(135deg, #1e1a2e 0%, #2d1b45 50%, #1a1625 100%);
  border-color: rgba(255, 215, 0, 0.3);
}

.user-badge.premium:hover, #usernameDisplay.premium:hover {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 20px rgba(255, 215, 0, 0.15);
}

.user-badge.premium .user-avatar-wrapper {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  box-shadow: 0 2px 8px rgba(251, 191, 36, 0.4);
}

.user-badge.premium .user-type {
  color: #fbbf24;
  font-weight: 600;
}

/* Responsive design */
@media (max-width: 768px) {
  .user-badge, #usernameDisplay {
    padding: 6px 14px 6px 6px;
    gap: 8px;
  }
  
  .user-avatar-wrapper {
    width: 32px;
    height: 32px;
  }
  
  .user-icon {
    width: 16px;
    height: 16px;
  }
  

  
  .username {
    font-size: 14px;
  }
  
  .user-type {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .user-info {
    display: none;
  }
  
  .user-badge, #usernameDisplay {
    padding: 6px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
  }
}

/* Focus states for accessibility */
.user-badge:focus-visible, #usernameDisplay:focus-visible {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

/* Loading state */
.user-badge.loading, #usernameDisplay.loading {
  opacity: 0.7;
}

.user-badge.loading .user-avatar-wrapper {
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}
@keyframes intensePulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    box-shadow: 0 0 15px 6px #38e88caa, 0 0 6px 3px #38e88c88;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.3);
    opacity: 0.4;
    box-shadow: 0 0 35px 14px #38e88ccc, 0 0 25px 10px #38e88ca8;
  }
}


.user-dropdown {
  position: relative;
  cursor: pointer;
}

.user-dropdown .dropdown-arrow {
  margin-left: 6px;
  stroke: #7fcaff;
  transition: transform .18s;
}

.user-dropdown.open .dropdown-arrow,
.user-dropdown:hover .dropdown-arrow {
  transform: rotate(180deg);
}

.user-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 110%;
  min-width: 210px;
  background: #202939;
  border: 1.5px solid #314261;
  border-radius: 13px;
  box-shadow: 0 12px 36px #000b;
  padding: 14px 0;
  z-index: 99;
  animation: fadeInDropdown .2s;
}

@keyframes fadeInDropdown {
  from { opacity: 0; transform: translateY(-8px);}
  to { opacity: 1; transform: translateY(0);}
}

/* Show on hover (desktop) or with .open class (JS, mobile) */
.user-dropdown:hover .user-dropdown-menu,
.user-dropdown.open .user-dropdown-menu {
  display: block;
}

.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 10px 20px;
}

.user-avatar.large {
  width: 42px;
  height: 42px;
  background: #132032;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-dropdown .user-avatar svg {
  width: 24px;
  height: 24px;
  color: #79b8ff;
}

.user-dropdown .username {
  font-weight: 700;
  color: #e8f2ff;
  margin-bottom: 3px;
  font-size: 1.06em;
}

.user-dropdown .user-type {
  color: #7fbfff;
  font-size: 12px;
  opacity: 0.85;
}

.dropdown-divider {
  height: 1px;
  background: #28364b;
  margin: 7px 0 10px 0;
}

/* Dropdown buttons */
.user-dropdown-menu button {
  width: 100%;
  background: none;
  border: none;
  color: #e3eef9;
  text-align: left;
  padding: 12px 20px;
  font-size: 15px;
  cursor: pointer;
  transition: background .13s, color .14s;
  font-family: inherit;
}
.user-dropdown-menu button:hover {
  background: #304967;
  color: #5fe0c4;
}
@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 10px 2px #77e86b99;
    background-color: #77e86b;
  }
  50% {
    box-shadow: 0 0 20px 6px #77e86bcc;
    background-color: #a0f294;
  }
}

@keyframes glowPulseOff {
  0%, 100% {
    box-shadow: 0 0 10px 2px #fa555599;
    background-color: #fa5555;
  }
  50% {
    box-shadow: 0 0 20px 6px #fa5555cc;
    background-color: #ff7575;
  }
}

.status-dot {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: #77e86b;
  animation: glowPulse 2.5s ease-in-out infinite;
  transition: background 0.15s, box-shadow 0.15s;
  margin: 0.1em;
}

.server-status.offline .status-dot {
  animation: glowPulseOff 2.5s ease-in-out infinite;
}
.user-badge-dotfirst {
  display: flex;
  align-items: center;
  gap: 0.45em;
  background: #232830;
  border-radius: 2em;
  padding: 0.38em 1em;
  color: #fff;
  font-family: "Inter", Arial, sans-serif;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}

.status-dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: #77e86b;   /* green online */
  transition: background 0.18s, box-shadow 0.18s;
  box-shadow: 0 0 7px 1px #77e86b70;
  position: relative;
}

.status-dot.offline {
  background: #fa5555;   /* red offline */
  box-shadow: 0 0 7px 1px #fa555570;
}

.username {
  font-weight: 500;
  letter-spacing: 0.02em;
  padding-left: 0.12em;
}
.user-badge-combined {
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: #232830;
  border-radius: 2em;
  padding: 0.38em 1em;
  color: #fff;
  font-family: "Inter", Arial, sans-serif;
  font-size: 1rem;
  box-shadow: 0 2px 8px #0001;
}

.user-avatar {
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background: #181b22;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.user-avatar svg {
  width: 1.2em;
  height: 1.2em;
  color: #b1b6bd;
}

.username {
  font-weight: 500;
  letter-spacing: 0.025em;
}

.status-dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  background: #77e86b;  /* Green for online */
  transition: background 0.2s, box-shadow 0.2s;
  margin-left: 0.28em;
  box-shadow: 0 0 8px 1px #77e86b70;
  position: relative;
}

.status-dot.offline {
  background: #fa5555;   /* Red for offline */
  box-shadow: 0 0 8px 1px #fa555570;
}
.user-badge-simple {
  display: flex;
  align-items: center;
  gap: 0.6em;
  background: #232830;
  border-radius: 2em;
  padding: 0.36em 1em;
  color: #fff;
  font-family: "Inter", Arial, sans-serif;
  font-size: 1rem;
}

.user-avatar {
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background: #181b22;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Add default transition */
  transition: box-shadow 0.3s;
}

/* Avatar glows green for online */
.user-badge-simple.online .user-avatar {
  box-shadow: 0 0 14px 3px #77e86baa;
}

/* Avatar glows red for offline */
.user-badge-simple.offline .user-avatar {
  box-shadow: 0 0 14px 3px #fa5555bb;
}
.user-badge-simple {
  display: flex;
  align-items: center;
  gap: 0.65em;
  background: linear-gradient(135deg, #24273a 0%, #33417b 100%);
  border-radius: 2em;
  box-shadow: 0 2px 16px 0 rgba(44,54,105,0.15);
  padding: 0.48em 1.4em 0.48em 0.9em;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 1.07rem;
  color: #fff;
  min-width: 7.5em;
  max-width: 99vw;
  user-select: none;
  transition: box-shadow 0.24s;
}

.user-badge-simple:hover, .user-badge-simple:focus-within {
  box-shadow: 0 6px 28px 0 rgba(76,150,204,0.22);
}

.user-avatar {
  width: 2.3em;
  height: 2.3em;
  min-width: 2.3em;
  min-height: 2.3em;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #31386a 70%, #202338 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 0 0 2px #384cb799, 0 2px 8px #2d314d44;
  transition: box-shadow 0.18s;
}

.user-badge-simple:hover .user-avatar {
  box-shadow: 0 0 0 3px #47e39399, 0 4px 18px #2d314d55;
}

.user-avatar svg {
  width: 1.4em;
  height: 1.4em;
  color: #a8bbdd;
  stroke-width: 2.3;
  opacity: 0.96;
}

.username {
  font-weight: 600;
  letter-spacing: 0.012em;
  color: #fafcff;
  padding-left: 0.12em;
  padding-right: 0.1em;
  text-shadow: 0 1px 3px #0002;
}

/* Optional: Responsive tweak for mobile */
@media (max-width: 500px) {
  .user-badge-simple {
    font-size: 0.97rem;
    padding: 0.41em 0.85em 0.41em 0.6em;
  }

  .user-avatar {
    width: 2em;
    height: 2em;
    min-width: 2em;
    min-height: 2em;
  }
}
.user-badge-simple {
  display: flex;
  align-items: center;
  gap: 0.65em;
  background: linear-gradient(135deg, #24273a 0%, #33417b 100%);
  border-radius: 2em;
  box-shadow: 0 2px 16px 0 rgba(44,54,105,0.14);
  padding: 0.48em 1.4em 0.48em 0.9em;
  font-family: 'Inter', Arial, sans-serif;
  font-size: 1.09rem;
  color: #fff;
}

.user-avatar {
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #31386a 68%, #202338 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Start with green pulse */
  box-shadow: 0 0 0 2px #49fa9f70;
  animation: pulseOnline 2.1s infinite cubic-bezier(.4,0,.6,1);
  transition: box-shadow 0.19s;
}

@keyframes pulseOnline {
  0%, 100% {
    box-shadow: 0 0 0 2px #84ffc077, 0 0 14px 4px #49fa9f44;
  }
  50% {
    box-shadow: 0 0 0 5px #6affd699, 0 0 26px 12px #9affc495;
  }
}

/* Add this class via JS when offline */
.user-badge-simple.offline .user-avatar {
  animation: pulseOffline 2.1s infinite cubic-bezier(.4,0,.6,1);
  box-shadow: 0 0 0 2px #fa555570;
}

@keyframes pulseOffline {
  0%, 100% {
    box-shadow: 0 0 0 2px #fa555580, 0 0 12px 2px #fa555540;
  }
  50% {
    box-shadow: 0 0 0 5px #ff797980, 0 0 22px 9px #ffafaf75;
  }
}

.user-avatar svg {
  width: 1.4em;
  height: 1.4em;
  color: #a8bbdd;
  stroke-width: 2.3;
  opacity: 0.95;
}

.username {
  font-weight: 600;
  letter-spacing: 0.012em;
  color: #fbfcff;
  padding-left: 0.12em;
  text-shadow: 0 1px 3px #0003;
}
@keyframes pulseOnline {
  0%, 100% {
    box-shadow: 0 0 0 1px #84ffc022, 0 0 6px 2px #49fa9f22;
  }
  50% {
    box-shadow: 0 0 0 3px #6affd633, 0 0 12px 5px #9affc422;
  }
}

@keyframes pulseOffline {
  0%, 100% {
    box-shadow: 0 0 0 1px #fa555522, 0 0 6px 1px #fa555520;
  }
  50% {
    box-shadow: 0 0 0 3px #ff797933, 0 0 11px 4px #ffafaf31;
  }
}
.modal {
  position: fixed; z-index: 9999; top: 0; left: 0;
  width: 100vw; height: 100vh; display: flex; align-items: center; justify-content: center;
}
.modal-backdrop {
  position: absolute; width: 100vw; height: 100vh; top: 0; left: 0;
  background: rgba(18, 20, 30, 0.54);
  backdrop-filter: blur(7px);
}
.modal-content {
  position: relative;
  background: #23242d;
  color: #f3f4f9;
  border-radius: 18px;
  box-shadow: 0 8px 40px #18192148, 0 2px 8px #15172636;
  max-width: 96vw;
  width: 350px; /* adjust for wider screens if desired */
  padding: 32px 28px 22px 28px;
  z-index: 1;
  display: flex; flex-direction: column; gap: 16px;
  animation: popIn 0.19s cubic-bezier(.44,.8,.36,1.12);
}
@keyframes popIn {
  0% { transform: scale(0.92) translateY(24px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}
.modal-content h2 {
  font-size: 1.2rem; font-weight: 600; margin: 0 0 9px 0;
}
.modal-content input {
  width: 100%; font-size: 1.08rem; border-radius: 8px;
  border: 1.3px solid #24263b;
  background: #181921; color: #f6fcff;
  padding: 12px 10px; margin-bottom: 3px;
  transition: border 0.16s;
}
.modal-content input:focus {
  border-color: #22ee98; outline: none; box-shadow: 0 0 0 2px #22ee9880;
}
.modal-actions {
  display: flex; gap: 9px; justify-content: flex-end;
}
.modal-add {
  background: #22ee98; color: #181921; font-weight: 600;
  border: none; border-radius: 7px;
  padding: 9px 20px; cursor: pointer;
  transition: background 0.16s;
}
.modal-add:hover, .modal-add:focus {
  background: #1fe2a1;
}
.modal-cancel {
  background: transparent; color: #a3aac2;
  border: 1.2px solid #25283a; border-radius: 7px;
  padding: 9px 20px; cursor: pointer;
}
.modal-cancel:hover {
  background: #25283a; color: #f3f4f9;
}
.modal-hint {
  font-size: .97em; color: #7e87a9; margin-top: 4px;
}
@media (max-width:500px) {
  .modal-content { width: 98vw; padding: 18px 7vw;}
}
/* Main Add Button — Clean, Premium */
.add-heading-btn {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 0 auto 18px auto;
  padding: 16px 0;
  background: rgba(36, 39, 54, 0.73);
  color: #e7eafd;
  font-size: 1.17rem;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 16px;
  letter-spacing: 0.01em;
  box-shadow: 0 8px 28px 0 rgba(36,54,78,0.10), 0 2px 6px rgba(60, 84, 190, 0.07);
  backdrop-filter: blur(2px);
  transition:
    background 0.20s cubic-bezier(.52,.17,.42,1.05),
    color 0.13s,
    box-shadow 0.18s;
  outline: none;
}


/* Dialog Modal with Glassmorphism */
.modal {
  position: fixed; z-index: 1999; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: all;
  font-family: 'Inter', sans-serif;
}
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(18, 20, 30, 0.46);
  backdrop-filter: blur(7px) saturate(160%);
}
.modal-content {
  position: relative;
  z-index: 1;
  width: 97vw; max-width: 380px;
  border-radius: 22px;
  background: rgba(34, 36, 51, 0.81);
  box-shadow:
    0 4px 32px 0 rgba(36,54,78,0.15),
    0 1.5px 8px rgba(32,88,220,0.18);
  color: #f3f6fb;
  backdrop-filter: blur(13.5px) saturate(180%);
  border: 1.4px solid rgba(255,255,255,0.04);
  padding: 32px 30px 22px 30px;
  display: flex; flex-direction: column; gap: 19px;
  animation: popIn 0.19s cubic-bezier(.44,.8,.36,1.12);
}

@keyframes popIn {
  0% { transform: scale(.93) translateY(30px); opacity: 0;}
  100% { transform: scale(1) translateY(0); opacity: 1;}
}

.modal-content h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #dbdffd;
  letter-spacing: 0.01em;
  margin: 0 0 2px 0;
}

.modal-content input {
  width: 100%;
  font-size: 1.13rem;
  padding: 14px 12px;
  border-radius: 13px;
  border: 1.7px solid rgba(62,83,120,0.20);
  background: rgba(26,28,38, 0.88);
  color: #e9eefe;
  backdrop-filter: blur(2.7px);
  box-shadow: 0 1px 4px 0 rgba(30, 61, 120, 0.07);
  transition: border-color .15s, box-shadow .14s;
  outline: none;
  margin-bottom: 2px;
}
.modal-content input:focus {
  border-color: #6eb6fe;
  box-shadow: 0 0 0 2px #7ebcff76;
}

.modal-actions {
  display: flex; gap: 12px; justify-content: flex-end; align-items: center;
}
.modal-add {
  background: linear-gradient(90deg, #4751ff 0%, #7fb4fa 80%);
  color: #fff;
  font-weight: 700;
  border: none;
  border-radius: 9px;
  padding: 10px 25px;
  font-size: 1.05rem;
  box-shadow: 0 3px 16px 0 rgba(91,189,255,0.08);
  transition: background .17s, filter .14s, box-shadow .16s;
}
.modal-add:hover, .modal-add:focus {
  background: linear-gradient(90deg, #3763f7 0%, #50c9ff 100%);
  filter: brightness(1.08);
  box-shadow: 0 0 0 2px #50a7fd67;
}
.modal-cancel {
  background: rgba(38,40,59,.37);
  color: #a7adce;
  border: 1.1px solid rgba(164,184,217,0.12);
  border-radius: 9px;
  padding: 10px 18px;
  font-size: 1.05rem;
}
.modal-cancel:hover {
  background: rgba(77,80,115,.11);
  color: #f5f6fb;
}
.modal-hint {
  font-size: 0.99em;
  color: #6d74a6;
  margin-top: -10px;
  letter-spacing: 0.01em;
}
@media (max-width: 500px) {
  .modal-content { max-width: 99vw; padding: 18px 5vw; }
}

/* Optional kbd styling for hints */
.modal-hint kbd {
  background: #21242d;
  color: #65b5fd;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.93em;
  font-family: 'Fira Mono', 'Jetbrains Mono', monospace;
  margin: 0 2px;
}
.add-heading-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 22px;
  margin: 0 0 18px 0;
  background: #1b1f29;
  color: #e7eafd;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  box-shadow: 0 2px 8px rgba(36,54,78,0.07);
  letter-spacing: 0.01em;
  cursor: pointer;
  transition:
    background 0.18s cubic-bezier(.52,.17,.42,1.05),
    color 0.14s,
    box-shadow 0.19s;
  outline: none;
  min-width: 0;
  min-height: 40px;
  max-width: 200px;
}
.add-heading-btn:hover, .add-heading-btn:focus {
  background: rgba(42, 44, 63, 0.92);
  color: #fff;
  box-shadow: 0 4px 18px 0 rgba(80,148,255,.13);
}
@media (max-width: 600px) {
  .add-heading-btn {
    width: 100%;
    justify-content: center;
    max-width: unset;
  }
}
.modal-content {
  position: relative;
  background: rgba(34, 36, 51, 0.81);
  border-radius: 22px;
  box-shadow: 0 4px 32px 0 rgba(36,54,78,0.15), 0 1.5px 8px rgba(32,88,220,0.18);
  color: #f3f6fb;
  backdrop-filter: blur(13.5px) saturate(180%);
  border: 1.4px solid rgba(255,255,255,0.04);
  width: 96vw;
  max-width: 520px;    /* Larger for desktop */
  min-width: 320px;
  padding: 40px 44px 28px 44px;    /* Generous desktop padding */
  display: flex; flex-direction: column; gap: 22px;
  animation: popIn 0.19s cubic-bezier(.44,.8,.36,1.12);
}

@media (max-width: 700px) {
  .modal-content {
    max-width: 99vw;
    padding: 22px 7vw 16px 7vw;
    min-width: unset;
  }
}
html, body {
  width: 100%;
  overflow-x: hidden;
}

/* For main container */
#appContent {
  width: 100vw;
  max-width: 100vw;
  min-width: 0;
  margin: 0 auto;
  padding: 20px 0;      /* Only vertical padding */
  box-sizing: border-box;
  overflow-x: hidden;
}

@media (max-width:600px) {
  .add-heading-btn {
    width: 100%;
    max-width: unset;
  }
}
table, .some-wide-content {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
}
.modal-content {
  max-width: 540px;     /* Wider box on desktop */
  width: 98vw;
  min-width: 320px;
  padding: 48px 48px 32px 48px;   /* More inner space for premium feel */
}

@media (max-width: 900px) {
  .modal-content {
    max-width: 98vw;
    padding: 30px 14vw 20px 14vw;
  }
}

@media (max-width: 600px) {
  .modal-content {
    max-width: 99vw;
    width: 99vw;
    padding: 18px 3vw;
  }
}

.modal-content {
  position: relative;
  background: rgba(34, 36, 51, 0.81);
  color: #f3f6fb;
  border-radius: 22px;
  box-shadow: 0 8px 40px #18192148, 0 2px 8px #15172636;
  width: 100vw;
  max-width: 740px;         /* Much larger on desktop */
  min-width: 400px;
  padding: 60px 64px 36px 64px;    /* Generous inner padding */
  display: flex;
  flex-direction: column;
  gap: 26px;
  animation: popIn 0.19s cubic-bezier(.44,.8,.36,1.12);
}
.modal-hint{
  font-size: 1.2em;
  color: #7e87a9;
  margin-top: -12px;
  letter-spacing: 0.01em;
}
/* Responsive adjustments for smaller screens */
@media (max-width: 1020px) {
  .modal-content {
    max-width: 98vw;
    padding: 32px 6vw 24px 6vw;
    min-width: unset;
  }
}
@media (max-width: 600px) {
  .modal-content {
    max-width: 99vw;
    width: 99vw;
    padding: 18px 4vw;
    min-width: unset;
  }
}
@media (max-width: 500px) {
  .modal-content {
    max-width: 93vw;       /* Makes the dialog itself narrower */
         /* Less side padding for a compact look */
    min-width: unset;
  }
  
}
@media (max-width: 900px) {
  .modal-content {
      max-width: 99vw;
      padding: 24px 5vw 20px 5vw;
  }
  .modal-content input,
  .modal-actions button {
    font-size: 1rem;
    padding: 12px 18px;
  }
  .modal-hint {
    font-size: 0.97rem;
  }
}

@media (max-width: 500px) {
  .modal-content {
    max-width: 93vw;
    width: 93vw;
    min-width: 0;
    padding: 12px 2vw;
    border-radius: 14px;
  }
  .modal-content h2 {
    font-size: 1.08rem;
    margin-bottom: 3px;
  }
  .modal-content input {
    font-size: 0.99rem;
    padding: 11px 10px;
  }
  .modal-actions button {
    font-size: 1rem;
    padding: 9px 10px;
    border-radius: 7px;
  }
  .modal-hint {
    font-size: 0.91rem;
    margin-top: 0;
  }

}
.modal-content input {
    font-size: 1.1rem;
    padding: 15px 10px;
  }
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center; /* vertical alignment */
  justify-content: flex-start;
}


#appContent {
  width: 100vw;
  max-width: 100vw;
  min-width: 0;
  padding: 20px; /* Only vertical padding */
  box-sizing: border-box;
  overflow-x: hidden;
}
#controls {
  padding-right: 10px;
 
}
#controls {
  position: fixed;               /* fixes controls to the viewport */
  top: 65px;                     /* offset: height of .header-bar */
  left: 0;
  width: 100vw;
  z-index: 1000;
  background-color: 1a1a1a;        /* match your bg or panel */
  box-shadow: 0 1px 6px rgba(20,30,40,0.13);
  padding: 12px 24px 12px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  border-bottom: 1px solid #23263a;
}
.add-heading-btn{
  margin-bottom: 0px;
}
.expand-collapse-row {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-bottom: 10px;
}

/* By default, make both buttons equal width in the row */



#controls{
  margin-top: 0px;
  background-color: #1a1a1a;
  padding-top: 15px;
  padding-bottom: 20px;
}
.header-bar, #controls{
  background-color: #0f1117;
}
body{
  background-color: #0f1117;
}
details, .summary-bar{
  background-color: #1c202b;
}

.heading-text{
  color: #9c9b9b;
}
#searchInput{
  border-radius: 10px;
}
#expandAll:hover{
  background-color: #2e3549;
}
tr{
  border: 2px solid rgb(45, 45, 65);
}
.dropdown-toggle{
  color: #979595;
  background-color: #232731;
  transition: background-color 0.3s ease, color 0.3s ease;
}
.dropdown-toggle:hover{
background-color: #343946;
  border-color: #444444;
  color: #a8a6a6;
}
.add-problem-btn {
  background-color: #232731;
  border: 1px solid #3b4853;
  padding: 8px 10px;
  border-radius: 4px;
  color: #979595;
  font-weight: bold;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.add-problem-btn:hover {
  background-color: #343946;
  border-color: #444444;
  color: #a8a6a6;
  
}
details:hover{
  background-color: rgba(76, 135, 175, 0.1);
}
html, body {
  height: 100%;
  min-height: 100vh;
  box-sizing: border-box;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
#appContent, #container {
  flex: 1 1 auto;
}
.dropdown-menu{
  background-color: #14171f;
}
.dropdown-menu button:hover{
  background-color: #ced0d4;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.dropdown-menu button:hover{
  background-color: #4a4b4e;
  color: white;
}
#expandAll{
  background-color: #0f1117;
  padding: 6px 14px;
  border-radius: 8px;
  border: 2px solid #2e3549 !important;
}
#collapseAll{
  border: 2px solid #2e3549 !important;
  transition: background-color 0.2s ease;
}
#collapseAll:hover{
  background-color: #0f1117;
  

}
#save-problem-btn{
  padding: 6px 20px;
  background-color: #363741;
  border: 1px solid #67676e;
  transition: background-color 0.2s ease;
}
#save-problem-btn:hover{
  background-color: #0f1117;
}
.addform {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  
}
.addform input[type="text"] {
  flex: 1 1 0;
  min-width: 0;
}
.addform button {
  white-space: nowrap;
}
/* Enhanced Share Modal Styles */
.share-modal-content {
  max-width: 480px;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #1a1d26 0%, #232731 100%);
  border: 1px solid #3b4853;
}

.share-modal-header {
  text-align: center;
  padding: 32px 32px 24px;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%);
  border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
  border-radius: 50%;
  color: white;
  margin-bottom: 16px;
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
  animation: shareIconPulse 2s ease-in-out infinite;
}

@keyframes shareIconPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3); }
  50% { transform: scale(1.05); box-shadow: 0 12px 35px rgba(76, 175, 80, 0.4); }
}

.share-modal-header h2 {
  font-size: 1.5em;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.share-description {
  color: #b0b3ba;
  font-size: 14px;
  margin: 0;
}

.share-code-container {
  padding: 24px 32px;
  background: #14171f;
  border-top: 1px solid #2a2d37;
  border-bottom: 1px solid #2a2d37;
}

.share-code-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 12px;
}

.share-code-display {
  background: #0f1117;
  border: 2px solid #4CAF50;
  border-radius: 12px;
  padding: 20px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 1.3em;
  font-weight: bold;
  color: #4CAF50;
  letter-spacing: 3px;
  text-align: center;
  word-break: break-all;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.share-code-display::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #4CAF50, transparent);
  animation: codeShimmer 2s ease-in-out infinite;
}

@keyframes codeShimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

.copy-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  width: 100%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.copy-share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(76, 175, 80, 0.4);
  background: linear-gradient(135deg, #45a049, #4CAF50);
}

.copy-share-btn:active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.copy-share-btn.copied {
  background: linear-gradient(135deg, #22ee98, #00d9ff);
  box-shadow: 0 4px 15px rgba(34, 238, 152, 0.4);
}

.copy-icon {
  transition: transform 0.2s ease;
}

.copy-share-btn:hover .copy-icon {
  transform: scale(1.1);
}

.share-info-panel {
  padding: 24px 32px;
  background: rgba(76, 175, 80, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.timer-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 193, 7, 0.1);
  padding: 8px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.timer-container svg {
  color: #FFC107;
}

.timer-text {
  font-family: 'Monaco', monospace;
  font-weight: 600;
  color: #FFC107;
  font-size: 14px;
}

.timer-text.expired {
  color: #ff4567;
  animation: timerBlink 1s ease-in-out infinite;
}

@keyframes timerBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.share-instructions {
  color: #b0b3ba;
  font-size: 13px;
  line-height: 1.5;
}

/* Mobile responsiveness */
@media (max-width: 520px) {
  .share-modal-content {
    max-width: 95vw;
    margin: 20px;
  }
  
  .share-modal-header,
  .share-code-container,
  .share-info-panel {
    padding-left: 20px;
    padding-right: 20px;
  }
  
  .share-code-display {
    font-size: 1.1em;
    letter-spacing: 2px;
    padding: 16px;
  }
}

/* Success animation */
.modal.share-success .share-icon {
  background: linear-gradient(135deg, #22ee98, #00d9ff);
  animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}
/* Perfect Fit Delete Modal - No Scrollbars */
.delete-modal-content {
  max-width: min(460px, 90vw);
  max-height: 90vh; /* Reserve 10vh for safe margins */
  width: 100%;
  padding: 0;
  background: linear-gradient(145deg, #1a1d26 0%, #232731 100%);
  border: 1px solid #ff4567;
  box-shadow: 0 20px 60px rgba(255, 69, 103, 0.2);
  margin: 5vh auto; /* Center with safe margins */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* No scrollbars ever */
  border-radius: 12px;
}

/* Compact header - fixed height */
.delete-modal-header {
  text-align: center;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, rgba(255, 69, 103, 0.1) 0%, rgba(255, 69, 103, 0.05) 100%);
  border-bottom: 1px solid rgba(255, 69, 103, 0.2);
  flex-shrink: 0; /* Never compress */
}

/* Smaller, fixed-size warning icon */
.warning-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #ff4567, #ff6b8a);
  border-radius: 50%;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(255, 69, 103, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: warningPulse 2s ease-in-out infinite;
}

.warning-icon svg {
  width: 24px;
  height: 24px;
}

/* Compact title */
.delete-modal-header h2 {
  font-size: 1.3em;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

/* Minimal warning badge */
.delete-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 69, 103, 0.15);
  color: #ff6b8a;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Flexible content area - takes available space */
.delete-content-section {
  padding: 20px 24px;
  flex: 1; /* Takes remaining space */
  min-height: 0; /* Allow flexbox to compress if needed */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Compact message */
.delete-message {
  color: #e0e0e0;
  line-height: 1.4;
  font-size: 13px;
  margin-bottom: 18px;
  background: rgba(255, 69, 103, 0.05);
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid #ff4567;
  flex-shrink: 0;
}

/* Compact confirmation section */
.confirmation-input-section {
  margin-top: 16px;
}

.confirmation-label {
  display: block;
  margin-bottom: 8px;
  color: #b0b3ba;
  font-size: 12px;
  font-weight: 500;
}

.target-name {
  color: #ff6b8a;
  background: rgba(255, 69, 103, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: 'Monaco', monospace;
  font-size: 11px;
}

/* Compact input */
.input-wrapper {
  position: relative;
  margin-bottom: 6px;
}

.confirmation-input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  background: #14171f;
  border: 2px solid #3a3d47;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-feedback {
  font-size: 11px;
  color: #888;
  height: 16px; /* Fixed height to prevent layout shift */
  transition: color 0.3s ease;
}

/* Perfect Fit Delete Modal - No Scrollbars */
.delete-modal-content {
  max-width: min(460px, 90vw);
  max-height: 90vh; /* Reserve 10vh for safe margins */
  width: 100%;
  padding: 0;
  background: linear-gradient(145deg, #1a1d26 0%, #232731 100%);
  border: 1px solid #ff4567;
  box-shadow: 0 20px 60px rgba(255, 69, 103, 0.2);
  margin: 5vh auto; /* Center with safe margins */
  display: flex;
  flex-direction: column;
  overflow: hidden; /* No scrollbars ever */
  border-radius: 12px;
}

/* Compact header - fixed height */
.delete-modal-header {
  text-align: center;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, rgba(255, 69, 103, 0.1) 0%, rgba(255, 69, 103, 0.05) 100%);
  border-bottom: 1px solid rgba(255, 69, 103, 0.2);
  flex-shrink: 0; /* Never compress */
}

/* Smaller, fixed-size warning icon */
.warning-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #ff4567, #ff6b8a);
  border-radius: 50%;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(255, 69, 103, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  animation: warningPulse 2s ease-in-out infinite;
}

.warning-icon svg {
  width: 24px;
  height: 24px;
}

/* Compact title */
.delete-modal-header h2 {
  font-size: 1.3em;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

/* Minimal warning badge */
.delete-warning-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 69, 103, 0.15);
  color: #ff6b8a;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Flexible content area - takes available space */
.delete-content-section {
  padding: 20px 24px;
  flex: 1; /* Takes remaining space */
  min-height: 0; /* Allow flexbox to compress if needed */
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Compact message */
.delete-message {
  color: #e0e0e0;
  line-height: 1.4;
  font-size: 13px;
  margin-bottom: 18px;
  background: rgba(255, 69, 103, 0.05);
  padding: 12px;
  border-radius: 6px;
  border-left: 3px solid #ff4567;
  flex-shrink: 0;
}

/* Compact confirmation section */
.confirmation-input-section {
  margin-top: 16px;
}

.confirmation-label {
  display: block;
  margin-bottom: 8px;
  color: #b0b3ba;
  font-size: 12px;
  font-weight: 500;
}

.target-name {
  color: #ff6b8a;
  background: rgba(255, 69, 103, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: 'Monaco', monospace;
  font-size: 11px;
}

/* Compact input */
.input-wrapper {
  position: relative;
  margin-bottom: 6px;
}

.confirmation-input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  background: #14171f;
  border: 2px solid #3a3d47;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  box-sizing: border-box;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-feedback {
  font-size: 11px;
  color: #888;
  height: 16px; /* Fixed height to prevent layout shift */
  transition: color 0.3s ease;
}

/* Fixed-height actions */
.delete-actions {
  padding: 18px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid #2a2d37;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-shrink: 0; /* Never compress */
}

/* Compact buttons */
.delete-cancel,
.delete-confirm-btn {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* No footer on constrained layouts */
.delete-warning-footer {
  display: none;
}

/* Mobile optimizations */
@media (max-width: 480px) {
  .delete-modal-content {
    max-width: 95vw;
    max-height: 85vh;
    margin: 7.5vh auto;
  }
  
  .delete-modal-header {
    padding: 16px 20px 12px;
  }
  
  .delete-content-section {
    padding: 16px 20px;
  }
  
  .delete-actions {
    padding: 14px 20px;
    flex-direction: column;
    gap: 8px;
  }
  
  .delete-cancel,
  .delete-confirm-btn {
    width: 100%;
    justify-content: center;
    padding: 10px;
  }
  
  .warning-icon {
    width: 40px;
    height: 40px;
  }
  
  .warning-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .delete-modal-content {
    max-height: 95vh;
    margin: 2.5vh auto;
  }
  
  .delete-modal-header {
    padding: 12px 20px 8px;
  }
  
  .warning-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
  }
  
  .delete-modal-header h2 {
    font-size: 1.1em;
    margin-bottom: 4px;
  }
  
  .delete-warning-badge {
    font-size: 9px;
    padding: 3px 8px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .delete-modal-content {
    max-width: 98vw;
    margin: 5vh auto;
  }
  
  .delete-modal-header,
  .delete-content-section,
  .delete-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .confirmation-input {
    font-size: 12px;
    padding: 8px 35px 8px 10px;
  }
}
/* Restore and style the delete warning footer */
.delete-warning-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: rgba(255, 69, 103, 0.08);
  color: #ff8a9e;
  font-size: 11px;
  font-weight: 500;
  border-top: 1px solid rgba(255, 69, 103, 0.15);
  text-align: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.delete-warning-footer svg {
  width: 14px;
  height: 14px;
  color: #ff6b8a;
  flex-shrink: 0;
}
/* Improved delete button with better visual hierarchy */
.delete-confirm-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #4a4b4e;
  color: #888;
  border: 2px solid #4a4b4e;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: not-allowed;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 140px;
  justify-content: center;
}

/* Active delete button state */
.delete-confirm-btn:not(:disabled) {
  background: linear-gradient(135deg, #ff4567, #ff6b8a);
  color: white;
  border-color: #ff4567;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 69, 103, 0.35);
  transform: translateY(0);
}

.delete-confirm-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 69, 103, 0.45);
  background: linear-gradient(135deg, #e63946, #ff4567);
}

.delete-confirm-btn:not(:disabled):active {
  transform: translateY(0);
  box-shadow: 0 4px 15px rgba(255, 69, 103, 0.35);
}

/* Loading state for delete button */
.delete-confirm-btn.deleting {
  background: linear-gradient(135deg, #ff6b8a, #ff8fa3) !important;
  cursor: wait !important;
  color: white;
}

.delete-confirm-btn.deleting::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: deleteProgress 1.5s ease-in-out infinite;
}

@keyframes deleteProgress {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Enhanced cancel button to match */
.delete-cancel {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: #b0b3ba;
  border: 2px solid #3a3d47;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 100px;
  justify-content: center;
}

.delete-cancel:hover {
  background: #2a2d37;
  color: #fff;
  border-color: #4a4b4e;
  transform: translateY(-1px);
}

/* Button icons */
.delete-confirm-btn svg,
.delete-cancel svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
/* Share Modal Size Adjustments - Perfect Fit */
.share-modal-content {
  max-width: min(460px, 90vw);
  max-height: 90vh;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #1a1d26 0%, #232731 100%);
  border: 1px solid #4CAF50;
  margin: 5vh auto;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(76, 175, 80, 0.2);
}

/* Compact header */
.share-modal-header {
  text-align: center;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(76, 175, 80, 0.05) 100%);
  border-bottom: 1px solid rgba(76, 175, 80, 0.2);
  flex-shrink: 0;
}

/* Smaller share icon */
.share-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #4CAF50, #66BB6A);
  border-radius: 50%;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.3);
  animation: shareIconPulse 2s ease-in-out infinite;
}

.share-icon svg {
  width: 24px;
  height: 24px;
}

/* Compact title */
.share-modal-header h2 {
  font-size: 1.3em;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

/* Compact description */
.share-description {
  color: #b0b3ba;
  font-size: 12px;
  margin: 0;
}

/* Code container with proper spacing */
.share-code-container {
  padding: 20px 24px;
  background: #14171f;
  border-top: 1px solid #2a2d37;
  border-bottom: 1px solid #2a2d37;
  flex-shrink: 0;
}

.share-code-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 10px;
}

/* Compact code display */
.share-code-display {
  background: #0f1117;
  border: 2px solid #4CAF50;
  border-radius: 10px;
  padding: 16px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 1.1em;
  font-weight: bold;
  color: #4CAF50;
  letter-spacing: 2px;
  text-align: center;
  word-break: break-all;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Compact copy button */
.copy-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(135deg, #4CAF50, #45a049);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  width: 100%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

/* Info panel with proper spacing */
.share-info-panel {
  padding: 18px 24px;
  background: rgba(76, 175, 80, 0.05);
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
  text-align: center;
  flex: 1;
  min-height: 0;
}

/* Compact timer container */
.timer-container {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 193, 7, 0.1);
  padding: 6px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255, 193, 7, 0.3);
}

.timer-text {
  font-family: 'Monaco', monospace;
  font-weight: 600;
  color: #FFC107;
  font-size: 12px;
}

/* Compact instructions */
.share-instructions {
  color: #b0b3ba;
  font-size: 12px;
  line-height: 1.4;
}

/* Compact actions */
.share-modal-content .modal-actions {
  padding: 16px 24px;
  flex-shrink: 0;
}

.share-modal-content .modal-cancel {
  padding: 10px 20px;
  font-size: 13px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .share-modal-content {
    max-width: 95vw;
    max-height: 85vh;
    margin: 7.5vh auto;
  }
  
  .share-modal-header {
    padding: 16px 20px 12px;
  }
  
  .share-code-container {
    padding: 16px 20px;
  }
  
  .share-info-panel {
    padding: 14px 20px;
  }
  
  .share-modal-content .modal-actions {
    padding: 12px 20px;
  }
  
  .share-icon {
    width: 40px;
    height: 40px;
  }
  
  .share-icon svg {
    width: 20px;
    height: 20px;
  }
  
  .share-code-display {
    font-size: 1em;
    letter-spacing: 1.5px;
    padding: 12px;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .share-modal-content {
    max-height: 95vh;
    margin: 2.5vh auto;
  }
  
  .share-modal-header {
    padding: 12px 20px 8px;
  }
  
  .share-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
  }
  
  .share-modal-header h2 {
    font-size: 1.1em;
    margin-bottom: 4px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .share-modal-content {
    max-width: 98vw;
    margin: 5vh auto;
  }
  
  .share-modal-header,
  .share-code-container,
  .share-info-panel,
  .share-modal-content .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
  
  .share-code-display {
    font-size: 0.9em;
    padding: 10px;
  }
}
/* Receive Modal Styles */
.receive-modal-content {
  max-width: min(460px, 90vw);
  max-height: 90vh;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #1a1d26 0%, #232731 100%);
  border: 1px solid #2196F3;
  margin: 5vh auto;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(33, 150, 243, 0.2);
}

/* Header styling */
.receive-modal-header {
  text-align: center;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, rgba(33, 150, 243, 0.1) 0%, rgba(33, 150, 243, 0.05) 100%);
  border-bottom: 1px solid rgba(33, 150, 243, 0.2);
  flex-shrink: 0;
}

.receive-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #2196F3, #42A5F5);
  border-radius: 50%;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3);
  animation: receiveIconPulse 2s ease-in-out infinite;
}

@keyframes receiveIconPulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.3);
  }
  50% { 
    transform: scale(1.05); 
    box-shadow: 0 8px 25px rgba(33, 150, 243, 0.4);
  }
}

.receive-icon svg {
  width: 24px;
  height: 24px;
}

.receive-modal-header h2 {
  font-size: 1.3em;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.receive-description {
  color: #b0b3ba;
  font-size: 12px;
  margin: 0;
}

/* Code input container */
.receive-code-container {
  padding: 20px 24px;
  background: #14171f;
  border-top: 1px solid #2a2d37;
  border-bottom: 1px solid #2a2d37;
  flex-shrink: 0;
}

.receive-code-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 10px;
}

.input-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.receive-code-input {
  width: 100%;
  padding: 14px 50px 14px 16px;
  background: #0f1117;
  border: 2px solid #3a3d47;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  font-family: 'Monaco', 'Menlo', monospace;
  letter-spacing: 1px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
  text-transform: uppercase;
}

.receive-code-input:focus {
  outline: none;
  border-color: #2196F3;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
  background: #0a0c10;
}

.receive-code-input.valid {
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.receive-code-input.invalid {
  border-color: #ff4567;
  box-shadow: 0 0 0 3px rgba(255, 69, 103, 0.1);
}

#receiveInputStatus {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#receiveInputStatus.show {
  opacity: 1;
}

#receiveInputStatus .status-icon {
  color: #4CAF50;
}

.input-feedback {
  font-size: 11px;
  color: #888;
  transition: color 0.3s ease;
}

.input-feedback.valid {
  color: #4CAF50;
}

.input-feedback.invalid {
  color: #ff4567;
}

/* Receive button */
.receive-content-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #4a4b4e;
  color: #888;
  border: none;
  padding: 12px 20px;
  border-radius: 10px;
  cursor: not-allowed;
  font-weight: 600;
  font-size: 13px;
  width: 100%;
  margin-top: 16px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.receive-content-btn:not(:disabled) {
  background: linear-gradient(135deg, #2196F3, #42A5F5);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

.receive-content-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(33, 150, 243, 0.4);
  background: linear-gradient(135deg, #1976D2, #2196F3);
}

.receive-content-btn.receiving {
  background: linear-gradient(135deg, #42A5F5, #64B5F6) !important;
  cursor: wait !important;
}

.receive-content-btn.receiving::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: receiveProgress 1.5s ease-in-out infinite;
}

@keyframes receiveProgress {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Info panel */
.receive-info-panel {
  padding: 18px 24px;
  background: rgba(33, 150, 243, 0.05);
  flex: 1;
  min-height: 0;
}

.receive-instructions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #b0b3ba;
  font-size: 12px;
}

.instruction-item svg {
  color: #2196F3;
  flex-shrink: 0;
}

/* Actions */
.receive-modal-content .modal-actions {
  padding: 16px 24px;
  flex-shrink: 0;
}

.receive-modal-content .modal-cancel {
  padding: 10px 20px;
  font-size: 13px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .receive-modal-content {
    max-width: 95vw;
    max-height: 85vh;
    margin: 7.5vh auto;
  }
  
  .receive-modal-header {
    padding: 16px 20px 12px;
  }
  
  .receive-code-container {
    padding: 16px 20px;
  }
  
  .receive-info-panel {
    padding: 14px 20px;
  }
  
  .receive-modal-content .modal-actions {
    padding: 12px 20px;
  }
  
  .receive-icon {
    width: 40px;
    height: 40px;
  }
  
  .receive-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .receive-modal-content {
    max-height: 95vh;
    margin: 2.5vh auto;
  }
  
  .receive-modal-header {
    padding: 12px 20px 8px;
  }
  
  .receive-icon {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
  }
  
  .receive-modal-header h2 {
    font-size: 1.1em;
    margin-bottom: 4px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .receive-modal-content {
    max-width: 98vw;
    margin: 5vh auto;
  }
  
  .receive-modal-header,
  .receive-code-container,
  .receive-info-panel,
  .receive-modal-content .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
}
/* Move Modal Styles */
.move-modal-content {
  max-width: min(480px, 90vw);
  max-height: 90vh;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #1a1d26 0%, #232731 100%);
  border: 1px solid #FF9800;
  margin: 5vh auto;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(255, 152, 0, 0.2);
}

/* Header styling */
.move-modal-header {
  text-align: center;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, rgba(255, 152, 0, 0.1) 0%, rgba(255, 152, 0, 0.05) 100%);
  border-bottom: 1px solid rgba(255, 152, 0, 0.2);
  flex-shrink: 0;
}

.move-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #FF9800, #FFB74D);
  border-radius: 50%;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(255, 152, 0, 0.3);
  animation: moveIconPulse 2s ease-in-out infinite;
}

@keyframes moveIconPulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 6px 20px rgba(255, 152, 0, 0.3);
  }
  50% { 
    transform: scale(1.05); 
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
  }
}

.move-icon svg {
  width: 24px;
  height: 24px;
}

.move-modal-header h2 {
  font-size: 1.3em;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.move-description {
  color: #b0b3ba;
  font-size: 12px;
  margin: 0;
}

/* Problem info section */
.move-problem-info {
  padding: 16px 24px;
  background: #14171f;
  border-bottom: 1px solid #2a2d37;
  flex-shrink: 0;
}

.problem-preview {
  background: rgba(255, 152, 0, 0.05);
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid #FF9800;
}

.preview-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 6px;
}

.problem-name {
  color: #FFB74D;
  font-weight: 600;
  font-size: 14px;
  word-break: break-word;
}

/* Heading selection */
.move-selection-container {
  padding: 20px 24px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.selection-label {
  font-size: 12px;
  color: #b0b3ba;
  margin-bottom: 16px;
  font-weight: 500;
}

.headings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
}

.heading-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: #2a2d37;
  border: 2px solid #3a3d47;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.heading-option:hover {
  background: #343946;
  border-color: #FF9800;
  transform: translateY(-1px);
}

.heading-option.selected {
  background: rgba(255, 152, 0, 0.1);
  border-color: #FF9800;
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.1);
}

.heading-option-radio {
  width: 18px;
  height: 18px;
  border: 2px solid #4a4b4e;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.3s ease;
}

.heading-option.selected .heading-option-radio {
  border-color: #FF9800;
}

.heading-option.selected .heading-option-radio::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 8px;
  height: 8px;
  background: #FF9800;
  border-radius: 50%;
}

.heading-option-info {
  flex: 1;
}

.heading-option-name {
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.heading-option-details {
  color: #888;
  font-size: 11px;
}

/* Move button */
.move-confirm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #4a4b4e;
  color: #888;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: not-allowed;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 140px;
}

.move-confirm-btn:not(:disabled) {
  background: linear-gradient(135deg, #FF9800, #FFB74D);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 152, 0, 0.3);
}

.move-confirm-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(255, 152, 0, 0.4);
  background: linear-gradient(135deg, #F57C00, #FF9800);
}

.move-confirm-btn.moving {
  background: linear-gradient(135deg, #FFB74D, #FFCC80) !important;
  cursor: wait !important;
}

.move-confirm-btn.moving::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: moveProgress 1.5s ease-in-out infinite;
}

@keyframes moveProgress {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Actions */
.move-modal-content .modal-actions {
  padding: 16px 24px;
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.move-modal-content .modal-cancel {
  padding: 11px 18px;
  font-size: 13px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .move-modal-content {
    max-width: 95vw;
    max-height: 85vh;
    margin: 7.5vh auto;
  }
  
  .move-modal-header {
    padding: 16px 20px 12px;
  }
  
  .move-problem-info {
    padding: 12px 20px;
  }
  
  .move-selection-container {
    padding: 16px 20px;
  }
  
  .move-modal-content .modal-actions {
    padding: 12px 20px;
    flex-direction: column;
  }
  
  .move-confirm-btn,
  .move-modal-content .modal-cancel {
    width: 100%;
    justify-content: center;
  }
  
  .move-icon {
    width: 40px;
    height: 40px;
  }
  
  .move-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* Landscape mobile */
@media (max-width: 768px) and (orientation: landscape) {
  .move-modal-content {
    max-height: 95vh;
    margin: 2.5vh auto;
  }
  
  .move-selection-container {
    padding: 12px 20px;
  }
  
  .headings-list {
    max-height: 150px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .move-modal-content {
    max-width: 98vw;
    margin: 5vh auto;
  }
  
  .move-modal-header,
  .move-problem-info,
  .move-selection-container,
  .move-modal-content .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
}
/* Insert Modal Styles */
.insert-modal-content {
  max-width: min(460px, 90vw);
  max-height: 90vh;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: linear-gradient(145deg, #1a1d26 0%, #232731 100%);
  border: 1px solid #9C27B0;
  margin: 5vh auto;
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(156, 39, 176, 0.2);
}

/* Header styling */
.insert-modal-header {
  text-align: center;
  padding: 20px 24px 16px;
  background: linear-gradient(135deg, rgba(156, 39, 176, 0.1) 0%, rgba(156, 39, 176, 0.05) 100%);
  border-bottom: 1px solid rgba(156, 39, 176, 0.2);
  flex-shrink: 0;
}

.insert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #9C27B0, #BA68C8);
  border-radius: 50%;
  color: white;
  margin-bottom: 12px;
  box-shadow: 0 6px 20px rgba(156, 39, 176, 0.3);
  animation: insertIconPulse 2s ease-in-out infinite;
}

@keyframes insertIconPulse {
  0%, 100% { 
    transform: scale(1); 
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.3);
  }
  50% { 
    transform: scale(1.05); 
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.4);
  }
}

.insert-icon svg {
  width: 24px;
  height: 24px;
}

.insert-modal-header h2 {
  font-size: 1.3em;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.insert-description {
  color: #b0b3ba;
  font-size: 12px;
  margin: 0;
}

/* Position info section */
.insert-position-info {
  padding: 16px 24px;
  background: #14171f;
  border-bottom: 1px solid #2a2d37;
  flex-shrink: 0;
}

.position-preview {
  background: rgba(156, 39, 176, 0.05);
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 3px solid #9C27B0;
}

.preview-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 6px;
}

.current-name {
  color: #BA68C8;
  font-weight: 600;
  font-size: 14px;
  word-break: break-word;
}

/* Input container */
.insert-input-container {
  padding: 20px 24px;
  flex: 1;
  min-height: 0;
}

.input-label {
  font-size: 12px;
  color: #b0b3ba;
  margin-bottom: 12px;
  font-weight: 500;
}

.input-wrapper {
  position: relative;
  margin-bottom: 8px;
}

.insert-title-input {
  width: 100%;
  padding: 14px 50px 14px 16px;
  background: #0f1117;
  border: 2px solid #3a3d47;
  border-radius: 10px;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.insert-title-input:focus {
  outline: none;
  border-color: #9C27B0;
  box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
  background: #0a0c10;
}

.insert-title-input.valid {
  border-color: #4CAF50;
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

#insertInputStatus {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

#insertInputStatus.show {
  opacity: 1;
}

#insertInputStatus .status-icon {
  color: #4CAF50;
}

.input-feedback {
  font-size: 11px;
  color: #888;
  transition: color 0.3s ease;
  height: 16px;
}

.input-feedback.valid {
  color: #4CAF50;
}

/* Insert button */
.insert-confirm-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #4a4b4e;
  color: #888;
  border: none;
  padding: 11px 18px;
  border-radius: 10px;
  cursor: not-allowed;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  min-width: 140px;
}

.insert-confirm-btn:not(:disabled) {
  background: linear-gradient(135deg, #9C27B0, #BA68C8);
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
}

.insert-confirm-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(156, 39, 176, 0.4);
  background: linear-gradient(135deg, #7B1FA2, #9C27B0);
}

.insert-confirm-btn.inserting {
  background: linear-gradient(135deg, #BA68C8, #CE93D8) !important;
  cursor: wait !important;
}

.insert-confirm-btn.inserting::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: insertProgress 1.5s ease-in-out infinite;
}

@keyframes insertProgress {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Actions */
.insert-modal-content .modal-actions {
  padding: 16px 24px;
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.insert-modal-content .modal-cancel {
  padding: 11px 18px;
  font-size: 13px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .insert-modal-content {
    max-width: 95vw;
    max-height: 85vh;
    margin: 7.5vh auto;
  }
  
  .insert-modal-header {
    padding: 16px 20px 12px;
  }
  
  .insert-position-info {
    padding: 12px 20px;
  }
  
  .insert-input-container {
    padding: 16px 20px;
  }
  
  .insert-modal-content .modal-actions {
    padding: 12px 20px;
    flex-direction: column;
  }
  
  .insert-confirm-btn,
  .insert-modal-content .modal-cancel {
    width: 100%;
    justify-content: center;
  }
  
  .insert-icon {
    width: 40px;
    height: 40px;
  }
  
  .insert-icon svg {
    width: 20px;
    height: 20px;
  }
}

/* Very small screens */
@media (max-width: 320px) {
  .insert-modal-content {
    max-width: 98vw;
    margin: 5vh auto;
  }
  
  .insert-modal-header,
  .insert-position-info,
  .insert-input-container,
  .insert-modal-content .modal-actions {
    padding-left: 16px;
    padding-right: 16px;
  }
}
/* Mobile Header Layout Fix */
@media (max-width: 768px) {
  .header-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
  }
  
  /* User badge on the left */
  #usernameDisplay {
    order: 1;
    flex-shrink: 0;
  }
  
  /* Title in the center */
  .header-title {
    order: 2;
    flex: 1;
    justify-content: center;
  }
  
  .header-title h2 {
    font-size: 1.2rem;
  }
  
  /* Actions on the right */
  .header-actions {
    order: 3;
    flex-shrink: 0;
    gap: 6px;
  }
  
  /* Make buttons small icons */
  .header-btn {
    padding: 8px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }
  
  .header-btn span {
    display: none;
  }
  
  .header-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .header-bar {
    padding: 8px 10px;
  }
  
  .header-title h2 {
    font-size: 1.1rem;
  }
  
  .header-btn {
    padding: 6px;
    min-width: 32px;
    height: 32px;
  }
  
  .header-btn svg {
    width: 16px;
    height: 16px;
  }
  
  /* Make user badge smaller on very small screens */
  #usernameDisplay {
    font-size: 0.85rem;
    padding: 0.25em 0.7em;
  }
  
  #usernameDisplay .user-avatar {
    width: 1.8em;
    height: 1.8em;
  }
  
  #usernameDisplay .username {
    font-size: 12px;
  }
}

/* Extra small screens - hide username text */
@media (max-width: 360px) {
  #usernameDisplay .username {
    display: none;
  }
  
  #usernameDisplay {
    padding: 0.4em;
    min-width: auto;
  }
}
/* Mobile Header Layout - Show Essential Elements */
@media (max-width: 768px) {
  .header-bar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
  }
  
  /* Keep user badge visible but smaller */
  #usernameDisplay {
    order: 1;
    flex-shrink: 0;
    font-size: 0.85rem;
    padding: 0.25em 0.6em;
    gap: 0.4em;
  }
  
  #usernameDisplay .user-avatar {
    width: 1.8em;
    height: 1.8em;
  }
  
  #usernameDisplay .username {
    font-size: 12px;
  }
  
  /* Keep title visible but smaller */
  .header-title {
    order: 2;
    flex: 1;
    justify-content: center;
  }
  
  .header-title h2 {
    font-size: 1.1rem;
  }
  
  /* Actions on the right - both buttons as icons */
  .header-actions {
    order: 3;
    flex-shrink: 0;
    gap: 6px;
  }
  
  /* Make all header buttons small icons */
  .header-btn {
    padding: 8px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }
  
  /* Hide button text, show only icons */
  .header-btn span {
    display: none !important;
  }
  
  .header-btn svg {
    width: 18px;
    height: 18px;
  }
}

/* Very small screens - hide username but keep everything else */
@media (max-width: 480px) {
  .header-bar {
    padding: 8px 10px;
  }
  
  .header-title h2 {
    font-size: 1rem;
  }
  
  .header-btn {
    padding: 6px;
    min-width: 32px;
    height: 32px;
  }
  
  .header-btn svg {
    width: 16px;
    height: 16px;
  }
  
  /* Hide username text but keep user avatar */
  #usernameDisplay .username {
    display: none;
  }
  
  #usernameDisplay {
    padding: 0.4em;
    min-width: auto;
  }
}

/* Extra small screens - minimal layout but all elements visible */
@media (max-width: 360px) {
  .header-bar {
    gap: 6px;
    padding: 6px 8px;
  }
  
  .header-title h2 {
    font-size: 0.9rem;
  }
  
  .header-btn {
    padding: 5px;
    min-width: 28px;
    height: 28px;
  }
  
  .header-btn svg {
    width: 14px;
    height: 14px;
  }
}
/* Reduced padding for logout icon on mobile */
@media (max-width: 768px) {
  .header-btn.logout-btn,
  #logoutBtn {
    padding: 6px;
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }
  
  /* Hide the "Logout" text, show only icon */
  .header-btn.logout-btn span,
  #logoutBtn span {
    display: none !important;
  }
  
  /* Ensure SVG icon is properly sized */
  .header-btn.logout-btn svg,
  #logoutBtn svg {
    width: 16px;
    height: 16px;
  }
}

/* Very small screens - even more compact */
@media (max-width: 480px) {
  .header-btn.logout-btn,
  #logoutBtn {
    padding: 4px;
    min-width: 28px;
    height: 28px;
  }
  
  .header-btn.logout-btn svg,
  #logoutBtn svg {
    width: 14px;
    height: 14px;
  }
}

/* Extra small screens - minimal padding */
@media (max-width: 360px) {
  .header-btn.logout-btn,
  #logoutBtn {
    padding: 3px;
    min-width: 26px;
    height: 26px;
  }
  
  .header-btn.logout-btn svg,
  #logoutBtn svg {
    width: 13px;
    height: 13px;
  }
}
/* Mobile Controls Layout - Single Row */
/* Mobile Controls - Single Row Layout - REPLACE ALL MOBILE CONTROLS CSS */
/* Mobile Controls - Fixed Horizontal Scroll Issue */
@media (max-width: 768px) {
  #controls {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;  /* Use left/right instead of width: 100vw */
    z-index: 1000;
    background-color: #0f1117;
    border-bottom: 1px solid #23263a;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* Perfect single row alignment - NO OVERFLOW */
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    /* Remove overflow-x: auto to prevent scrollbar */
    height: 64px;
    box-sizing: border-box;
  }
  
  /* Reset all orders */
  #controls > * {
    order: initial !important;
  }
  
  /* Search input - flexible but constrained */
  #searchInput {
    flex: 1 1 0 !important;  /* Changed from 'auto' to '0' */
    min-width: 80px !important;  /* Reduced from 120px */
    height: 40px !important;
    padding: 0 12px !important;  /* Reduced padding */
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #2e3549;
    background: #1c202b;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: 40px;
  }
  
  /* Expand button - exactly 40px */
  #expandAll {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    border: 2px solid #2e3549;
    border-radius: 8px;
    background: #0f1117;
    color: #b0b3ba;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  #expandAll::before {
    content: "⊞";
    font-size: 18px;
    line-height: 1;
  }
  
  /* Hide collapse button */
  #collapseAll {
    display: none !important;
  }
  
  /* Checkbox - 40px height for alignment */
  #toggleShowChildren {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    appearance: none;
    border: 2px solid #404758;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  #toggleShowChildren:checked {
    background: #4CAF50;
    border-color: #4CAF50;
  }
  
  #toggleShowChildren:checked::after {
    content: "✓";
    color: white;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Add Heading button - 40px height */
  .add-heading-btn {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 10px !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 0 !important;
    font-size: 0;
    box-sizing: border-box;
    position: relative;
  }
  
  .add-heading-btn::before {
    content: "+";
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Hover states */
  #searchInput:focus {
    border-color: #6eb6fe;
    box-shadow: 0 0 0 3px rgba(110, 182, 254, 0.2);
    outline: none;
  }
  
  #expandAll:hover {
    background: #2e3549;
    border-color: #4CAF50;
    color: #4CAF50;
    transform: scale(1.05);
  }
  
  #toggleShowChildren:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
  }
  
  .add-heading-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  }
}

/* Very small screens */
@media (max-width: 480px) {
  #controls {
    height: 60px;
    padding: 10px 12px;
    gap: 6px;
  }
  
  #searchInput {
    height: 36px !important;
    line-height: 36px;
    font-size: 16px;
    min-width: 60px !important;  /* Further reduced */
    padding: 0 8px !important;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 36px !important;
    height: 30px !important;
    flex-basis: 36px !important;
  }
  
  #expandAll::before {
    font-size: 16px;
  }
  
  .add-heading-btn::before {
    font-size: 20px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 14px;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  #controls {
    height: 56px;
    padding: 8px 10px;
    gap: 4px;
  }
  
  #searchInput {
    height: 32px !important;
    line-height: 32px;
    padding: 0 6px !important;
    font-size: 14px;
    min-width: 50px !important;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
  }
  
  #expandAll::before {
    font-size: 14px;
  }
  
  .add-heading-btn::before {
    font-size: 18px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 12px;
  }
}

/* Adjust body padding */
@media (max-width: 768px) {
  body {
    padding-top: 124px !important;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 120px !important;
  }
}

@media (max-width: 360px) {
  body {
    padding-top: 116px !important;
  }
}

/* Adjust body padding */
@media (max-width: 768px) {
  body {
    padding-top: 120px !important;
  }
}
/* Mobile Controls - Fixed Height and Alignment */
@media (max-width: 768px) {
  #controls {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #0f1117;
    border-bottom: 1px solid #23263a;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* FORCE single row with proper alignment */
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    height: 56px; /* Fixed height container */
    box-sizing: border-box;
  }
  
  /* Remove all existing orders and flex properties */
  #controls > * {
    order: initial !important;
  }
  
  /* Search - takes available space with fixed height */
  #searchInput {
    flex: 1 1 auto !important;
    min-width: 120px;
    height: 40px !important; /* Fixed height */
    padding: 0 14px !important; /* Remove top/bottom padding */
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #2e3549;
    background: #1c202b;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0 !important;
    vertical-align: middle;
  }
  
  /* Expand button - fixed dimensions */
  #expandAll {
    flex: 0 0 40px !important; /* Match search height */
    width: 40px !important;
    height: 40px !important; /* Same height as search */
    border: 2px solid #2e3549;
    border-radius: 8px;
    background: #0f1117;
    color: #b0b3ba;
    cursor: pointer;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  #expandAll::before {
    content: "⊞";
    font-size: 18px;
    line-height: 1;
  }
  
  /* Hide collapse button completely */
  #collapseAll {
    display: none !important;
  }
  
  /* Checkbox - centered and properly sized */
  #toggleShowChildren {
    flex: 0 0 24px !important;
    width: 24px !important;
    height: 24px !important;
    appearance: none;
    border: 2px solid #404758;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    align-self: center; /* Center vertically */
  }
  
  #toggleShowChildren:checked {
    background: #4CAF50;
    border-color: #4CAF50;
  }
  
  #toggleShowChildren:checked::after {
    content: "✓";
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    line-height: 1;
  }
  
  /* Add Heading - match other button heights */
  .add-heading-btn {
    flex: 0 0 40px !important; /* Match other button heights */
    width: 40px !important;
    height: 40px !important; /* Same height as expand button */
    padding: 0 !important;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 0 !important;
    font-size: 0;
    box-sizing: border-box;
  }
  
  .add-heading-btn::before {
    content: "+";
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
  }
  
  /* Focus and hover states */
  #searchInput:focus {
    border-color: #6eb6fe;
    box-shadow: 0 0 0 3px rgba(110, 182, 254, 0.2);
    outline: none;
  }
  
  #expandAll:hover {
    background: #2e3549;
    border-color: #4CAF50;
    color: #4CAF50;
    transform: scale(1.05);
  }
  
  .add-heading-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  }
}

/* Very small screens - maintain proportions */
@media (max-width: 480px) {
  #controls {
    height: 52px; /* Slightly smaller container */
    padding: 10px 12px;
    gap: 6px;
  }
  
  #searchInput {
    height: 36px !important;
    font-size: 16px;
  }
  
  #expandAll,
  .add-heading-btn {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  
  #expandAll::before {
    font-size: 16px;
  }
  
  .add-heading-btn::before {
    font-size: 20px;
  }
  
  #toggleShowChildren {
    width: 22px !important;
    height: 22px !important;
    flex-basis: 22px !important;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 10px;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  #controls {
    height: 48px;
    padding: 8px 10px;
    gap: 4px;
  }
  
  #searchInput {
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 14px;
  }
  
  #expandAll,
  .add-heading-btn {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
  }
  
  #expandAll::before {
    font-size: 14px;
  }
  
  .add-heading-btn::before {
    font-size: 18px;
  }
  
  #toggleShowChildren {
    width: 20px !important;
    height: 20px !important;
    flex-basis: 20px !important;
  }
}

/* Adjust body padding for new container height */
@media (max-width: 768px) {
  body {
    padding-top: 116px !important; /* 60px header + 56px controls */
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 112px !important; /* 60px header + 52px controls */
  }
}

@media (max-width: 360px) {
  body {
    padding-top: 108px !important; /* 60px header + 48px controls */
  }
}
/* Mobile Controls - Perfect Alignment Fix */
@media (max-width: 768px) {
  #controls {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #0f1117;
    border-bottom: 1px solid #23263a;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* Perfect single row alignment */
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    height: 56px;
    box-sizing: border-box;
  }
  
  /* Reset all orders */
  #controls > * {
    order: initial !important;
  }
  
  /* Search input - consistent height */
  #searchInput {
    flex: 1 1 auto !important;
    min-width: 120px;
    height: 40px !important;
    padding: 0 14px !important;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #2e3549;
    background: #1c202b;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: 40px; /* Ensure text is vertically centered */
  }
  
  /* Expand button - exact same dimensions as search */
  #expandAll {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    border: 2px solid #2e3549;
    border-radius: 8px;
    background: #0f1117;
    color: #b0b3ba;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  #expandAll::before {
    content: "⊞";
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Hide collapse button */
  #collapseAll {
    display: none !important;
  }
  
  /* Checkbox - properly centered */
  #toggleShowChildren {
    flex: 0 0 24px !important;
    width: 24px !important;
    height: 24px !important;
    appearance: none;
    border: 2px solid #404758;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    /* Force vertical centering */
    align-self: center !important;
    flex-shrink: 0;
  }
  
  #toggleShowChildren:checked {
    background: #4CAF50;
    border-color: #4CAF50;
  }
  
  #toggleShowChildren:checked::after {
    content: "✓";
    color: white;
    font-size: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Add Heading button - exact same height as search and expand */
  .add-heading-btn {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 0 !important;
    font-size: 0;
    box-sizing: border-box;
    /* Ensure perfect centering */
    position: relative;
  }
  
  .add-heading-btn::before {
    content: "+";
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Hover states */
  #searchInput:focus {
    border-color: #6eb6fe;
    box-shadow: 0 0 0 3px rgba(110, 182, 254, 0.2);
    outline: none;
  }
  
  #expandAll:hover {
    background: #2e3549;
    border-color: #4CAF50;
    color: #4CAF50;
    transform: scale(1.05);
  }
  
  .add-heading-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  #controls {
    height: 52px;
    padding: 10px 12px;
    gap: 6px;
  }
  
  #searchInput {
    height: 36px !important;
    line-height: 36px;
    font-size: 16px;
  }
  
  #expandAll,
  .add-heading-btn {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  
  #expandAll::before {
    font-size: 16px;
  }
  
  .add-heading-btn::before {
    font-size: 20px;
  }
  
  #toggleShowChildren {
    width: 22px !important;
    height: 22px !important;
    flex-basis: 22px !important;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 10px;
  }
}

@media (max-width: 360px) {
  #controls {
    height: 48px;
    padding: 8px 10px;
    gap: 4px;
  }
  
  #searchInput {
    height: 32px !important;
    line-height: 32px;
    padding: 0 10px !important;
    font-size: 14px;
  }
  
  #expandAll,
  .add-heading-btn {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
  }
  
  #expandAll::before {
    font-size: 14px;
  }
  
  .add-heading-btn::before {
    font-size: 18px;
  }
  
  #toggleShowChildren {
    width: 20px !important;
    height: 20px !important;
    flex-basis: 20px !important;
  }
}

/* Adjust body padding */
@media (max-width: 768px) {
  body {
    padding-top: 116px !important;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 112px !important;
  }
}

@media (max-width: 360px) {
  body {
    padding-top: 108px !important;
  }
}
/* Mobile Controls - Perfect Height Alignment Fix */
@media (max-width: 768px) {
  #controls {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #0f1117;
    border-bottom: 1px solid #23263a;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* Perfect single row alignment */
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    height: 64px; /* Fixed container height */
    box-sizing: border-box;
  }
  
  /* Reset all orders */
  #controls > * {
    order: initial !important;
  }
  
  /* Search input - 40px height */
  #searchInput {
    flex: 1 1 auto !important;
    min-width: 120px;
    height: 40px !important;
    padding: 0 14px !important;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #2e3549;
    background: #1c202b;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: 40px; /* Vertically center text */
  }
  
  /* Expand button - exactly 40px height */
  #expandAll {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    border: 2px solid #2e3549;
    border-radius: 8px;
    background: #0f1117;
    color: #b0b3ba;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  #expandAll::before {
    content: "⊞";
    font-size: 18px;
    line-height: 1;
  }
  
  /* Hide collapse button */
  #collapseAll {
    display: none !important;
  }
  
  /* Checkbox - SAME 40px height as other elements */
  #toggleShowChildren {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    appearance: none;
    border: 2px solid #404758;
    border-radius: 8px; /* Match other buttons */
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  #toggleShowChildren:checked {
    background: #4CAF50;
    border-color: #4CAF50;
  }
  
  #toggleShowChildren:checked::after {
    content: "✓";
    color: white;
    font-size: 16px; /* Larger checkmark for 40px container */
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Add Heading button - exactly 40px height */
  .add-heading-btn {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 0 !important;
    font-size: 0;
    box-sizing: border-box;
    position: relative;
  }
  
  /* Perfect center alignment for plus symbol */
  .add-heading-btn::before {
    content: "+";
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Hover states */
  #searchInput:focus {
    border-color: #6eb6fe;
    box-shadow: 0 0 0 3px rgba(110, 182, 254, 0.2);
    outline: none;
  }
  
  #expandAll:hover {
    background: #2e3549;
    border-color: #4CAF50;
    color: #4CAF50;
    transform: scale(1.05);
  }
  
  #toggleShowChildren:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
  }
  
  .add-heading-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  }
}

/* Very small screens - maintain same height ratio */
@media (max-width: 480px) {
  #controls {
    height: 60px;
    padding: 10px 12px;
    gap: 6px;
  }
  
  /* All elements same height - 36px */
  #searchInput {
    height: 36px !important;
    line-height: 36px;
    font-size: 16px;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  
  #expandAll::before {
    font-size: 16px;
  }
  
  .add-heading-btn::before {
    font-size: 20px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 14px;
  }
}

/* Extra small screens - maintain same height ratio */
@media (max-width: 360px) {
  #controls {
    height: 56px;
    padding: 8px 10px;
    gap: 4px;
  }
  
  /* All elements same height - 32px */
  #searchInput {
    height: 32px !important;
    line-height: 32px;
    padding: 0 10px !important;
    font-size: 14px;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
  }
  
  #expandAll::before {
    font-size: 14px;
  }
  
  .add-heading-btn::before {
    font-size: 18px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 12px;
  }
}

/* Adjust body padding */
@media (max-width: 768px) {
  body {
    padding-top: 124px !important; /* 60px header + 64px controls */
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 120px !important; /* 60px header + 60px controls */
  }
}

@media (max-width: 360px) {
  body {
    padding-top: 116px !important; /* 60px header + 56px controls */
  }
}
/* Mobile Controls - Fixed Horizontal Scroll Issue */
@media (max-width: 768px) {
  #controls {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;  /* Use left/right instead of width: 100vw */
    z-index: 1000;
    background-color: #0f1117;
    border-bottom: 1px solid #23263a;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* Perfect single row alignment - NO OVERFLOW */
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    /* Remove overflow-x: auto to prevent scrollbar */
    height: 64px;
    box-sizing: border-box;
  }
  
  /* Reset all orders */
  #controls > * {
    order: initial !important;
  }
  
  /* Search input - flexible but constrained */
  #searchInput {
    flex: 1 1 0 !important;  /* Changed from 'auto' to '0' */
    min-width: 80px !important;  /* Reduced from 120px */
    height: 40px !important;
    padding: 0 12px !important;  /* Reduced padding */
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #2e3549;
    background: #1c202b;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: 40px;
  }
  
  /* Expand button - exactly 40px */
  #expandAll {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    border: 2px solid #2e3549;
    border-radius: 8px;
    background: #0f1117;
    color: #b0b3ba;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  #expandAll::before {
    content: "⊞";
    font-size: 18px;
    line-height: 1;
  }
  
  /* Hide collapse button */
  #collapseAll {
    display: none !important;
  }
  
  /* Checkbox - 40px height for alignment */
  #toggleShowChildren {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    appearance: none;
    border: 2px solid #404758;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  #toggleShowChildren:checked {
    background: #4CAF50;
    border-color: #4CAF50;
  }
  
  #toggleShowChildren:checked::after {
    content: "✓";
    color: white;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Add Heading button - 40px height */
  .add-heading-btn {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 0 !important;
    font-size: 0;
    box-sizing: border-box;
    position: relative;
  }
  
  .add-heading-btn::before {
    content: "+";
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Hover states */
  #searchInput:focus {
    border-color: #6eb6fe;
    box-shadow: 0 0 0 3px rgba(110, 182, 254, 0.2);
    outline: none;
  }
  
  #expandAll:hover {
    background: #2e3549;
    border-color: #4CAF50;
    color: #4CAF50;
    transform: scale(1.05);
  }
  
  #toggleShowChildren:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
  }
  
  .add-heading-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
  }
}

/* Very small screens */
@media (max-width: 480px) {
  #controls {
    height: 60px;
    padding: 10px 12px;
    gap: 6px;
  }
  
  #searchInput {
    height: 36px !important;
    line-height: 36px;
    font-size: 16px;
    min-width: 60px !important;  /* Further reduced */
    padding: 0 8px !important;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
  }
  
  #expandAll::before {
    font-size: 16px;
  }
  
  .add-heading-btn::before {
    font-size: 20px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 14px;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  #controls {
    height: 56px;
    padding: 8px 10px;
    gap: 4px;
  }
  
  #searchInput {
    height: 32px !important;
    line-height: 32px;
    padding: 0 6px !important;
    font-size: 14px;
    min-width: 50px !important;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
  }
  
  #expandAll::before {
    font-size: 14px;
  }
  
  .add-heading-btn::before {
    font-size: 18px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 12px;
  }
}

/* Adjust body padding */
@media (max-width: 768px) {
  body {
    padding-top: 124px !important;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 120px !important;
  }
}

@media (max-width: 360px) {
  body {
    padding-top: 116px !important;
  }
}
/* Global horizontal scroll prevention */


/* Mobile Controls - No Horizontal Scroll */
/* Mobile Controls - No Scrollbar Fix */
@media (max-width: 768px) {
  #controls {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #0f1117;
    border-bottom: 1px solid #23263a;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    
    /* Perfect single row alignment - NO SCROLLBARS */
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    overflow: hidden !important; /* Changed from overflow-x: auto */
    height: 64px;
    box-sizing: border-box;
  }
  
  /* Search input - properly constrained */
  #searchInput {
    flex: 1 1 0 !important;
    min-width: 60px !important; /* Reduced to prevent overflow */
    max-width: none !important;
    height: 40px !important;
    padding: 0 10px !important; /* Reduced padding */
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #2e3549;
    background: #1c202b;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: 40px;
  }
  
  /* All other elements - fixed sizes to prevent overflow */
  #expandAll {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    border: 2px solid #2e3549;
    border-radius: 8px;
    background: #0f1117;
    color: #b0b3ba;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  #expandAll::before {
    content: "⊞";
    font-size: 18px;
    line-height: 1;
  }
  
  #collapseAll {
    display: none !important;
  }
  
  #toggleShowChildren {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    appearance: none;
    border: 2px solid #404758;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  #toggleShowChildren:checked {
    background: #4CAF50;
    border-color: #4CAF50;
  }
  
  #toggleShowChildren:checked::after {
    content: "✓";
    color: white;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  .add-heading-btn {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 20px !important;
    min-width: 40px !important;
    max-width: 40px !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 0 !important;
    font-size: 0;
    box-sizing: border-box;
    position: relative;
  }
  
  .add-heading-btn::before {
    content: "+";
    font-size: 22px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

/* Smaller screens with even tighter constraints */
@media (max-width: 480px) {
  #controls {
    height: 56px;
    padding: 10px 12px;
    gap: 6px;
  }
  
  #searchInput {
    min-width: 40px !important;
    height: 36px !important;
    line-height: 36px;
    padding: 0 6px !important;
    font-size: 15px;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  #controls {
    height: 52px;
    padding: 8px 10px;
    gap: 4px;
  }
  
  #searchInput {
    min-width: 30px !important;
    height: 32px !important;
    line-height: 32px;
    padding: 0 4px !important;
    font-size: 14px;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 32px !important;
    height: 32px !important;
    flex-basis: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
  }
}


/* Very small screens - even more compact */
@media (max-width: 480px) {
  #controls {
    padding: 10px 12px;
    gap: 6px;
    height: 52px;
  }
  
  #searchInput {
    min-width: 60px !important;
    height: 36px !important;
    padding: 0 8px !important;
    line-height: 36px;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 36px !important;
    height: 36px !important;
    flex-basis: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
  }
  
  #expandAll::before {
    font-size: 16px;
  }
  
  .add-heading-btn::before {
    font-size: 20px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 14px;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  #controls {
    padding: 8px 10px;
    gap: 4px;
    height: 48px;
  }
  
  #searchInput {
    min-width: 50px !important;
    height: 32px !important;
    padding: 0 6px !important;
    font-size: 14px;
    line-height: 32px;
  }
  
  #expandAll,
  #toggleShowChildren,
  .add-heading-btn {
    width: 32px !important;
    height: 30px !important;
    flex-basis: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
  }
  
  #expandAll::before {
    font-size: 14px;
  }
  
  .add-heading-btn::before {
    font-size: 18px;
  }
  
  #toggleShowChildren:checked::after {
    font-size: 12px;
  }
}

/* Adjust body padding */
@media (max-width: 768px) {
  body {
    padding-top: 116px !important;
  }
}

@media (max-width: 480px) {
  body {
    padding-top: 112px !important;
  }
}

@media (max-width: 360px) {
  body {
    padding-top: 108px !important;
  }
}
/* Increase logout and receive icon size on mobile */
@media (max-width: 768px) {
  .header-btn svg,
  #logoutBtn svg {
    width: 22px !important;
    height: 22px !important;
  }
  
  /* Adjust button size to accommodate larger icons */
  .header-btn,
  #logoutBtn {
    min-width: 40px !important;
    height: 40px !important;
    padding: 8px !important;
  }
}

/* Very small screens - keep icons reasonably sized */
@media (max-width: 480px) {
  .header-btn svg,
  #logoutBtn svg {
    width: 20px !important;
    height: 20px !important;
  }
  
  .header-btn,
  #logoutBtn {
    min-width: 36px !important;
    height: 36px !important;
    padding: 6px !important;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .header-btn svg,
  #logoutBtn svg {
    width: 18px !important;
    height: 18px !important;
  }
  
  .header-btn,
  #logoutBtn {
    min-width: 32px !important;
    height: 32px !important;
    padding: 5px !important;
  }
}
/* Reduce plus symbol height in mobile controls */
@media (max-width: 768px) {
  .add-heading-btn::before {
    content: "+";
    font-size: 16px !important; /* Reduced from 22px */
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
}

/* Further reduction for very small screens */
@media (max-width: 480px) {
  .add-heading-btn::before {
    font-size: 16px !important; /* Reduced from 20px */
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .add-heading-btn::before {
    font-size: 14px !important; /* Reduced from 18px */
  }
}
/* Mobile Controls - Single Toggle Button */
@media (max-width: 768px) {
  #controls {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 1000;
    background-color: #0f1117;
    border-bottom: 1px solid #23263a;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex !important;
    align-items: center !important;
    gap: 8px;
    flex-wrap: nowrap !important;
    overflow: hidden !important;
    height: 64px;
    box-sizing: border-box;
  }
  
  /* Search input */
  #searchInput {
    flex: 1 1 0 !important;
    min-width: 60px !important;
    height: 40px !important;
    padding: 0 10px !important;
    font-size: 16px;
    border-radius: 10px;
    border: 2px solid #2e3549;
    background: #1c202b;
    color: #e0e0e0;
    transition: all 0.3s ease;
    box-sizing: border-box;
    margin: 0 !important;
    line-height: 40px;
  }
  
  /* Expand button - toggles between expand/collapse */
  #expandAll {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    border: 2px solid #2e3549;
    border-radius: 8px;
    background: #0f1117;
    color: #b0b3ba;
    cursor: pointer;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
  }
  
  /* Default expand symbol */
  #expandAll::before {
    content: "⊞";
    font-size: 18px;
    line-height: 1;
    transition: all 0.3s ease;
  }
  
  /* When expanded state - show collapse symbol */
  #expandAll.expanded::before {
    content: "⊟";
    color: #4CAF50;
  }
  
  /* Hide the separate collapse button in mobile */
  #collapseAll {
    display: none !important;
  }
  
  /* Checkbox */
  #toggleShowChildren {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    appearance: none;
    border: 2px solid #404758;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  
  #toggleShowChildren:checked {
    background: #4CAF50;
    border-color: #4CAF50;
  }
  
  #toggleShowChildren:checked::after {
    content: "✓";
    color: white;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Add Heading button */
  .add-heading-btn {
    flex: 0 0 40px !important;
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    color: white;
    border: none;
    border-radius: 8px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.3s ease;
    margin: 0 !important;
    font-size: 0;
    box-sizing: border-box;
    position: relative;
  }
  
  .add-heading-btn::before {
    content: "+";
    font-size: 16px !important;
    font-weight: bold;
    line-height: 1;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* Hover effects */
  #expandAll:hover {
    background: #2e3549;
    border-color: #4CAF50;
    color: #4CAF50;
  }
  
  #expandAll.expanded:hover {
    background: #2e3549;
    border-color: #ff6b6b;
    color: #ff6b6b;
  }
}
/* Mobile Add Problem Button - Show only plus symbol */
@media (max-width: 768px) {
  .add-problem-btn {
    font-size: 0; /* Hide the text */
    min-width: 32px;
    height: 32px;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .add-problem-btn::before {
    content: "+";
    font-size: 16px;
    font-weight: bold;
    color: inherit;
    line-height: 1;
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .add-problem-btn {
    min-width: 28px;
    height: 28px;
    padding: 4px;
  }
  
  .add-problem-btn::before {
    font-size: 14px;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .add-problem-btn {
    min-width: 24px;
    height: 24px;
    padding: 3px;
  }
  
  .add-problem-btn::before {
    font-size: 12px;
  }
}
/* Heading title truncation */
.heading-text {
  max-width: calc(100vw - 200px); /* Adjust based on button space needed */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

/* Problem title truncation in table rows */
.clickable-row td span:first-child {
  max-width: calc(100vw - 150px); /* Adjust based on dropdown button space */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  vertical-align: middle;
}

/* Mobile specific truncation */
@media (max-width: 768px) {
  .heading-text {
    max-width: calc(100vw - 120px); /* Less space needed on mobile */
  }
  
  .clickable-row td span:first-child {
    max-width: calc(100vw - 80px); /* Account for mobile dropdown button */
  }
}

@media (max-width: 480px) {
  .heading-text {
    max-width: calc(100vw - 100px);
  }
  
  .clickable-row td span:first-child {
    max-width: calc(100vw - 60px);
  }
}

/* Summary bar layout adjustment */
.summary-left {
  flex: 1;
  min-width: 0; /* Important: allows text to shrink */
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Table cell adjustment for problem titles */
.clickable-row td {
  min-width: 0; /* Allows content to shrink */
}

.clickable-row td > div {
  min-width: 0; /* Allows flex children to shrink */
}
/* Problem Title Truncation */
.clickable-row td:first-child {
  max-width: 300px; /* Adjust based on your layout needs */
  white-space: nowrap;

  text-overflow: ellipsis;
}

/* For mobile devices - more aggressive truncation */
@media (max-width: 768px) {
  .clickable-row td:first-child {
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .clickable-row td:first-child {
    max-width: 150px;
  }
}

/* If problem titles are in span elements */
.clickable-row td span {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;

  text-overflow: ellipsis;
  vertical-align: top;
}

/* Table cell constraints to prevent overflow */
table {
  table-layout: fixed;
  width: 100%;
}

td {
  word-wrap: break-word;
  overflow-wrap: break-word;
}
/* Responsive Problem Title Truncation */
.problem-title {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

/* Desktop */
@media (min-width: 1024px) {
  .problem-title {
    max-width: 400px;
  }
}

/* Tablet */
@media (max-width: 1023px) and (min-width: 769px) {
  .problem-title {
    max-width: 250px;
  }
}

/* Mobile */
@media (max-width: 768px) {
  .problem-title {
    max-width: 180px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .problem-title {
    max-width: 120px;
  }
}
/* Dynamic width based on container */
.clickable-row td:first-child {
  max-width: calc(100vw - 300px); /* Subtract space for other columns */
  min-width: 120px; /* Ensure minimum readability */
  white-space: nowrap;

  text-overflow: ellipsis;
}

@media (max-width: 768px) {
  .clickable-row td:first-child {
    max-width: calc(100vw - 200px);
  }
}
/* Override Add Problem button height to match other elements in mobile */
@media (max-width: 768px) {
  .add-problem-btn {
    height: 40px !important; /* Match Add Heading button and other controls */
    min-height: 40px !important;
    max-height: 40px !important;
    padding: 0 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
  }
}

@media (max-width: 480px) {
  .add-problem-btn {
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
  }
}

@media (max-width: 360px) {
  .add-problem-btn {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
  }
}
/* Mobile Controls - Keep Same Colors as Desktop */
@media (max-width: 768px) {
  /* Checkbox - Keep original desktop colors */
  #toggleShowChildren {
    border-color: #404758 !important;
    background: transparent !important;
  }
  
  #toggleShowChildren:checked {
    background: #21283d !important;
    border-color: #404758 !important;
  }
  
  #toggleShowChildren:hover {
    border-color: #404758 !important;
    background: rgba(33, 40, 61, 0.1) !important;
  }
  
  /* Add Heading button - Keep original desktop colors */
  .add-heading-btn {
    background: #1b1f29 !important;
    color: #e7eafd !important;
    box-shadow: 0 2px 8px rgba(36,54,78,0.07) !important;
  }
  
  .add-heading-btn:hover {
    background: rgba(42, 44, 63, 0.92) !important;
    color: #fff !important;
    box-shadow: 0 4px 18px 0 rgba(80,148,255,.13) !important;
  }
}

/* Very small screens - maintain same colors */
@media (max-width: 480px) {
  #toggleShowChildren {
    border-color: #404758 !important;
    background: transparent !important;
  }
  
  #toggleShowChildren:checked {
    background: #21283d !important;
    border-color: #404758 !important;
  }
  
  .add-heading-btn {
    background: #1b1f29 !important;
    color: #e7eafd !important;
    box-shadow: 0 2px 8px rgba(36,54,78,0.07) !important;
  }
}

/* Extra small screens - maintain same colors */
@media (max-width: 360px) {
  #toggleShowChildren {
    border-color: #404758 !important;
    background: transparent !important;
  }
  
  #toggleShowChildren:checked {
    background: #21283d !important;
    border-color: #404758 !important;
  }
  
  .add-heading-btn {
    background: #1b1f29 !important;
    color: #e7eafd !important;
    box-shadow: 0 2px 8px rgba(36,54,78,0.07) !important;
  }
}
/* Enhanced checkbox tooltip that avoids header overlap */
.checkbox-tooltip::before {
  content: "Show all children when heading matches";
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2a2a2a;
  color: #e0e0e0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10001 !important;
  border: 1px solid #444;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Show tooltip on hover with proper z-index */
.checkbox-tooltip:hover::before {
  opacity: 1;
}

/* Media query for mobile - position tooltip below on small screens */
@media (max-width: 768px) {
  .checkbox-tooltip::before {
    top: 28px;  /* Below checkbox on mobile */
    transform: translateX(-50%);
  }
}
/* Fix checkbox tooltip positioning for mobile */
.checkbox-tooltip::before {
  content: "Show all children when heading matches";
  position: absolute;
  top: -38px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2a2a2a;
  color: #e0e0e0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 10001;
  border: 1px solid #444;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Mobile-specific positioning to prevent overflow */
@media (max-width: 768px) {
  .checkbox-tooltip::before {
    /* Position tooltip to the left of checkbox on mobile */
    left: auto;
    right: 0;
    transform: none;
    max-width: 200px;
    white-space: normal;
    word-wrap: break-word;
    line-height: 1.3;
  }
}

/* Very small screens - position below checkbox */
@media (max-width: 480px) {
  .checkbox-tooltip::before {
    top: 28px; /* Position below checkbox */
    right: auto;
    left: 50%;
    transform: translateX(-50%);
    max-width: 180px;
    font-size: 11px;
  }
}

/* Ensure tooltip never goes off-screen */
@media (max-width: 360px) {
  .checkbox-tooltip::before {
    left: 0;
    transform: none;
    max-width: calc(100vw - 40px);
    margin-left: 10px;
  }
}
/* Override CodeVault heading font size on mobile */
@media (max-width: 768px) {
  .header-title h2 {
    font-size: 1.3rem !important; /* Increased from 1.2rem */
  }
  
  .brand-text {
    font-size: 1.3rem !important; /* Match the h2 size */
  }
}

/* Very small screens */
@media (max-width: 480px) {
  .header-title h2 {
    font-size: 1.2rem !important; /* Increased from 1.1rem */
  }
  
  .brand-text {
    font-size: 1.2rem !important;
  }
}

/* Extra small screens */
@media (max-width: 360px) {
  .header-title h2 {
    font-size: 1.1rem !important; /* Increased from 0.9rem */
  }
  
  .brand-text {
    font-size: 1.1rem !important;
  }
}
.ellipsis {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.problem-preview, .position-preview {
  min-width: 0;
  overflow: hidden;
}
.heading-option-info {
  min-width: 0;
  overflow: hidden;

}
.headings-list {
  overflow-y: auto; /* keep vertical scroll if many headings */
  overflow-x: hidden;
}
.headings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* You can increase for more visible rows */
  overflow-y: auto;
}
.heading-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  min-height: 48px; /* ensure enough tap/click area */
  /* ... other existing styles ... */
}
.move-selection-container {
  overflow: visible !important;
}


