/* ============================================
   BUSCADOR CIE-11 — Design System
   ============================================ */

/* Focus visible (a11y) - only show outline on keyboard navigation */
*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
  border-radius: 4px;
}

:root {
  /* Color Palette — Medical Teal/Blue */
  --primary-50: #e6faf8;
  --primary-100: #b3f0e8;
  --primary-200: #80e6d8;
  --primary-300: #4ddcc8;
  --primary-400: #26d4bb;
  --primary-500: #0fb9a3;
  --primary-600: #0d9e8c;
  --primary-700: #0a7d6f;
  --primary-800: #075c52;
  --primary-900: #043b35;

  --accent-50: #eef2ff;
  --accent-100: #c7d2fe;
  --accent-400: #818cf8;
  --accent-500: #6366f1;
  --accent-600: #4f46e5;

  /* Neutrals */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* Semantic */
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Light Theme */
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8fafc;
  --bg-glass: rgba(255, 255, 255, 0.72);
  --bg-glass-border: rgba(255, 255, 255, 0.3);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-tertiary: var(--gray-400);
  --border-color: var(--gray-200);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 30px rgba(15, 185, 163, 0.15);

  /* Layout */
  --max-width: 1200px;
  --header-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0c1222;
  --bg-secondary: #141d30;
  --bg-tertiary: #1a2540;
  --bg-glass: rgba(20, 29, 48, 0.8);
  --bg-glass-border: rgba(255, 255, 255, 0.06);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --border-color: rgba(255, 255, 255, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 40px rgba(15, 185, 163, 0.12);
}

/* ============================================
   Reset & Base
   ============================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
}

/* ============================================
   Header
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--bg-glass-border);
  height: var(--header-height);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.logo-icon svg {
  width: 22px;
  height: 22px;
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--primary-500), var(--accent-500));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-subtitle {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.theme-toggle:hover {
  color: var(--primary-500);
  border-color: var(--primary-500);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.icon-moon {
  display: none;
}

[data-theme="dark"] .icon-sun {
  display: none;
}

[data-theme="dark"] .icon-moon {
  display: block;
}

/* ============================================
   Main
   ============================================ */
.main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  min-height: calc(100vh - var(--header-height) - 60px);
}

/* ============================================
   Search Section
   ============================================ */
.search-section {
  margin-bottom: 2rem;
}

.search-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition);
}

.search-card:focus-within {
  box-shadow: var(--shadow-glow);
}

.search-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.tab:hover {
  border-color: var(--primary-400);
  color: var(--primary-500);
}

.tab.active {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(15, 185, 163, 0.3);
}

.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 1rem;
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
}

.search-icon svg {
  width: 20px;
  height: 20px;
}

