/* ================================================================
   VET CLINICAL REFERENCE SEARCH
   Apple x Notion minimal aesthetic — matches VetAssist token language
   ================================================================ */
.vrs-app, .vrs-app * { box-sizing: border-box; }

.vrs-app {
  --v-bg:            #FFFFFF;
  --v-bg-secondary:  #F9F9F8;
  --v-bg-tertiary:   #F2F1EF;
  --v-border:        rgba(0, 0, 0, 0.08);
  --v-text:          #1A1A1A;
  --v-text-secondary:#6B6B6B;
  --v-text-tertiary: #A0A0A0;
  --v-accent:        #0E9F6E;
  --v-accent-hover:  #0C8659;
  --v-accent-subtle: rgba(14, 159, 110, 0.08);
  --v-error:         #FF453A;
  --v-radius-sm:     6px;
  --v-radius-md:     10px;
  --v-radius-lg:     14px;
  --v-shadow-sm:     0 2px 8px rgba(0,0,0,0.06);
  --v-shadow-md:     0 4px 20px rgba(0,0,0,0.08);
  --v-ease:          cubic-bezier(0.4, 0, 0.2, 1);

  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 80px 24px;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  color: var(--v-text);
  -webkit-font-smoothing: antialiased;
}

/* ── Header ── */
.vrs-header { margin-bottom: 28px; }
.vrs-title {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin: 0 0 6px 0;
  color: var(--v-text);
}
.vrs-subtitle {
  font-size: 14px;
  color: var(--v-text-secondary);
  margin: 0;
  max-width: 640px;
  line-height: 1.5;
}

/* ── Source Toggle ── */
.vrs-source-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.vrs-source-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
  background: var(--v-bg);
  border: 1.5px solid var(--v-border);
  border-radius: var(--v-radius-lg);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.2s var(--v-ease), box-shadow 0.2s var(--v-ease), background 0.2s var(--v-ease);
  font-family: inherit;
}
.vrs-source-option:hover {
  border-color: rgba(14, 159, 110, 0.35);
  background: var(--v-bg-secondary);
}
.vrs-source-option.active {
  border-color: var(--v-accent);
  background: var(--v-accent-subtle);
  box-shadow: 0 0 0 3px var(--v-accent-subtle);
}

.vrs-source-option-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--v-text);
}

.vrs-source-option-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--v-accent);
  background: rgba(14, 159, 110, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 2px;
}

.vrs-source-option-sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--v-text-secondary);
  margin-top: 2px;
}

/* ── Pagination ── */
.vrs-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--v-border);
}
.vrs-pagination.hidden { display: none; }

.vrs-page-btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--v-text);
  background: var(--v-bg);
  border: 1.5px solid var(--v-border);
  border-radius: var(--v-radius-md);
  padding: 8px 16px;
  cursor: pointer;
  transition: border-color 0.2s var(--v-ease), background 0.2s var(--v-ease);
}
.vrs-page-btn:hover:not(:disabled) {
  border-color: var(--v-accent);
  background: var(--v-accent-subtle);
}
.vrs-page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vrs-page-indicator {
  font-size: 13px;
  font-weight: 600;
  color: var(--v-text-secondary);
  min-width: 90px;
  text-align: center;
}

.vrs-page-jump {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.vrs-page-jump-label {
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  color: var(--v-text-secondary) !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  margin: 0 !important;
}

.vrs-page-jump-input {
  width: 64px;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  color: var(--v-text) !important;
  background: var(--v-bg) !important;
  border: 1.5px solid var(--v-border) !important;
  border-radius: var(--v-radius-md) !important;
  box-shadow: none !important;
  padding: 7px 8px;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}
.vrs-page-jump-input::-webkit-outer-spin-button,
.vrs-page-jump-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.vrs-page-jump-input:focus {
  outline: none !important;
  border-color: var(--v-accent) !important;
  box-shadow: none !important;
}
.vrs-page-jump-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.vrs-page-jump-btn {
  padding: 7px 14px !important;
}

.vrs-page-jump-error {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: var(--v-error);
  margin-top: 8px;
}
.vrs-page-jump-error.hidden { display: none; }

/* ── Search Row ── */
.vrs-search-row {
  margin-bottom: 24px;
}

.vrs-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--v-bg);
  border: 1px solid var(--v-border);
  border-radius: var(--v-radius-lg);
  padding: 8px 8px 8px 16px;
  box-shadow: var(--v-shadow-sm);
  transition: border-color 0.2s var(--v-ease), box-shadow 0.2s var(--v-ease);
}

.vrs-search-box:focus-within {
  border-color: var(--v-accent);
  box-shadow: 0 0 0 3px var(--v-accent-subtle);
}

.vrs-search-icon {
  color: var(--v-text-tertiary);
  flex-shrink: 0;
}

.vrs-input {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--v-text);
  padding: 6px 0;
  max-height: 120px;
}

.vrs-input::placeholder { color: var(--v-text-tertiary); }

