/**
 * Railbookers - Package Finder Styles (Production Match v4)
 * ==========================================================
 * Matches production Railbookers booking site exactly:
 *   - Mode dropdown menu, Close buttons on panels
 *   - Duration range slider, Trash icon for delete
 *   - Clean production-style result cards
 * Developed by Rajan Mishra
 */

/* ============================================================================
   VARIABLES
   ============================================================================ */
:root {
  --rb-blue: #1a365d;
  --rb-blue-light: #2c5282;
  --rb-blue-dark: #0f2440;
  --rb-blue-50: #ebf2ff;
  --rb-blue-100: #dae4f5;
  --rb-yellow: #c8a951;
  --rb-yellow-hover: #b89840;
  --rb-yellow-bg: #fdf6e3;
  --rb-white: #ffffff;
  --rb-off-white: #f7f8fa;
  --rb-gray-50: #f9fafb;
  --rb-gray-100: #f1f3f5;
  --rb-gray-200: #e2e6ea;
  --rb-gray-300: #ced4da;
  --rb-gray-400: #adb5bd;
  --rb-gray-500: #8b95a1;
  --rb-gray-600: #6c757d;
  --rb-gray-700: #4a5568;
  --rb-gray-800: #2d3748;
  --rb-gray-900: #1a202c;
  --rb-green: #38a169;
  --rb-green-light: #c6f6d5;
  --rb-red: #c0392b;
  --rb-red-bg: #fce4e4;
  --rb-orange: #dd6b20;
  --font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --radius-pill: 30px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
  --shadow-panel: 0 8px 32px rgba(0,0,0,0.15);
  --transition: 200ms ease;
  /* Unified type scale (matches detail.css) */
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.25rem;
  --text-3xl: 1.5rem;
}

/* ============================================================================
   RESET
   ============================================================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}
body {
  font-family: var(--font-family);
  color: var(--rb-gray-900);
  background: var(--rb-off-white);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ============================================================================
   SITE HEADER (Professional Navigation Bar)
   ============================================================================ */
.rb-site-header {
  background: var(--rb-blue);
  color: #fff;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.rb-header-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: #fff;
}
.rb-header-wordmark {
  display: inline-block;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
}
.rb-header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}
.rb-header-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.rb-header-nav-link:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}
.rb-header-nav-link.active {
  background: rgba(255,255,255,0.15);
  color: #fff;
  font-weight: 600;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rb-gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--rb-gray-400); }



/* ============================================================================
   MAIN LAYOUT
   ============================================================================ */
.rb-main {
  max-width: 100%;
  margin: 0;
  padding: 0 24px 32px;
  background: #fff;
  min-height: calc(100vh - 56px);
  border-left: none;
  border-right: none;
  width: 100vw;
}

/* ============================================================================
   SEARCH AREA
   ============================================================================ */
.rb-search-area {
  background: #fff;
  border-radius: 0;
  box-shadow: none;
  border: none;
  border-bottom: 1px solid var(--rb-gray-300);
  padding: 28px 0 16px;
  margin-bottom: 0;
  position: relative;
  z-index: 50;
}

/* Instruction Banner (matches production Railbookers) */
.rb-instruction-banner {
  font-size: var(--text-base);
  color: var(--rb-gray-800);
  padding-bottom: 12px;
  border-bottom: none;
  line-height: 1.5;
}
.rb-instruction-banner strong {
  color: #000;
  font-weight: 700;
  font-style: italic;
}

/* Panel Title Inline (next to close) */
.rb-panel-title-inline {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--rb-gray-800);
}

/* SEARCH ROWS */
.rb-search-rows {
  margin-bottom: 16px;
}
.rb-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rb-and-separator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.rb-and-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rb-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rb-and-line {
  flex: 1;
  height: 1px;
  background: var(--rb-gray-200);
}

.rb-search-row-inner {
  flex: 1;
  display: flex;
  align-items: center;
  border: 2px solid var(--rb-gray-200);
  border-radius: var(--radius);
  overflow: visible;
  transition: border-color var(--transition);
  position: relative;
}
.rb-search-row-inner:focus-within {
  border-color: var(--rb-blue-light);
  box-shadow: 0 0 0 3px rgba(44,82,130,0.1);
}

