/* Base styles */
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  height: 100vh;
  background: #f8fafc;
  color: #334155;
  line-height: 1.6;
}

.headers {
  display: flex;
  flex-shrink: 0;
  border-bottom: 1px solid #e2e8f0;
}

.panel-header {
  padding: 4px;
  background: white;
  font-size: 16px;
  min-height: 40px;
  box-sizing: border-box;
}

.container {
  display: flex;
  height: 100%;
  background: white;
}

/* Panels */
.combined-panel {
  display: flex;
  flex-direction: column;
  width: 55%;
  resize: horizontal;
  border-right: 1px solid #e2e8f0;
  overflow: hidden;
}

.responses-panel {
  width: 30%;
  resize: horizontal;
  padding: 2px;
  margin: 2px;
  border-left: 4px solid #e2e8f0;
  height: 100vh;
  flex:1;
  overflow-y: auto;
  transition: all 0.3s ease;
}

.container:not(.show-responses) .responses-panel {
  width: 0;
  padding: 0;
  opacity: 0;
  visibility: hidden;
}

.container:not(.show-responses) .combined-panel {
    width: 100% !important;
}

/* Side headers */
.queries-header {
  min-width: 200px;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: .5px;
  font-weight: 600;
}

.previews-header {
  padding: 2px;
  margin: 2px;
  flex-grow: 1;
}

/* Inputs */
.search-input,
.instance-filter {
  width: 100%;
  padding: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  background: #f8fafc;
  margin: 2px;
  transition: all 0.2s;
}

.search-input:focus,
.instance-filter:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

/* Query items & Preview cards */
.query-item,
.preview-card {
  height: 32px;
  border-bottom: 1px solid #e2e8f0;
  background: white;
  display: flex;
  padding: 4px;
  margin: 0px;
  box-sizing: border-box;
  overflow: hidden;
}

.query-item {
  font-size: 22px;
  cursor: pointer;
  padding: 1px;
  white-space: nowrap;
  text-overflow: ellipsis;
  justify-content: space-between;
  transition: all 0.2s;
  align-items: center; /* Add this line */
}

.query-item:hover {
  background: #f1f5f9;
}

.query-item.active {
  background: #eff6ff !important;
  border-left: 3px solid #3b82f6;
  padding-left: 3px;
}

.preview-meta {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
}

/* Alternating backgrounds */
.query-item:nth-child(even),
.preview-card:nth-child(even) {
  background: #f8fafc;
}
.query-item:nth-child(odd),
.preview-card:nth-child(odd) {
  background: #ffffff;
}

/* Preview content */
.preview-text {
  font-size: 18px;
  color: #475569;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-grow: 1;
  padding-right: 16px;
}

/* Response card */
.response-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 4px;
  margin: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.response-text {
  font-size: 15px;
  line-height: 1.4;
  color: #334155;
  margin: 2px;
  padding: 2px;
  white-space: pre-wrap;
}

.response-meta {
  font-size: 13px;
  color: #64748b;
  padding: 2px;
  border-top: 1px solid #e2e8f0;
}


.rank-badge {
    font-size: 11px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 4px;
    border-radius: 4px;
    margin-right: auto;
}

/* Instance selection */
.title-container {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.title-container h2 {
  margin: 0;
  color: #1e293b;
  font-size: 20px;
  font-weight: 600;
}

.instance-select {
  padding: 2px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 14px;
  min-width: 180px;
  background: #f8fafc;
}

/* Vote buttons */
.vote-container {
  display: flex;
  gap: 8px;
  margin: 2px;
}

.vote-btn {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 16px;
}

.vote-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.upvote:hover:not(:disabled) {
  background: #f0fdf4;
  border-color: #22c55e;
}

.downvote:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #ef4444;
}

.delete:hover:not(:disabled) {
  background: #fff7ed;
  border-color: #f97316;
}

.vote-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Status indicators */
.response-count {
  color: #64748b;
  font-size: 0.9em;
  font-weight: normal;
  margin-left: 8px;
  white-space: nowrap;
}

.stats-summary {
  font-size: 0.85em;
  color: #64748b;
  font-weight: normal;
}

/* Messages */
.select-message,
.error-message,
.no-responses {
  text-align: center;
  color: #64748b;
  margin: 4px auto;
  padding: 4px;
  background: #f8fafc;
  border-radius: 8px;
  max-width: 400px;
}