.search-input {
  width: 100%;
  padding: 0.9rem 3rem 0.9rem 3rem;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

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

.search-input:focus {
  border-color: var(--primary-400);
  box-shadow: 0 0 0 3px rgba(15, 185, 163, 0.12);
}

.search-clear {
  position: absolute;
  right: 0.75rem;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: var(--gray-200);
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

[data-theme="dark"] .search-clear {
  background: var(--gray-700);
  color: var(--gray-400);
}

.search-clear:hover {
  background: var(--danger);
  color: white;
}

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

.search-spinner {
  position: absolute;
  right: 0.85rem;
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--border-color);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.search-hint {
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  padding-left: 0.25rem;
}

/* ============================================
   Results
   ============================================ */
.results-section {
  animation: fadeUp 0.3s ease-out;
}

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

.results-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.results-count {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  background: var(--bg-secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 100px;
  border: 1px solid var(--border-color);
}

.results-grid {
  display: grid;
  gap: 0.75rem;
}

/* Result Card */
.result-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  animation: fadeUp 0.3s ease-out backwards;
}

.result-card:hover {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.result-card:active {
  transform: translateY(0);
}

.result-code {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  min-width: 60px;
  text-align: center;
  letter-spacing: 0.03em;
}

.result-code.no-code {
  background: var(--gray-400);
}

.result-body {
  flex: 1;
  min-width: 0;
}

.result-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  line-height: 1.4;
}

.result-title em {
  background: rgba(15, 185, 163, 0.15);
  color: var(--primary-600);
  font-style: normal;
  padding: 0.05em 0.2em;
  border-radius: 3px;
}

[data-theme="dark"] .result-title em {
  color: var(--primary-300);
}

.result-meta {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-chapter {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.result-arrow {
  flex-shrink: 0;
  color: var(--text-tertiary);
  display: flex;
}

.result-arrow svg {
  width: 16px;
  height: 16px;
}

/* ============================================
   Mapping Section
   ============================================ */
.mapping-section {
  animation: fadeUp 0.3s ease-out;
}

.mapping-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.mapping-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.mapping-source,
.mapping-target {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 150px;
}

.mapping-source h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.mapping-source p,
.mapping-target p {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.mapping-badge {
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-icd10 {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.badge-icd11 {
  background: rgba(15, 185, 163, 0.12);
  color: var(--primary-500);
}

.mapping-arrow {
  flex-shrink: 0;
  color: var(--primary-500);
  opacity: 0.6;
}

.mapping-arrow svg {
  width: 24px;
  height: 24px;
}

.mapping-results {
  display: grid;
  gap: 0.75rem;
}

.mapping-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all var(--transition);
}

.mapping-item:hover {
  border-color: var(--primary-400);
  transform: translateX(4px);
}

.mapping-item-code {
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: white;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  min-width: 55px;
  text-align: center;
}

.mapping-item-body {
  flex: 1;
  min-width: 0;
}

.mapping-item-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
}

.mapping-item-method {
  font-size: 0.73rem;
  color: var(--text-tertiary);
  margin-top: 0.15rem;
}

.confidence-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  text-transform: capitalize;
}

.confidence-alta {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.confidence-media {
  background: rgba(245, 158, 11, 0.12);
  color: var(--warning);
}

.confidence-baja {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

/* Mapping Pair Cards (CIE-10 → CIE-11 side by side) */
.mapping-pair-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  animation: fadeUp 0.3s ease-out backwards;
}

.mapping-pair-card:hover {
  border-color: var(--primary-400);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.mapping-pair-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.mapping-pair-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.mapping-pair-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  width: fit-content;
}

.cie10-side .mapping-pair-label {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.cie11-side .mapping-pair-label {
  background: rgba(15, 185, 163, 0.12);
  color: var(--primary-500);
}

.mapping-pair-code {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

.mapping-pair-title {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mapping-pair-arrow {
  flex-shrink: 0;
  color: var(--primary-500);
  display: flex;
  align-items: center;
  opacity: 0.7;
}

.mapping-pair-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.mapping-pair-method {
  font-size: 0.72rem;
  color: var(--text-tertiary);
}

.mapping-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

/* ============================================
   Detail Panel
   ============================================ */
.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.detail-overlay:not(.hidden) {
  opacity: 1;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-xl);
}

.detail-panel:not(.hidden) {
  transform: translateX(0);
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.breadcrumb {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  font-size: 0.82rem;
}

.breadcrumb nav ol {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.breadcrumb li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.breadcrumb li:not(:last-child)::after {
  content: '/';
  color: var(--text-tertiary);
  opacity: 0.5;
}

.breadcrumb a {
  color: var(--primary-500);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition);
}

.breadcrumb a:hover {
  color: var(--primary-400);
  text-decoration: underline;
}

.detail-code {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
  color: white;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  letter-spacing: 0.03em;
}

.detail-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-primary);
}

.detail-close {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.detail-close:hover {
  background: var(--danger);
  color: white;
  border-color: transparent;
}

.detail-close svg {
  width: 16px;
  height: 16px;
}

.detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.detail-section {
  margin-bottom: 1.5rem;
}

.detail-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary-500);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.detail-section-title svg {
  width: 14px;
  height: 14px;
}

.detail-section p,
.detail-section li {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.detail-section ul {
  list-style: none;
  padding: 0;
}

.detail-section li {
  padding: 0.3rem 0;
  padding-left: 1.2rem;
  position: relative;
}

.detail-section li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.75rem;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary-400);
}

.detail-tag {
  display: inline-block;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: 100px;
  font-size: 0.78rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
  color: var(--text-secondary);
}

.detail-parent-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.85rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--primary-500);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
}

.detail-parent-link:hover {
  border-color: var(--primary-400);
  background: rgba(15, 185, 163, 0.08);
}

.detail-browser-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.6rem 1rem;
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: all var(--transition);
}

.detail-browser-link:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.detail-browser-link svg {
  width: 14px;
  height: 14px;
}

.detail-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
}

.detail-loading .search-spinner {
  position: static;
}

/* ============================================
   Result Action Buttons (copy / fav)
   ============================================ */
.result-actions {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  transition: all var(--transition);
  padding: 0;
}

.action-btn:hover {
  background: var(--bg-tertiary);
  color: var(--primary-500);
}

.action-btn.is-fav {
  color: #f59e0b;
}

/* ============================================
   Detail Action Row (copy + fav in detail)
   ============================================ */
.detail-actions-row {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0;
}

.detail-action-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.detail-action-btn:hover {
  border-color: var(--primary-400);
  color: var(--primary-500);
  background: rgba(15, 185, 163, 0.06);
}

.detail-fav-btn.is-fav {
  color: #f59e0b;
  border-color: rgba(245, 158, 11, 0.3);
  background: rgba(245, 158, 11, 0.06);
}

/* ============================================
   Favorites Toggle Button (header)
   ============================================ */
.fav-toggle-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}