/* ============================================================================
   MODE SELECTOR + DROPDOWN
   ============================================================================ */
.rb-mode-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--rb-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
  min-height: 44px;
  position: relative;
}
.rb-mode-selector:hover {
  background: var(--rb-blue-light);
}
.rb-mode-label { pointer-events: none; }

/* Mode dropdown menu — now positioned on .rb-search-row-inner */
.rb-mode-dropdown {
  position: absolute;
  min-width: 160px;
  background: var(--rb-white);
  border: 1px solid var(--rb-gray-200);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: modeDropIn 0.15s ease both;
}
@keyframes modeDropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.rb-mode-option {
  padding: 10px 16px;
  font-size: var(--text-base);
  color: var(--rb-gray-800);
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--rb-gray-50);
  font-weight: 500;
}
.rb-mode-option:last-child { border-bottom: none; }
.rb-mode-option:hover {
  background: var(--rb-blue-50);
  color: var(--rb-blue);
}
.rb-mode-option.active {
  background: var(--rb-blue);
  color: white;
  font-weight: 600;
}

/* ============================================================================
   SEARCH INPUT AREA (with inline tags)
   ============================================================================ */
.rb-search-input-area {
  flex: 1;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 8px;
  min-height: 44px;
  position: relative;
}

.rb-dest-input {
  flex: 1;
  min-width: 160px;
  border: none;
  outline: none;
  font-size: var(--text-base);
  font-family: var(--font-family);
  color: var(--rb-gray-800);
  background: transparent;
  padding: 6px 4px;
}
.rb-dest-input::placeholder {
  color: var(--rb-gray-400);
  font-style: italic;
}

/* Inline Destination Tags */
.rb-inline-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--rb-blue-50);
  color: var(--rb-blue);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rb-blue-100);
  white-space: nowrap;
  animation: tagIn 0.2s ease both;
}
@keyframes tagIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}
.rb-inline-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: rgba(44,82,130,0.15);
  color: var(--rb-blue);
  border: none;
  border-radius: 50%;
  font-size: var(--text-xs);
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  padding: 0;
}
.rb-inline-tag-remove:hover {
  background: var(--rb-red);
  color: white;
}
.rb-or-sep {
  font-size: var(--text-sm);
  color: var(--rb-gray-400);
  font-weight: 500;
  padding: 0 2px;
}

/* ============================================================================
   ROW ACTION BUTTONS
   ============================================================================ */
.rb-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.rb-row-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--rb-gray-200);
  background: var(--rb-white);
  color: var(--rb-gray-500);
  cursor: pointer;
  transition: var(--transition);
}
.rb-row-btn.rb-row-add {
  border-color: var(--rb-blue-light);
  color: var(--rb-blue-light);
  background: rgba(44,82,130,0.08);
}
.rb-row-btn.rb-row-add:hover {
  background: var(--rb-blue-light);
  color: white;
}
.rb-row-btn.rb-row-delete {
  border-color: var(--rb-gray-300);
  color: var(--rb-gray-500);
}
.rb-row-btn.rb-row-delete:hover {
  border-color: var(--rb-red);
  color: var(--rb-red);
  background: var(--rb-red-bg);
}

/* ============================================================================
   AUTOSUGGEST DROPDOWN
   ============================================================================ */
.rb-suggest-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: var(--rb-white);
  border: 1px solid var(--rb-gray-200);
  border-radius: var(--radius);
  max-height: 280px;
  overflow-y: auto;
  z-index: 190;
  box-shadow: var(--shadow-lg);
  display: none;
}
.rb-suggest-dropdown.visible { display: block; }
.rb-suggest-item {
  padding: 10px 16px;
  font-size: var(--text-base);
  color: var(--rb-gray-800);
  cursor: pointer;
  transition: background 0.1s ease;
  border-bottom: 1px solid var(--rb-gray-50);
}
.rb-suggest-item:hover, .rb-suggest-item.active {
  background: var(--rb-blue-50);
  color: var(--rb-blue);
}
.rb-suggest-item:last-child { border-bottom: none; }