.vrs-search-btn {
  background: var(--v-text);
  color: var(--v-bg);
  border: none;
  padding: 10px 20px;
  border-radius: var(--v-radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s var(--v-ease), transform 0.15s var(--v-ease);
}
.vrs-search-btn:hover { background: #333; transform: translateY(-1px); }
.vrs-search-btn:active { transform: scale(0.97); }
.vrs-search-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.vrs-history-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--v-text-tertiary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s var(--v-ease);
}
.vrs-history-toggle:hover { background: var(--v-bg-secondary); color: var(--v-text); }
.vrs-history-toggle.active { background: var(--v-accent-subtle); color: var(--v-accent); }

/* ── Body Layout ── */
.vrs-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* ── History Panel ── */
.vrs-history-panel {
  width: 280px;
  flex-shrink: 0;
  background: var(--v-bg);
  border: 1px solid var(--v-border);
  border-radius: var(--v-radius-lg);
  overflow: hidden;
  animation: vrsSlideIn 0.2s var(--v-ease);
}
.vrs-history-panel.hidden { display: none; }

@keyframes vrsSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.vrs-history-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--v-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--v-text-secondary);
}

.vrs-clear-history-btn {
  background: none;
  border: none;
  color: var(--v-error);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--v-radius-sm);
}
.vrs-clear-history-btn:hover { background: rgba(255, 69, 58, 0.08); }

.vrs-history-list {
  max-height: 560px;
  overflow-y: auto;
  padding: 6px;
}

.vrs-history-empty {
  padding: 24px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--v-text-tertiary);
}

.vrs-history-item {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 34px 10px 12px;
  border-radius: var(--v-radius-md);
  cursor: pointer;
  transition: background 0.15s var(--v-ease);
}
.vrs-history-item:hover { background: var(--v-bg-secondary); }
.vrs-history-item.active { background: var(--v-accent-subtle); }

.vrs-history-item-source {
  display: inline-block;
  align-self: flex-start;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--v-text-tertiary);
  background: var(--v-bg-tertiary);
  padding: 1px 6px;
  border-radius: 999px;
  margin-bottom: 1px;
}

.vrs-history-item-term {
  font-size: 13px;
  font-weight: 600;
  color: var(--v-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vrs-history-item-meta {
  font-size: 11px;
  color: var(--v-text-tertiary);
}

.vrs-history-item-delete {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--v-text-tertiary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--v-radius-sm);
  opacity: 0;
  transition: opacity 0.15s var(--v-ease), color 0.15s var(--v-ease);
}
.vrs-history-item:hover .vrs-history-item-delete { opacity: 1; }
.vrs-history-item-delete:hover { color: var(--v-error); background: rgba(255, 69, 58, 0.08); }

/* ── Results Area ── */
.vrs-results-wrap { flex: 1; min-width: 0; }

.vrs-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--v-text-secondary);
  padding: 12px 0;
}
.vrs-status.hidden { display: none; }
.vrs-status.error { color: var(--v-error); }

.vrs-status-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--v-border);
  border-top-color: var(--v-accent);
  animation: vrsSpin 0.7s linear infinite;
}
@keyframes vrsSpin { to { transform: rotate(360deg); } }

.vrs-meta {
  font-size: 13px;
  color: var(--v-text-tertiary);
  margin-bottom: 14px;
}
.vrs-meta.hidden { display: none; }
.vrs-meta strong { color: var(--v-text-secondary); font-weight: 600; }

.vrs-cache-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--v-accent-subtle);
  color: var(--v-accent);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
}

/* ── Result Cards ── */
.vrs-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.vrs-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--v-bg);
  border: 1px solid var(--v-border);
  border-radius: var(--v-radius-lg);
  padding: 16px;
  transition: box-shadow 0.2s var(--v-ease), transform 0.2s var(--v-ease), border-color 0.2s var(--v-ease);
}
.vrs-card:hover {
  box-shadow: var(--v-shadow-md);
  transform: translateY(-2px);
  border-color: var(--v-border);
}

.vrs-card-source {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  background: var(--v-bg-tertiary);
  color: var(--v-text-secondary);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 3px 9px;
  border-radius: 999px;
  text-transform: uppercase;
}

.vrs-card-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--v-text);
  text-decoration: none;
}
.vrs-card-title:hover { color: var(--v-accent); }

.vrs-card-snippet {
  font-size: 13px;
  line-height: 1.5;
  color: var(--v-text-secondary);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.vrs-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.vrs-card-domain {
  font-size: 11px;
  color: var(--v-text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vrs-card-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--v-accent);
  text-decoration: none;
  flex-shrink: 0;
}
.vrs-card-link:hover { color: var(--v-accent-hover); }

/* ── Empty / Error States ── */
.vrs-empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--v-text-tertiary);
}
.vrs-empty-state.hidden { display: none; }
.vrs-empty-icon { font-size: 32px; margin-bottom: 12px; }
.vrs-empty-title { font-size: 15px; font-weight: 600; color: var(--v-text-secondary); margin-bottom: 6px; }
.vrs-empty-text { font-size: 13px; max-width: 380px; margin: 0 auto; line-height: 1.5; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 900px) {
  .vrs-body { flex-direction: column; }
  .vrs-history-panel { width: 100%; }
  .vrs-history-list { max-height: 260px; }
}

@media (max-width: 640px) {
  .vrs-app { padding: 20px 14px 60px 14px; }
  .vrs-title { font-size: 22px; }
  .vrs-subtitle { font-size: 13px; }
  .vrs-source-row { grid-template-columns: 1fr; }
  .vrs-search-box { padding: 6px 6px 6px 12px; }
  .vrs-search-btn { padding: 9px 14px; font-size: 13px; }
  .vrs-results { grid-template-columns: 1fr; }
}