.fav-toggle-btn:hover {
  border-color: #f59e0b;
  color: #f59e0b;
}

.fav-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--primary-500);
  color: white;
  font-size: 0.6rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.fav-count:empty {
  display: none;
}

/* ============================================
   Favorites Panel (sidebar drawer)
   ============================================ */
.favorites-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 360px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  animation: slideInRight 0.25s ease-out;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.favorites-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.favorites-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.favorites-close-btn {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.favorites-close-btn:hover {
  color: var(--text-primary);
}

.favorites-list {
  padding: 0.75rem;
  flex: 1;
}

.favorites-empty {
  text-align: center;
  color: var(--text-tertiary);
  padding: 2rem 1rem;
  font-size: 0.85rem;
}

.favorite-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition);
}

.favorite-item:hover {
  background: var(--bg-tertiary);
}

.fav-item-code {
  background: var(--primary-500);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.fav-item-title {
  font-size: 0.82rem;
  color: var(--text-primary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fav-item-actions {
  display: flex;
  gap: 0.15rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.favorite-item:hover .fav-item-actions {
  opacity: 1;
}

.fav-copy-btn,
.fav-remove-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 0;
  transition: all var(--transition);
}

.fav-copy-btn:hover {
  color: var(--primary-500);
  background: var(--bg-secondary);
}

.fav-remove-btn:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
}

/* ============================================
   Search History Dropdown
   ============================================ */
.history-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  margin-top: 4px;
  z-index: 100;
  overflow: hidden;
  animation: fadeUp 0.15s ease-out;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.history-clear-btn {
  background: none;
  border: none;
  color: var(--primary-500);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-family: inherit;
}

.history-clear-btn:hover {
  background: rgba(15, 185, 163, 0.08);
}

.history-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.85rem;
  cursor: pointer;
  transition: background var(--transition);
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.history-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.history-item svg {
  flex-shrink: 0;
  opacity: 0.4;
}

/* ============================================
   Keyboard Focus Highlight
   ============================================ */
.result-card.keyboard-focus,
.mapping-item.keyboard-focus {
  outline: 2px solid var(--primary-400);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px rgba(15, 185, 163, 0.15);
}

/* ============================================
   Toast Variants (success / info)
   ============================================ */
.toast.success {
  background: var(--primary-500);
  color: white;
}

.toast.info {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-tertiary);
  animation: fadeUp 0.5s ease-out;
}

.empty-illustration {
  width: 160px;
  height: 160px;
  margin: 0 auto 1.5rem;
}

.empty-illustration svg {
  width: 100%;
  height: 100%;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.empty-state p {
  font-size: 0.9rem;
  max-width: 360px;
  margin: 0 auto;
}

/* ============================================
   Toast
   ============================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  box-shadow: var(--shadow-xl);
  font-size: 0.85rem;
  color: var(--text-primary);
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  animation: slideInRight 0.3s ease-out;
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.success {
  border-left: 3px solid var(--success);
}

/* ============================================
   Footer
   ============================================ */
.footer {
  text-align: center;
  padding: 1.5rem;
  border-top: 1px solid var(--border-color);
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

.footer a {
  color: var(--primary-500);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

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

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
  background: linear-gradient(90deg,
      var(--bg-tertiary) 25%,
      var(--border-color) 50%,
      var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-card {
  height: 70px;
  border-radius: var(--radius-md);
}

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

  100% {
    background-position: 200% 0;
  }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .main {
    padding: 1.25rem 1rem 3rem;
  }

  .search-card {
    padding: 1.125rem;
  }

  .search-tabs {
    gap: 0.35rem;
  }

  .tab {
    padding: 0.5rem 0.75rem;
    font-size: 0.78rem;
    flex: 1;
    justify-content: center;
  }

  .tab svg {
    display: none;
  }

  .detail-panel {
    width: 100vw;
  }

  .mapping-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .mapping-arrow {
    transform: rotate(90deg);
    align-self: center;
  }

  .mapping-pair-row {
    flex-direction: column;
    gap: 0.5rem;
  }

  .mapping-pair-arrow {
    transform: rotate(90deg);
  }

  .mapping-pair-side {
    width: 100%;
    align-items: center;
    text-align: center;
  }

  .logo-subtitle {
    display: none;
  }
}

@media (max-width: 480px) {
  .tab {
    font-size: 0.72rem;
    padding: 0.45rem 0.5rem;
  }
}