/* ============================================================================
   FILTER BAR
   ============================================================================ */
.rb-filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px 0 14px;
  border-bottom: 1px solid var(--rb-gray-300);
}
.rb-results-count {
  font-size: var(--text-base);
  color: var(--rb-gray-800);
  font-weight: 500;
  margin-right: auto;
  white-space: nowrap;
}
.rb-results-count strong {
  color: var(--rb-gray-900);
  font-weight: 700;
}

/* Filter Pills */
.rb-filter-pills {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rb-filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 18px;
  background: var(--rb-white);
  color: var(--rb-gray-800);
  border: 1.5px solid var(--rb-gray-300);
  border-radius: var(--radius-pill, 999px);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  height: 34px;
  min-width: 100px;
  text-align: center;
}
.rb-filter-pill:hover {
  border-color: var(--rb-blue-light);
  color: var(--rb-blue);
  background: var(--rb-blue-50);
}
.rb-filter-pill.active {
  background: var(--rb-blue);
  color: #fff;
  border-color: var(--rb-blue);
}
.rb-filter-pill.has-selection {
  background: var(--rb-blue);
  color: #fff;
  border-color: var(--rb-blue);
}

/* Pill Count Badge */
.rb-pill-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: auto;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
}
.rb-pill-count:empty {
  display: none;
}
.rb-pill-count::before {
  content: '(';
}
.rb-pill-count::after {
  content: ')';
}
.rb-filter-pill.has-selection .rb-pill-count,
.rb-filter-pill.active .rb-pill-count {
  background: rgba(255,255,255,0.2);
}


/* Sort Area */
.rb-sort-area {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  position: relative;
}

/* Clear All Button */
.rb-btn-clear-all {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  background: none;
  color: var(--rb-gray-500);
  border: 1.5px solid var(--rb-gray-300);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  height: 34px;
}
.rb-btn-clear-all:hover {
  color: var(--rb-red);
  border-color: var(--rb-red);
  background: var(--rb-red-bg);
}
.rb-sort-select {
  padding: 8px 32px 8px 14px;
  border: 1px solid var(--rb-gray-300);
  border-radius: 4px;
  font-size: var(--text-base);
  font-family: var(--font-family);
  font-weight: 500;
  color: var(--rb-gray-800);
  background: #fff;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='10' viewBox='0 0 10 10' fill='%236c757d' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2 3.5L5 7l3-3.5H2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  min-width: 180px;
}
.rb-sort-select:focus {
  border-color: var(--rb-blue-light);
}
.rb-sort-chevron {
  display: none;
}

/* ============================================================================
   FILTER POPUP PANELS
   ============================================================================ */
.rb-filter-popups {
  position: relative;
}
.rb-filter-panel {
  position: absolute;
  top: 4px;
  left: 0;
  right: 0;
  background: var(--rb-white);
  border: 1px solid var(--rb-gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-panel);
  z-index: 90;
  padding: 20px;
  animation: panelSlide 0.2s ease both;
  max-height: 500px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@keyframes panelSlide {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Panel Close Button */
.rb-panel-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.rb-panel-close {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--rb-gray-500);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}
.rb-panel-close:hover {
  color: var(--rb-gray-800);
  background: var(--rb-gray-50);
}

.rb-panel-header {
  margin-bottom: 14px;
}
.rb-panel-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--rb-gray-700);
}
.rb-panel-search {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--rb-gray-200);
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-family: var(--font-family);
  color: var(--rb-gray-800);
  outline: none;
  transition: var(--transition);
}
.rb-panel-search:focus {
  border-color: var(--rb-blue-light);
  box-shadow: 0 0 0 3px rgba(44,82,130,0.1);
}

/* Filter Panel Chips */
.rb-panel-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  padding: 6px 0;
  margin-bottom: 6px;
  min-height: 80px;
  align-items: flex-start;
  align-content: flex-start;
}

/* Selected Badge */
.rb-selected-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--rb-blue);
  background: var(--rb-blue-50);
  border: 1px solid var(--rb-blue-100);
  padding: 3px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: 6px;
}

