* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #111827;
  min-height: 100vh;
  color: #d1d5db;
}

/* Header */
.header {
  background: #111827;
  color: white;
  padding: 20px 30px;
  border-bottom: 1px solid #374151;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 {
  font-size: 24px;
}

.header-nav {
  display: flex;
  gap: 15px;
}

.nav-link {
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 0.2s;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Main Content */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 30px;
}

/* Search */
.search-container {
  margin-bottom: 20px;
  position: relative;
}

/* Keyboard shortcuts hint */
.keyboard-shortcuts-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  color: #9ca3af;
  font-size: 13px;
  pointer-events: none;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.search-input:focus ~ .keyboard-shortcuts-hint {
  opacity: 0;
}

.keyboard-icon {
  font-size: 16px;
}

.keyboard-hint-text {
  display: flex;
  align-items: center;
  gap: 4px;
}

kbd {
  background: #374151;
  border: 1px solid #4b5563;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
  font-size: 11px;
  font-weight: 600;
  color: #d1d5db;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Hide keyboard hint on mobile */
@media (max-width: 768px) {
  .keyboard-shortcuts-hint {
    display: none;
  }
}

.search-input {
  width: 100%;
  padding: 12px 18px;
  border: 2px solid #4b5563;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  background: #374151;
  color: white;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-input:focus {
  border-color: #dc2626;
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.search-input:disabled {
  background-color: #1f2937;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 0.6;
}

.search-input.loading {
  background-image: linear-gradient(
    90deg,
    transparent 0%,
    rgba(210, 44, 30, 0.1) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: searchInputLoading 1.5s ease-in-out infinite;
}

@keyframes searchInputLoading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #1f2937;
  border: 2px solid #374151;
  border-top: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  margin-top: -2px;
}

.autocomplete-dropdown.visible {
  display: block;
}

.autocomplete-item {
  padding: 12px 18px;
  cursor: pointer;
  transition: background-color 0.2s;
  font-size: 15px;
  color: #d1d5db;
  border-bottom: 1px solid #374151;
}

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

.autocomplete-item:hover {
  background-color: #374151;
}

.autocomplete-item.selected {
  background-color: rgba(220, 38, 38, 0.15);
  border-left: 3px solid #dc2626;
  padding-left: 15px;
}

.autocomplete-item em {
  font-weight: 700;
  font-style: normal;
  color: #dc2626;
  background: none;
  padding: 0;
}

/* Controls */
.controls-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  gap: 20px;
  flex-wrap: wrap;
}

/* Filter Toggle Button (hidden on desktop) */
.filter-toggle {
  display: none;
  width: 100%;
  padding: 12px 16px;
  background: #1f2937;
  border: 2px solid #374151;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #d1d5db;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  transition: all 0.2s;
  min-height: 44px;
}

.filter-toggle:hover {
  border-color: #dc2626;
  background: rgba(220, 38, 38, 0.1);
}

.filter-toggle:active {
  transform: scale(0.98);
}

.filter-icon {
  font-size: 18px;
}

.filter-text {
  flex: 1;
  text-align: left;
  margin-left: 8px;
}

.filter-arrow {
  font-size: 12px;
  transition: transform 0.3s;
}

.filter-toggle.active .filter-arrow {
  transform: rotate(180deg);
}

/* Filters Panel */
.filters-panel {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  width: 100%;
}

.filters {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  padding: 8px 12px;
  border: 2px solid #4b5563;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #374151;
  color: white;
  cursor: pointer;
}

.filter-select:focus {
  border-color: #dc2626;
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.status-filters {
  display: flex;
  gap: 10px;
  padding: 8px 12px;
  background: #1f2937;
  border: 2px solid #374151;
  border-radius: 6px;
  color: #d1d5db;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
  cursor: pointer;
}

.clear-button {
  padding: 8px 16px;
  background: #6b7280;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-button:hover {
  background: #4b5563;
}

.clear-button:focus {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.sort-container {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.sort-container label {
  font-size: 14px;
  font-weight: 600;
  color: #9ca3af;
  align-self: center;
}

.sort-select {
  padding: 8px 12px;
  border: 2px solid #4b5563;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  background: #374151;
  color: white;
  cursor: pointer;
}

.sort-select:focus {
  border-color: #dc2626;
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

/* Loading Spinner */
.loading-spinner {
  text-align: center;
  padding: 60px 20px;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.loading-spinner:not(.hidden) {
  opacity: 1;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #374151;
  border-top-color: #dc2626;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* Skeleton Loading Cards */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.skeleton-card {
  background: #1f2937;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border: 1px solid #374151;
  min-height: 250px;
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

.skeleton-title {
  height: 24px;
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 12px;
  width: 80%;
}

.skeleton-text {
  height: 16px;
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 8px;
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-badges {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  margin-bottom: 12px;
}

.skeleton-badge {
  height: 24px;
  width: 80px;
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 12px;
}

.skeleton-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #374151;
}

.skeleton-metric {
  height: 14px;
  background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  margin-bottom: 8px;
  width: 90%;
}

@keyframes skeletonShimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

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

/* Responsive skeleton grid */
@media (min-width: 768px) and (max-width: 1023px) {
  .skeleton-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }
}

@media (max-width: 767px) {
  .skeleton-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

/* Error Message */
.error-message {
  background: #450a0a;
  border: 1px solid #dc2626;
  color: #fca5a5;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 20px;
}

.retry-button {
  margin-top: 10px;
  padding: 8px 16px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.retry-button:hover {
  background: #b91c1c;
}

/* Empty State */
.empty-state,
.no-results {
  text-align: center;
  padding: 80px 20px;
  color: #9ca3af;
}

.empty-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.empty-state h2,
.no-results h2 {
  font-size: 24px;
  color: #d1d5db;
  margin-bottom: 10px;
}

.empty-state p,
.no-results p {
  font-size: 16px;
  margin-bottom: 20px;
}

.create-link {
  display: inline-block;
  padding: 12px 24px;
  background: #dc2626;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  transition:
    transform 0.2s,
    background 0.2s;
}

.create-link:hover {
  background: #b91c1c;
  transform: translateY(-2px);
}

/* Ideas Grid */
.ideas-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 30px;
  transition: opacity 0.3s ease-in-out;
}

.ideas-grid.transitioning {
  opacity: 0.5;
}

/* Desktop refinements - capped at 3 columns */
@media (min-width: 1024px) {
  .ideas-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
  }

  .main-content {
    padding: 32px;
  }

  .controls-container {
    margin-bottom: 32px;
  }

  /* Hide filter toggle on desktop */
  .filter-toggle {
    display: none;
  }

  /* Show filters panel on desktop */
  .filters-panel {
    max-height: none;
    overflow: visible;
  }

  .idea-card {
    transition:
      transform 0.2s ease,
      box-shadow 0.2s ease;
  }

  .idea-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  }
}

/* Idea Card */
.idea-card {
  position: relative;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.2s,
    box-shadow 0.2s,
    opacity 0.3s ease-in-out;
  display: flex;
  flex-direction: column;
  min-height: 250px;
  opacity: 0;
  animation: fadeInCard 0.4s ease-out forwards;
  will-change: transform, opacity;
  outline: none;
}

.idea-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

/* Keyboard focus indicator */
.idea-card:focus {
  outline: 3px solid #dc2626;
  outline-offset: 2px;
  transform: translateY(-4px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
}

.idea-card:focus-visible {
  outline: 3px solid #dc2626;
  outline-offset: 2px;
}

/* Fade-in animation for cards */
@keyframes fadeInCard {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger effect for multiple cards */
.idea-card:nth-child(1) {
  animation-delay: 0s;
}
.idea-card:nth-child(2) {
  animation-delay: 0.05s;
}
.idea-card:nth-child(3) {
  animation-delay: 0.1s;
}
.idea-card:nth-child(4) {
  animation-delay: 0.15s;
}
.idea-card:nth-child(5) {
  animation-delay: 0.2s;
}
.idea-card:nth-child(6) {
  animation-delay: 0.25s;
}
.idea-card:nth-child(7) {
  animation-delay: 0.3s;
}
.idea-card:nth-child(8) {
  animation-delay: 0.35s;
}
.idea-card:nth-child(9) {
  animation-delay: 0.4s;
}
.idea-card:nth-child(n + 10) {
  animation-delay: 0.45s;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
  .idea-card {
    animation: fadeInCardReduced 0.2s ease-out forwards;
    animation-delay: 0s !important;
  }

  @keyframes fadeInCardReduced {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  .search-mode-indicator.visible {
    animation: none;
    opacity: 1;
    transform: translateY(0);
  }

  .ideas-grid.transitioning {
    transition: none;
  }

  .pagination-controls {
    transition: none;
  }

  .skeleton-card {
    animation: none;
  }

  .skeleton-title,
  .skeleton-text,
  .skeleton-badge,
  .skeleton-metric {
    animation: none;
  }

  .relevance-badge {
    transition: none;
  }

  .idea-card:hover .relevance-badge {
    transform: translateY(0);
  }
}

.idea-card h3 {
  font-size: 18px;
  color: #ffffff;
  margin-bottom: 10px;
}

.card-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.idea-card p {
  font-size: 14px;
  color: #9ca3af;
  line-height: 1.5;
  margin-bottom: auto;
  flex-grow: 1;
}

.card-description {
  margin-bottom: 14px;
}

.card-description-text {
  font-size: 14px;
  color: #9ca3af;
  line-height: 1.6;
  margin-bottom: 0;
}

.card-description-text.no-margin {
  margin-bottom: 0;
}

.card-inline-toggle {
  margin-top: 8px;
  padding: 0;
  border: none;
  background: transparent;
  color: #fca5a5;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.card-inline-toggle:hover {
  color: #fecaca;
}

.card-actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.card-action-button:hover {
  transform: translateY(-1px);
}

.card-action-primary {
  background: #dc2626;
  border: 1px solid #dc2626;
  color: #fff;
}

.card-action-primary:hover {
  background: #b91c1c;
  color: #fff;
}

.card-action-secondary {
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(96, 165, 250, 0.35);
  color: #bfdbfe;
}

.card-action-secondary:hover {
  background: rgba(37, 99, 235, 0.24);
}

.card-media-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.card-media-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(156, 163, 175, 0.3);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.55);
  color: #d1d5db;
  font-size: 12px;
  cursor: pointer;
}

.card-media-pill:hover {
  border-color: rgba(220, 38, 38, 0.4);
  color: #fff;
}

.card-media-icon {
  font-size: 11px;
}

.card-disclosure {
  margin-bottom: 12px;
  border: 1px solid rgba(75, 85, 99, 0.65);
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.38);
}

.card-disclosure-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.card-disclosure-toggle:hover {
  color: #fff;
}

.card-disclosure-toggle[aria-expanded='true'] .card-disclosure-chevron {
  transform: rotate(180deg);
}

.card-disclosure-chevron {
  transition: transform 0.15s ease;
}

.card-disclosure-content {
  padding: 0 12px 12px;
}

.card-feature-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #cbd5e1;
  font-size: 13px;
}

.card-feature-list li::before {
  content: '•';
  color: #f87171;
  margin-right: 8px;
}

.card-content .badges {
  margin-top: 0;
  margin-bottom: 8px;
}

.card-footer {
  padding-top: 12px;
  border-top: 1px solid #374151;
}

.badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge.dept {
  background: #450a0a;
  color: #fca5a5;
}

.badge.status {
  background: #450a0a;
  color: #fca5a5;
}

.badge.status.draft {
  background: #292524;
  color: #fbbf24;
}

.badge.status.in_progress {
  background: #1c1917;
  color: #fb923c;
}

.badge.status.deployed {
  background: #052e16;
  color: #4ade80;
}

.metrics {
  display: flex;
  gap: 15px;
  margin-bottom: 8px;
  font-size: 13px;
  color: #9ca3af;
  flex-wrap: wrap;
}

.metrics:last-child {
  margin-bottom: 0;
}

/* Load More */
.load-more-container {
  text-align: center;
  margin-top: 30px;
}

.load-more-button {
  padding: 12px 32px;
  background: #dc2626;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 0.2s,
    background 0.2s;
}

.load-more-button:hover {
  background: #b91c1c;
  transform: translateY(-2px);
}

.load-more-button:focus {
  outline: 3px solid #dc2626;
  outline-offset: 2px;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Responsive Design */

/* Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .ideas-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
  }

  .header {
    padding: 18px 24px;
  }

  .header h1 {
    font-size: 22px;
  }

  .main-content {
    padding: 24px 20px;
  }

  /* Autocomplete responsive for tablet */
  .autocomplete-dropdown {
    max-height: 280px;
  }

  .autocomplete-item {
    padding: 12px 18px;
    font-size: 15px;
    min-height: 44px;
  }

  /* Relevance badge for tablet */
  .relevance-badge {
    top: 10px;
    right: 10px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .score-stars {
    font-size: 13px;
  }

  .controls-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .filters {
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-select,
  .status-filters,
  .clear-button {
    min-height: 44px;
  }

  .sort-container {
    width: 100%;
    justify-content: flex-start;
  }

  .sort-select {
    min-height: 44px;
  }

  .search-input {
    min-height: 44px;
  }

  .idea-card {
    min-height: 260px;
  }

  .load-more-button {
    min-height: 44px;
  }

  /* Hide filter toggle on tablet */
  .filter-toggle {
    display: none;
  }

  /* Show filters panel on tablet */
  .filters-panel {
    max-height: none;
    overflow: visible;
  }
}

/* Mobile: 1 column */
@media (max-width: 767px) {
  .ideas-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .header {
    padding: 16px 20px;
  }

  .header-content {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .header h1 {
    font-size: 20px;
  }

  /* Autocomplete responsive */
  .autocomplete-dropdown {
    max-height: 250px;
    font-size: 16px;
  }

  .autocomplete-item {
    padding: 14px 18px;
    font-size: 16px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .autocomplete-item.selected {
    padding-left: 15px;
  }

  .controls-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }

  /* Show filter toggle button on mobile */
  .filter-toggle {
    display: flex;
    margin-bottom: 16px;
  }

  /* Filters panel collapsible on mobile */
  .filters-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    flex-direction: column;
  }

  .filters-panel.expanded {
    max-height: 1000px;
    margin-bottom: 16px;
  }

  .filters {
    width: 100%;
    flex-direction: column;
    gap: 12px;
  }

  .filter-select,
  .status-filters,
  .clear-button {
    width: 100%;
    min-height: 44px; /* Touch target minimum */
  }

  .filter-select {
    padding: 12px 16px;
    font-size: 16px; /* Prevent zoom on iOS */
  }

  .status-filters {
    padding: 12px 16px;
    flex-wrap: wrap;
    gap: 12px;
  }

  .checkbox-label {
    min-height: 44px;
    padding: 8px 0;
    font-size: 16px;
  }

  .checkbox-label input[type='checkbox'] {
    width: 20px;
    height: 20px;
  }

  .clear-button {
    padding: 12px 16px;
    font-size: 16px;
  }

  .sort-container {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .sort-container label {
    font-size: 16px;
  }

  .sort-select {
    width: 100%;
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px;
  }

  .search-input {
    padding: 14px 18px;
    font-size: 16px; /* Prevent zoom on iOS */
    min-height: 44px;
  }

  .main-content {
    padding: 16px 12px;
  }

  .idea-card {
    padding: 16px;
    min-height: 44px; /* Ensure touch target */
  }

  .idea-card h3 {
    font-size: 16px;
  }

  .idea-card p {
    font-size: 14px;
  }

  .badge {
    padding: 6px 12px;
    font-size: 12px;
  }

  .metrics {
    font-size: 12px;
    gap: 12px;
  }

  .load-more-button {
    width: 100%;
    min-height: 44px;
    padding: 14px 24px;
    font-size: 16px;
  }

  .empty-state,
  .no-results {
    padding: 60px 20px;
  }

  .empty-icon {
    font-size: 48px;
  }

  .empty-state h2,
  .no-results h2 {
    font-size: 20px;
  }

  .empty-state p,
  .no-results p {
    font-size: 14px;
  }

  .create-link {
    padding: 12px 24px;
    min-height: 44px;
    font-size: 16px;
  }

  .retry-button {
    min-height: 44px;
    padding: 12px 24px;
    font-size: 16px;
  }

  /* Relevance badge responsive */
  .relevance-badge {
    top: 8px;
    right: 8px;
    padding: 3px 6px;
    font-size: 11px;
  }

  .score-stars {
    font-size: 12px;
  }
}

/* Search Unavailable Warning - Floating Banner */
.search-warning {
  position: fixed;
  top: 80px; /* Below the header */
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #292524;
  border: 1px solid #fbbf24;
  border-radius: 8px;
  padding: 12px 20px;
  max-width: 1200px;
  width: calc(100% - 40px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  animation: slideDown 0.3s ease-out;
}

.search-warning-content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fbbf24;
}

.search-warning-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.search-warning-message {
  font-weight: 600;
  flex: 1;
}

.search-warning-fallback {
  font-size: 14px;
  opacity: 0.9;
}

.search-warning-close {
  background: none;
  border: none;
  color: #fbbf24;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin-left: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
  flex-shrink: 0;
}

.search-warning-close:hover {
  opacity: 1;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive adjustments for warning banner */
@media (max-width: 768px) {
  .search-warning {
    top: 70px;
    width: calc(100% - 20px);
    padding: 10px 15px;
  }

  .search-warning-content {
    gap: 8px;
  }

  .search-warning-icon {
    font-size: 18px;
  }

  .search-warning-message {
    font-size: 14px;
  }

  .search-warning-fallback {
    font-size: 12px;
  }
}

/* Pagination Controls for Search Mode */
.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin: 30px 0;
  padding: 20px;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 0.3s ease-out,
    transform 0.3s ease-out;
}

.pagination-controls:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

.pagination-controls.hidden {
  display: none;
}

.pagination-btn {
  background: #dc2626;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 120px;
}

.pagination-btn:hover:not(:disabled) {
  background: #b91c1c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.4);
}

.pagination-btn:focus {
  outline: 3px solid #dc2626;
  outline-offset: 2px;
}

.pagination-btn:disabled {
  background: #374151;
  color: #6b7280;
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-info {
  font-size: 14px;
  font-weight: 600;
  color: #d1d5db;
  min-width: 120px;
  text-align: center;
}

/* Relevance Score Badge */
.relevance-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #374151;
  border: 1px solid #4b5563;
  padding: 4px 8px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  font-size: 12px;
  z-index: 10;
  opacity: 0;
  transform: translateY(-5px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  pointer-events: none;
}

.idea-card:hover .relevance-badge {
  opacity: 1;
  transform: translateY(0);
}

.score-stars {
  color: #ffc107;
  font-size: 14px;
  letter-spacing: 1px;
}

/* Highlight Styling for Search Results */
/* Highlights in idea cards */
.idea-card em {
  background-color: rgba(251, 191, 36, 0.2);
  font-style: normal;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 3px;
  color: #fbbf24;
  box-shadow: none;
}

.idea-card h3 em {
  background-color: rgba(251, 191, 36, 0.2);
  font-style: normal;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 3px;
  color: #fbbf24;
}

.idea-card p em {
  background-color: rgba(251, 191, 36, 0.2);
  font-style: normal;
  font-weight: 600;
  padding: 2px 4px;
  border-radius: 3px;
  color: #fbbf24;
}

/* Responsive Pagination */
@media (max-width: 768px) {
  .pagination-controls {
    flex-direction: column;
    gap: 10px;
  }

  .pagination-btn {
    width: 100%;
    max-width: 300px;
  }

  .pagination-info {
    order: -1;
  }
}

/* Search Mode Indicator */
.search-mode-indicator {
  background: #1f2937;
  border: 1px solid #374151;
  color: #d1d5db;
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition:
    opacity 0.3s ease-out,
    transform 0.3s ease-out;
}

.search-mode-indicator.visible {
  display: block;
  animation: slideDownFade 0.4s ease-out forwards;
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.search-mode-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.search-info {
  flex: 1;
  font-size: 14px;
}

.search-query {
  font-weight: 600;
  font-size: 16px;
  margin-right: 8px;
}

.search-count {
  margin-left: 10px;
  opacity: 0.9;
  font-size: 14px;
}

.clear-search-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

.clear-search-btn:active {
  transform: translateY(0);
}

/* Responsive Search Mode Indicator */
@media (max-width: 768px) {
  .search-mode-indicator {
    padding: 10px 15px;
    margin-bottom: 16px;
  }

  .search-mode-content {
    gap: 8px;
    flex-wrap: wrap;
  }

  .search-icon {
    font-size: 18px;
  }

  .search-info {
    font-size: 13px;
    flex: 1 1 100%;
  }

  .search-query {
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
  }

  .search-count {
    margin-left: 0;
    font-size: 13px;
  }

  .clear-search-btn {
    padding: 8px 12px;
    font-size: 13px;
    min-height: 36px;
  }
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
}

.toast {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  padding: 16px;
  opacity: 0;
  transform: translateX(400px);
  transition: all 0.3s ease-out;
  border-left: 4px solid #4b5563;
}

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

.toast-dismissing {
  opacity: 0;
  transform: translateX(400px);
}

.toast-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  color: #d1d5db;
}

.toast-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: #9ca3af;
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
  flex-shrink: 0;
}

.toast-close-btn:hover {
  background: #374151;
  color: #d1d5db;
}

.toast-retry-btn {
  background: #dc2626;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.toast-retry-btn:hover {
  background: #b91c1c;
}

/* Toast type-specific styles */
.toast-error {
  border-left-color: #dc3545;
}

.toast-error .toast-icon {
  color: #dc3545;
}

.toast-warning {
  border-left-color: #ffc107;
}

.toast-warning .toast-icon {
  color: #ffc107;
}

.toast-success {
  border-left-color: #28a745;
}

.toast-success .toast-icon {
  color: #28a745;
}

.toast-info {
  border-left-color: #17a2b8;
}

.toast-info .toast-icon {
  color: #17a2b8;
}

/* Mobile responsiveness for toasts */
@media (max-width: 768px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
    max-width: none;
  }

  .toast {
    transform: translateY(-100px);
  }

  .toast-visible {
    transform: translateY(0);
  }

  .toast-dismissing {
    transform: translateY(-100px);
  }
}

/* Delete Button */
.delete-idea-btn {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: transparent;
  border: 1px solid #dc2626;
  color: #dc2626;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Role-aware UI (#294): hide the delete affordance for non-admins. The backend
   enforces admin-only deletes (require_admin -> 403); body.non-admin is set by
   discover.js once GET /api/me resolves (deny-by-default). */
body.non-admin .delete-idea-btn {
  display: none !important;
}

.delete-idea-btn:hover {
  background: #dc2626;
  color: white;
  transform: scale(1.05);
}

.delete-idea-btn:focus {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

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

/* Adjust card footer to accommodate delete button */
.card-footer {
  position: relative;
  padding-right: 60px;
}

/* Delete Confirmation Dialog */
.delete-confirmation-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
}

.delete-confirmation-dialog {
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 500px;
  width: 90%;
  animation: slideInDialog 0.3s ease-out;
}

@keyframes slideInDialog {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.delete-confirmation-header {
  padding: 20px 24px;
  border-bottom: 1px solid #374151;
}

.delete-confirmation-header h3 {
  margin: 0;
  font-size: 20px;
  color: #ffffff;
}

.delete-confirmation-body {
  padding: 24px;
}

.delete-confirmation-body p {
  margin: 0 0 12px 0;
  font-size: 15px;
  color: #d1d5db;
  line-height: 1.5;
}

.delete-idea-title {
  font-weight: 600;
  color: #ffffff;
  padding: 8px;
  background: #374151;
  border-radius: 6px;
  margin: 12px 0;
}

.delete-warning {
  font-size: 13px;
  color: #dc2626;
  font-weight: 500;
}

.delete-confirmation-footer {
  padding: 16px 24px;
  border-top: 1px solid #374151;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.delete-cancel-btn,
.delete-confirm-btn {
  padding: 10px 20px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.delete-cancel-btn {
  background: #374151;
  color: #d1d5db;
}

.delete-cancel-btn:hover {
  background: #4b5563;
}

.delete-cancel-btn:focus {
  outline: 2px solid #6b7280;
  outline-offset: 2px;
}

.delete-confirm-btn {
  background: #dc2626;
  color: white;
}

.delete-confirm-btn:hover {
  background: #b91c1c;
}

.delete-confirm-btn:focus {
  outline: 2px solid #dc2626;
  outline-offset: 2px;
}

.delete-confirm-btn:active,
.delete-cancel-btn:active {
  transform: scale(0.95);
}

/* Mobile responsiveness for delete confirmation */
@media (max-width: 768px) {
  .delete-confirmation-dialog {
    width: 95%;
    margin: 20px;
  }

  .delete-confirmation-header {
    padding: 16px 20px;
  }

  .delete-confirmation-body {
    padding: 20px;
  }

  .delete-confirmation-footer {
    padding: 12px 20px;
    flex-direction: column-reverse;
  }

  .delete-cancel-btn,
  .delete-confirm-btn {
    width: 100%;
  }

  .delete-idea-btn {
    padding: 8px 10px;
    font-size: 13px;
  }
}

body.modal-open {
  overflow: hidden;
}

.agent-chat-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.agent-chat-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 18, 0.76);
  backdrop-filter: blur(3px);
}

.agent-chat-dialog {
  position: relative;
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  background: #111827;
  border: 1px solid #374151;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.agent-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #1f2937;
}

.agent-chat-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fca5a5;
  margin-bottom: 4px;
}

.agent-chat-description {
  margin-top: 6px;
  color: #9ca3af;
  font-size: 14px;
}

.agent-chat-close {
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.agent-chat-status {
  margin: 16px 24px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(30, 41, 59, 0.8);
  color: #d1d5db;
  font-size: 13px;
}

.agent-chat-status.error {
  background: rgba(127, 29, 29, 0.4);
  color: #fecaca;
}

.agent-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 220px;
}

.agent-chat-message {
  display: flex;
}

.agent-chat-message.user {
  justify-content: flex-end;
}

.agent-chat-bubble {
  max-width: min(85%, 560px);
  padding: 12px 14px;
  border-radius: 14px;
  background: #1f2937;
  color: #f3f4f6;
  white-space: pre-wrap;
}

.agent-chat-message.user .agent-chat-bubble {
  background: #991b1b;
}

.agent-chat-form {
  border-top: 1px solid #1f2937;
  padding: 18px 24px 24px;
}

.agent-chat-attachment-panel {
  margin-bottom: 14px;
}

.agent-chat-attachment-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.agent-chat-attachment-label,
.agent-chat-attachment-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #4b5563;
  background: #1f2937;
  color: #f3f4f6;
  font-size: 13px;
  cursor: pointer;
}

.agent-chat-attachment-input {
  display: none;
}

.agent-chat-attachment-hint,
.agent-chat-shortcut-hint,
.agent-chat-attachment-summary {
  color: #9ca3af;
  font-size: 12px;
}

.agent-chat-attachment-state {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #374151;
  border-radius: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: rgba(17, 24, 39, 0.8);
}

.agent-chat-attachment-badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #86efac;
}

.agent-chat-attachment-name {
  margin-top: 4px;
  color: #f3f4f6;
  font-size: 13px;
}

.agent-chat-input {
  width: 100%;
  min-height: 112px;
  padding: 12px 14px;
  border: 1px solid #4b5563;
  border-radius: 12px;
  background: #111827;
  color: #f3f4f6;
  resize: vertical;
}

.agent-chat-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.agent-chat-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.agent-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

@media (max-width: 767px) {
  .agent-chat-dialog {
    width: calc(100% - 20px);
    max-height: calc(100vh - 20px);
    margin: 10px auto;
  }

  .agent-chat-header,
  .agent-chat-messages,
  .agent-chat-form {
    padding-left: 16px;
    padding-right: 16px;
  }

  .agent-chat-actions,
  .agent-chat-attachment-state {
    flex-direction: column;
    align-items: stretch;
  }
}