.error-message {
  color: #dc2626;
  background: #fef2f2;
}

/* Manual entry form */
.manual-entry-form {
  position: sticky;
  top: 0;
  background: white;
  z-index: 2;
  padding: 4px;
  margin: 4px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.manual-entry-form h3 {
  margin: 0 0 2px 0;
  padding: 2px;
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.manual-entry-form textarea {
  width: 100%;
  min-height: 35px;
  padding: 4px;
  margin: 4px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.3;
  resize: vertical;
  background: #f8fafc;
}

.manual-entry-form button {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 4px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.manual-entry-form button:hover:not(:disabled) {
  background: #2563eb;
}

.manual-entry-form button:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

/* Scrollable content areas */
.scroll-wrapper {
  display: flex;
  width: 100%;
  overflow-y: auto;
  flex-grow: 1;
  position: relative;
}

.queries-list {
  min-width: 200px;
  border-right: 1px solid #e2e8f0;
  padding: 2px;
  background: #f8fafc;
}

/* Preview panel */
.preview-panel {
  flex-grow: 1;
  background: white;
}

/* Additional utility styles */
.query-item {
  scroll-margin-top: 80px;
}

/* Clickable words */
.clickable-word {
  cursor: pointer;
  display: inline-block;
  padding: 0 2px;
  border-radius: 1px;
  transition: all 0.2s ease;
  color: #1e40af;
  position: relative;
}

.clickable-word:hover {
  background-color: #dbeafe;
  color: #1e3a8a;
}

.non-clickable-word {
  display: inline-block;
  padding: 0 1px;
  color: #475569;
}

/* Word tooltip */
.word-tooltip {
  position: fixed;
  background: #1e293b;
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  max-width: 300px;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  opacity: 0.95;
  line-height: 1.4;
  word-wrap: break-word;
  transform: translateY(-10px);
  animation: tooltipFade 0.2s ease-out forwards;
}

@keyframes tooltipFade {
  from { opacity: 0; transform: translateY(0); } \n  to { opacity: 0.95; transform: translateY(-10px); }\n}

/* Suggestions styling */
/* Compressed Suggestions & Potentials Window */
.suggestions-section,
.suggestions-container {
  margin: 2px;
  padding: 2px;
  border-top: 1px solid #e2e8f0;
}

.suggestions-list {
  gap: 2px;
}

.suggestion-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 2px 4px;
  margin: 2px 0;
  transition: all 0.2s ease;
}

.suggestion-item:hover {
  border-color: #94a3b8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.suggestion-source {
  font-size: 12px;
  color: #64748b;
  margin: 2px;
  font-weight: 500;
}

.suggestion-text {
  font-size: 16px;
  line-height: 1.3;
  color: #334155;
  margin: 2px;
}

.suggestion-address {
  font-size: 11px;
  color: #64748b;
  padding: 2px;
  border-top: 1px solid #e2e8f0;
}



/* Loading animation for suggestions */
.suggestions-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  color: #64748b;
}

.suggestions-loading::after {
  content: '';
  width: 20px;
  height: 20px;
  margin-left: 12px;
  border: 2px solid #e2e8f0;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: loading 0.8s linear infinite;
}

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

/* New response form */
#new-response-form {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

#new-response-text {
  flex-grow: 1;
  min-height: 40px;
  height: 40px;
  padding: 4px;
  margin: 0;
  line-height: 1.4;
  resize: vertical;
}

#new-response-form button {
  height: 40px;
  padding: 4px;
  margin: 4px;
  flex-shrink: 0;
}


.key-buffer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #2c3e50;
    color: #ecf0f1;
    padding: 12px 24px;
    border-radius: 8px;
    font: 600 24px/1 monospace;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    display: none;
    z-index: 1000;
}

/* Media Queries */
@media (max-width: 800px) {
  .queries-list {
    width: 22%;
    min-width: 100px;
    max-width: 120px;
  }
  .query-item {
    font-size: 17px;
    padding: 0 12px;
  }
  .preview-panel, .previews-header, .queries-header {
    width: 80%;
  }
  .response-card {
    width: 210px;
  }
  .preview-text {
    white-space: pre-wrap;
    align-items: center;
    padding: 1px;
    font-size: 18px;
    line-height: 1.1;
    height: 40px;
  }





}