/* Chip Pagination */
.rb-chips-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0 4px;
  border-top: 1px solid var(--rb-gray-100);
  margin-bottom: 8px;
}
.rb-page-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  background: var(--rb-white);
  color: var(--rb-blue-light);
  border: 1.5px solid var(--rb-gray-300);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.rb-page-btn:hover:not(:disabled) {
  background: var(--rb-blue-50);
  border-color: var(--rb-blue-light);
  color: var(--rb-blue);
}
.rb-page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.rb-page-info {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rb-gray-500);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.rb-chip-opt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 14px;
  background: #fff;
  color: var(--rb-gray-700);
  border: 1.5px solid var(--rb-gray-300);
  border-radius: var(--radius-pill, 999px);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  height: 32px;
  min-width: 80px;
  line-height: 1;
  text-align: center;
}
.rb-chip-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--rb-gray-500);
  background: var(--rb-gray-100, #f1f3f5);
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.4;
}
.rb-chip-opt.selected .rb-chip-count {
  color: var(--rb-yellow);
  background: rgba(255,255,255,0.25);
}
.rb-chip-opt:hover {
  border-color: var(--rb-yellow);
  background: var(--rb-yellow-bg);
  color: var(--rb-gray-800);
}
.rb-chip-opt.selected {
  background: var(--rb-yellow);
  color: #fff;
  border-color: var(--rb-yellow);
  font-weight: 600;
}


/* Empty chips message */
.rb-chips-empty {
  padding: 16px 12px;
  text-align: center;
  color: var(--rb-gray-500);
  font-size: var(--text-base);
  font-style: italic;
  line-height: 1.5;
}

/* Panel Footer */
.rb-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid var(--rb-gray-200);
}
.rb-panel-links {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rb-link-btn {
  background: none;
  border: none;
  color: var(--rb-gray-600);
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.rb-link-btn:hover {
  color: var(--rb-gray-900);
  text-decoration: underline;
}
.rb-link-sep {
  color: var(--rb-gray-300);
  font-size: var(--text-sm);
}
.rb-panel-apply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 24px;
  background: #fff;
  color: var(--rb-gray-800);
  border: 1px solid var(--rb-gray-300);
  border-radius: 4px;
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: var(--transition);
}
.rb-panel-apply:hover {
  background: #f5f5f5;
  border-color: #aaa;
}

/* ============================================================================
   DURATION RANGE SLIDER
   ============================================================================ */
.rb-duration-slider-area {
  padding: 20px 10px 24px;
}
.rb-slider-labels {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}
.rb-slider-val {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--rb-blue);
  background: var(--rb-blue-50);
  padding: 4px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rb-blue-100);
}
.rb-range-slider-track {
  position: relative;
  height: 6px;
  background: var(--rb-gray-200);
  border-radius: 3px;
  margin-top: 8px;
}
.rb-range-slider-fill {
  position: absolute;
  top: 0;
  height: 100%;
  background: var(--rb-blue);
  border-radius: 3px;
}
.rb-range-input {
  position: absolute;
  top: -8px;
  left: 0;
  width: 100%;
  height: 22px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  pointer-events: none;
  outline: none;
  margin: 0;
}
.rb-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  background: var(--rb-blue);
  border: 3px solid var(--rb-white);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
  pointer-events: all;
  transition: transform 0.15s ease;
}
.rb-range-input::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}
.rb-range-input::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--rb-blue);
  border: 3px solid var(--rb-white);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  cursor: pointer;
  pointer-events: all;
}
.rb-slider-minmax {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font-size: var(--text-sm);
  color: var(--rb-gray-500);
  font-weight: 500;
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */
.rb-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--rb-gray-500);
}
.rb-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--rb-gray-200);
  border-top-color: var(--rb-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
  will-change: transform;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   EMPTY STATE
   ============================================================================ */
.rb-empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--rb-gray-500);
}
.rb-empty-icon { margin-bottom: 16px; opacity: 0.3; }
.rb-empty-state h3 {
  font-size: var(--text-xl);
  color: var(--rb-gray-700);
  margin-bottom: 8px;
  font-weight: 600;
}
.rb-empty-state p {
  font-size: var(--text-base);
  color: var(--rb-gray-500);
  max-width: 400px;
  margin: 0 auto;
}
.rb-empty-state p strong {
  color: var(--rb-blue);
}

/* ============================================================================
   RESULT CARDS (production-match list style)
   ============================================================================ */
.rb-results-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.rb-result-card {
  background: #fff;
  border: none;
  border-bottom: none;
  padding: 20px 0 0;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0 24px;
  transition: background var(--transition);
  animation: cardFadeIn 0.12s ease both;
  position: relative;
  will-change: opacity;
  content-visibility: auto;
  contain-intrinsic-size: auto 160px;
}
.rb-result-card:first-child {
  border-top: 1px solid var(--rb-gray-300);
}
.rb-result-card:hover {
  background: #fcfcfc;
}
@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Card Left Content */
.rb-card-content {
  min-width: 0;
  grid-row: 1;
  grid-column: 1;
}
.rb-card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 2px;
}
.rb-card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #1a202c;
  margin-bottom: 6px;
  line-height: 1.35;
  cursor: pointer;
  transition: var(--transition);
}
.rb-card-title:hover {
  color: #1a365d;
  text-decoration: underline;
}
.rb-card-desc {
  font-size: var(--text-sm);
  color: var(--rb-gray-600);
  line-height: 1.55;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-card-route {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--rb-gray-600);
  font-weight: 500;
  margin-bottom: 0;
}
.rb-route-city {
  display: inline-block;
  color: var(--rb-gray-700);
  font-weight: 500;
  font-size: var(--text-sm);
  background: #fff;
  border: 1px solid #ccc;
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  line-height: 1.4;
  transition: all 0.2s ease;
}
.rb-route-city.matched {
  background: var(--rb-yellow-bg);
  border-color: var(--rb-yellow-hover);
  color: var(--rb-yellow-hover);
  font-weight: 700;
  box-shadow: 0 0 0 1px rgba(200,169,81,0.2);
}
.rb-route-arrow {
  color: #999;
  font-size: var(--text-base);
  margin: 0 2px;
}
.rb-card-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.rb-meta-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--rb-gray-600);
  background: var(--rb-gray-50);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--rb-gray-200);
}
.rb-meta-tag.highlight {
  background: var(--rb-yellow-bg);
  color: var(--rb-yellow-hover);
  border-color: rgba(200,169,81,0.3);
  font-weight: 600;
}
.rb-meta-tag.map-available {
  background: var(--rb-blue-50);
  color: var(--rb-blue);
  border-color: var(--rb-blue-100);
}
/* Train Names Display */
.rb-train-names {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rb-blue);
  background: var(--rb-blue-50);
  border: 1px solid var(--rb-blue-100);
  padding: 5px 12px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  line-height: 1.4;
}
.rb-train-icon {
  font-size: var(--text-md);
  flex-shrink: 0;
}

/* Card Countries */
.rb-card-countries {
  font-size: var(--text-sm);
  color: var(--rb-gray-500);
  margin-top: 2px;
  line-height: 1.4;
}
.rb-card-location-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.rb-country-match {
  color: var(--rb-yellow-hover);
  font-weight: 700;
}

/* Card Region */
.rb-card-region {
  font-size: var(--text-xs);
  color: var(--rb-gray-400);
  margin-top: 1px;
  line-height: 1.3;
  font-style: italic;
}

/* Access Rule Badge */
.rb-access-badge {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--rb-gray-500);
  background: var(--rb-gray-50);
  border: 1px solid var(--rb-gray-200);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  flex-shrink: 0;
  margin-top: 3px;
}



/* Gold underline on card (production match) */
.rb-card-gold-line {
  grid-column: 1 / -1;
  grid-row: 2;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #d4af37 0%, #c8a951 50%, #d4af37 100%);
  border-radius: 0;
  margin-top: 16px;
  min-height: 4px;
}

/* Card Aside — right column with duration + CTA (matches live Railbookers) */
.rb-card-aside {
  grid-row: 1;
  grid-column: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 8px;
  padding: 0;
  min-width: 0;
}
.rb-card-cta-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  width: 100%;
}
.rb-package-market-line {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--rb-gray-700);
  line-height: 1.35;
  max-width: 320px;
  text-align: right;
  white-space: nowrap;
}
.rb-card-days {
  font-size: var(--text-md);
  font-weight: 700;
  color: #1a202c;
  white-space: nowrap;
  line-height: 1.4;
  text-align: right;
}
.rb-btn-itinerary {
  display: inline-flex !important;
  align-items: stretch !important;
  gap: 0 !important;
  padding: 0 !important;
  background: #fff !important;
  color: #333 !important;
  border: 1px solid #bbb !important;
  border-radius: 3px !important;
  font-size: var(--text-base) !important;
  font-weight: 600 !important;
  font-family: var(--font-family);
  text-decoration: none !important;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden;
  min-height: 42px;
  max-height: 44px;
}
.rb-btn-itinerary:hover {
  border-color: #999;
  background: #fafafa;
}
.rb-btn-itinerary-text {
  padding: 11px 20px;
  display: flex;
  align-items: center;
  font-size: var(--text-base);
  font-weight: 600;
  color: #1a202c;
  letter-spacing: -0.005em;
}
.rb-itinerary-icon {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 44px !important;
  background: #c8a951 !important;
  color: #fff !important;
  font-size: 1.1rem;
  font-weight: 400;
  line-height: 1;
  position: relative;
  clip-path: polygon(22% 0%, 100% 0%, 100% 100%, 0% 100%) !important;
  padding-left: 8px;
}
.rb-itinerary-icon .rb-arrow-diag {
  display: inline-block !important;
  font-size: 1.2rem !important;
  font-weight: 400 !important;
  transform: none !important;
  color: #fff !important;
}
.rb-btn-itinerary:hover .rb-itinerary-icon {
  background: #b89840;
}

/* ============================================================================
   EXPANDABLE CARD DETAILS
   ============================================================================ */
.rb-card-expandable {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--rb-gray-100);
  animation: expandFade 0.25s ease both;
}
@keyframes expandFade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.rb-expand-section { margin-bottom: 10px; }
.rb-expand-section:last-child { margin-bottom: 0; }
.rb-expand-section h4 {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--rb-gray-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Highlights List */
.rb-hl-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.rb-hl-list li {
  font-size: var(--text-sm); color: var(--rb-gray-700);
  padding-left: 16px; position: relative; line-height: 1.5;
}
.rb-hl-list li::before {
  content: '★'; position: absolute; left: 0;
  color: var(--rb-yellow); font-size: var(--text-xs); top: 2px;
}

/* Inclusions List */
.rb-inc-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 3px;
}
.rb-inc-list li {
  font-size: var(--text-sm); color: var(--rb-gray-600);
  padding-left: 16px; position: relative; line-height: 1.5;
}
.rb-inc-list li::before {
  content: '✓'; position: absolute; left: 0;
  color: var(--rb-green); font-size: var(--text-sm); font-weight: 700; top: 1px;
}

/* Departure Dates Display */
.rb-dep-dates {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: var(--text-sm); color: var(--rb-gray-600);
  background: var(--rb-gray-50); padding: 6px 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--rb-gray-100);
  line-height: 1.45;
}
.rb-dep-icon { font-size: var(--text-base); flex-shrink: 0; }

/* Expand/Collapse Toggle */
.rb-expand-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 6px; padding: 3px 0;
  background: none; border: none;
  color: var(--rb-blue-light); font-size: var(--text-sm);
  font-weight: 600; font-family: var(--font-family);
  cursor: pointer; transition: var(--transition);
}
.rb-expand-toggle:hover { color: var(--rb-blue); }
.rb-expand-arrow { transition: transform 0.2s ease; }
.rb-expand-toggle.expanded .rb-expand-arrow { transform: rotate(180deg); }

/* ============================================================================
   NO RESULTS
   ============================================================================ */
.rb-no-results {
  text-align: center; padding: 50px 20px;
  background: var(--rb-white); border-radius: var(--radius-lg);
  border: 1px solid var(--rb-gray-200);
}
.rb-no-results-icon { color: var(--rb-gray-400); margin-bottom: 12px; opacity: 0.5; }
.rb-no-results h3 { color: var(--rb-gray-700); margin-bottom: 8px; font-size: var(--text-lg); }
.rb-no-results p { color: var(--rb-gray-600); font-size: var(--text-base); margin-bottom: 12px; }

/* Show More button for lazy loading */
.rb-show-more {
  text-align: center; padding: 20px 0 10px;
}
.rb-btn-show-more {
  padding: 10px 32px;
  background: var(--rb-blue);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font-family);
  cursor: pointer;
  transition: background 0.15s;
}
.rb-btn-show-more:hover { background: var(--rb-blue-dark, #1a365d); }
.rb-suggestions {
  list-style: none; padding: 0;
  display: inline-flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.rb-suggestions li {
  font-size: var(--text-sm); color: var(--rb-gray-600);
  border-radius: var(--radius-pill); border: 1px solid var(--rb-gray-200);
}

/* Error states */
.rb-error-card {
  text-align: center; padding: 50px 20px;
  background: var(--rb-white); border-radius: var(--radius-lg);
  border: 1px solid var(--rb-red-bg);
}
.rb-error-icon { color: var(--rb-red); margin-bottom: 12px; opacity: 0.7; }
.rb-error-card h3 { color: var(--rb-gray-800); margin-bottom: 6px; font-size: var(--text-lg); }
.rb-error-card p { color: var(--rb-gray-600); font-size: var(--text-base); margin-bottom: 16px; }
.rb-btn-retry {
  padding: 8px 20px; background: var(--rb-blue); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: var(--text-base); font-weight: 600; font-family: var(--font-family);
  cursor: pointer; transition: var(--transition);
}
.rb-btn-retry:hover { background: var(--rb-blue-light); transform: translateY(-1px); }

/* ============================================================================
   OVERLAY
   ============================================================================ */
.rb-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.15);
  z-index: 40; cursor: pointer;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */
@media (max-width: 960px) {
  .rb-main { padding: 0 12px 24px; }
  .rb-filter-bar { flex-wrap: wrap; gap: 8px; }
  .rb-filter-pills { flex-wrap: wrap; }
  .rb-result-card {
    grid-template-columns: 1fr;
    gap: 0; padding: 16px 0;
  }
  .rb-card-aside {
    grid-row: auto;
    grid-column: 1;
    align-items: flex-end;
    justify-content: flex-start;
  }
  .rb-card-cta-row {
    flex-wrap: wrap;
  }
  .rb-card-gold-line {
    width: 100%;
    grid-row: auto;
  }
  .rb-site-header {
    padding: 0 16px;
  }
}
@media (max-width: 600px) {
  .rb-mode-selector { padding: 8px 10px; font-size: var(--text-sm); }
  .rb-filter-pill { padding: 5px 10px; font-size: var(--text-xs); }
  .rb-sort-area { width: 100%; }
  .rb-result-card { padding: 14px 0; }
  .rb-card-title { font-size: var(--text-md); }
  .rb-card-gold-line {
    width: 100%;
  }
  .rb-site-header {
    padding: 0 12px;
    height: 48px;
  }
  .rb-header-subtitle { display: none; }
}

/* ============================================================================
   PRINT
   ============================================================================ */
@media print {
  .rb-search-area, .rb-btn-itinerary { display: none !important; }
  .rb-result-card { break-inside: avoid; }
}

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================================
   SEARCH RESULTS BANNER
   ============================================================================ */
.rb-search-banner {
  background: linear-gradient(135deg, #eef4ff 0%, #f0f7ff 100%);
  border: 1px solid #c3d9f5;
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 16px;
}
.rb-search-banner-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.rb-search-banner-label {
  font-size: var(--text-sm);
  color: var(--rb-blue);
  font-weight: 600;
}
.rb-search-banner-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--rb-white);
  border: 1px solid var(--rb-blue-100);
  border-radius: var(--radius-pill);
  padding: 3px 12px;
  font-size: var(--text-sm);
  color: var(--rb-gray-800);
}
.rb-search-banner-chip strong {
  color: var(--rb-blue);
  font-weight: 600;
}

/* Route: "+N more" indicator */
.rb-route-more {
  font-size: 0.75rem;
  color: var(--rb-gray-500);
  font-style: italic;
  margin-left: 4px;
}


