/* ── RANKER PAGE-SPECIFIC CSS ────────────────────────────── */

/* ── BODY OVERRIDE ───────────────────────────────────────── */
/* ranker uses white background instead of #f4f4f2 */
body { background: #fff; }

/* ── MAIN LAYOUT ─────────────────────────────────────────── */
#appBody {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── LEFT PANEL ──────────────────────────────────────────── */
#priorities {
  width: 420px;
  min-width: 420px;
  padding: 32px 28px;
  border-right: 1px solid #e5e5e5;
  overflow-y: auto;
  height: 100%;
}

.priorities-intro {
  margin-bottom: 12px;
}

.priorities-question {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 12px;
}

.priorities-instructions {
  font-size: 13px;
  color: #888;
  line-height: 1.5;
}

.priorities-hint {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hint-label {
  font-size: 12px;
  color: #555;
  line-height: 1.4;
  flex-shrink: 0;
}

.hint-slider {
  display: flex;
  align-items: center;
  gap: 0;
  flex: 1;
}

.hint-thumb {
  width: 20px;
  height: 20px;
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
  flex-shrink: 0;
  z-index: 1;
}

.hint-track {
  flex: 1;
  height: 4px;
  background: #d0d0d0;
  border-radius: 2px;
}

.hint-arrow {
  font-size: 16px;
  color: #333;
  margin: 0 6px;
  flex-shrink: 0;
}

.hint-more {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
  color: #333;
  white-space: nowrap;
  flex-shrink: 0;
}

h2 {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.priority-bars { margin-bottom: 28px; }

.priority-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 28px;
}

.priority-bar-row .bar-label {
  flex: 1;
  font-size: 13px;
  color: #bbb;
  white-space: nowrap;
  padding: 3px 6px;
  border-radius: 3px;
  background: linear-gradient(to right, #b58d95 var(--bar-fill, 0%), transparent var(--bar-fill, 0%));
  transition: background .2s;
}
.priority-bar-row .bar-label.active { color: #1a1a1a; font-weight: 600; }

.priority-bar-row .bar-pct {
  font-size: 13px;
  font-weight: 600;
  width: 36px;
  text-align: right;
}
.priority-bar-row .bar-pct.dim { color: #bbb; font-weight: 400; }

/* toggle grid */
.toggle-grid { display: flex; flex-direction: column; }
.test-dir-select {
  appearance: none;
  -webkit-appearance: none;
  background: none;
  border: none;
  border-bottom: 1px dashed #bbb;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  cursor: pointer;
  padding: 0 14px 0 0;
  margin: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23aaa'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 2px center;
  outline: none;
}
.test-dir-select:hover { border-bottom-color: #888; }

.toggle-section-header {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #aaa;
  padding: 18px 0 6px;
}

.toggle-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid #f0f0f0;
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row.toggle-unavailable { opacity: 0.4; }
.toggle-info { flex: 1; }
.toggle-label { font-size: 13px; font-weight: 700; color: #1a1a1a; margin-bottom: 2px; }
.toggle-desc  { font-size: 11px; color: #888; line-height: 1.35; }
.toggle-switch { flex-shrink: 0; position: relative; display: inline-block; width: 36px; height: 20px; margin-top: 2px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-knob {
  position: absolute; cursor: pointer; inset: 0;
  background: #ddd; border-radius: 20px; transition: .2s;
}
.toggle-knob::before {
  content: ''; position: absolute;
  width: 14px; height: 14px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .2s;
}
.toggle-switch input:checked + .toggle-knob { background: var(--primary); }
.toggle-switch input:checked + .toggle-knob::before { transform: translateX(16px); }
.toggle-row.toggle-unavailable .toggle-switch { pointer-events: none; }

/* slider grid (configure modal only) */
.slider-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px 80px;
}

@keyframes slideInRight {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
@keyframes slideOutRight {
  from { transform: translateX(0); }
  to   { transform: translateX(100%); }
}
#configureModalOverlay { transition: background 0.3s; }
#configureModalOverlay.closing { background: rgba(0,0,0,0) !important; }
#configurePanel {
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}
#configurePanel.closing {
  animation: slideOutRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.slider-section-header {
  grid-column: 1 / -1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #aaa;
  padding-bottom: 4px;
  border-bottom: 1px solid #f0f0f0;
  margin-bottom: -20px;
}

.slider-label { font-size: 13px; font-weight: 700; margin-bottom: 2px; }

.slider-desc { font-size: 11px; color: #888; margin-bottom: 8px; line-height: 1.3; }

.slider-unavailable .slider-label { color: #bbb; }
.slider-unavailable .slider-desc  { color: #ccc; }
.slider-unavailable .slider-track { opacity: .4; pointer-events: none; }

.slider-track {
  position: relative;
  height: 6px;
  background: #e5e5e5;
  border-radius: 3px;
}

.slider-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
}

.slider-track input[type=range] {
  position: absolute;
  width: 100%; height: 100%;
  top: 0; left: 0;
  opacity: 0;
  cursor: grab;
  margin: 0;
}
.slider-track input[type=range]:active { cursor: grabbing; }

.slider-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 18px; height: 18px;
  background: var(--primary);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

/* ── RIGHT PANEL ─────────────────────────────────────────── */
#rankings {
  flex: 1;
  padding: 32px 32px;
  overflow-y: auto;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rankings-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: #1a1a1a;
  position: relative;
}
.filter-btn:hover { border-color: #999; }
.filter-btn.active { border-color: var(--primary); }

.filter-btn .badge {
  background: #1a1a1a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.filter-btn .chevron { font-size: 10px; color: #999; }

/* dropdowns */
.dropdown-wrap { position: relative; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 180px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  z-index: 1100;
  padding: 6px 0 0;
  flex-direction: column;
}
.dropdown-menu.open { display: flex; }

.dropdown-scroll {
  overflow-y: auto;
  max-height: 240px;
}

.dropdown-menu label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
.dropdown-menu label:hover { background: #f5f5f5; }
.dropdown-menu label input[type=checkbox] { accent-color: var(--primary); }

.dropdown-done-row {
  border-top: 1px solid #f0f0f0;
  padding: 8px 12px;
}
.dropdown-done-row button {
  width: 100%;
  padding: 7px 0;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.dropdown-done-row button:hover { background: var(--primary-dark); }

.search-box {
  flex: 1;
  min-width: 160px;
  padding: 7px 14px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  color: #1a1a1a;
}
.search-box::placeholder { color: #bbb; }
.search-box:focus { border-color: var(--primary); }

/* typeahead */
.typeahead-wrap {
  position: relative;
}

.typeahead-input {
  padding: 7px 14px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  color: #1a1a1a;
  width: 200px;
}
.typeahead-input::placeholder { color: #bbb; }
.typeahead-input:focus { border-color: var(--primary); }

.typeahead-suggestions {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 280px;
  background: #fff;
  border: 1.5px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  z-index: 1100;
  max-height: 220px;
  overflow-y: auto;
}
.typeahead-suggestions.open { display: block; }

.typeahead-suggestion {
  padding: 9px 14px;
  font-size: 13px;
  cursor: pointer;
}
.typeahead-suggestion:hover,
.typeahead-suggestion.highlighted { background: var(--neutral); color: var(--tertiary); }

/* chips */
.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: #F8F5EF;
  border: 1px solid var(--primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary-dark);
}

.chip-remove {
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--tertiary);
  background: none;
  border: none;
  padding: 4px 2px 4px 4px;
  margin: -4px -2px -4px -4px;
}
.chip-remove:hover { color: #c00; }

/* status bar */
#statusBar {
  font-size: 12px;
  color: #888;
  margin-bottom: 12px;
  min-height: 18px;
}

/* save to my colleges button */
#saveCollegesBtn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
#saveCollegesBtn:hover { background: var(--primary-dark); }

/* view toggle — ranker uses font-weight: 500 and 3-way separator */
.view-btn {
  font-weight: 500;
}
.view-btn:not(:last-child) { border-right: 1px solid #d0d0d0; }

/* map */
#mapContainer {
  display: none;
  flex: 1;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
}
#map { width: 100%; height: 100%; }

.map-marker {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 10px; font-weight: 700;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
  cursor: pointer;
}

/* ── UNI TABLE OVERRIDES ─────────────────────────────────── */
/* ranker has col-active styles */
.uni-table thead th.col-active { color: var(--tertiary); }
.uni-table td.col-active { color: #1a1a1a; font-weight: 500; }

/* ranker cursor is pointer, not grab */
.uni-table tbody tr { cursor: pointer; }

/* col-name left position for ranker (col-name left is overridden in JS anyway) */
.col-name {
  left: 84px;
}

/* ranker checkbox uses var(--primary) accent color */
.col-check input[type="checkbox"] {
  accent-color: var(--primary);
}

/* ── CATEGORY BADGE (My Chances column) ────────────────────── */
.col-category { text-align: center; white-space: nowrap; }
.category-badge {
  display: inline-block;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}
.category-badge.safety  { background: #d1f0d8; color: #1a6630; }
.category-badge.likely  { background: #d1e8f0; color: #1a5066; }
.category-badge.target  { background: #fef3cd; color: #7a5500; }
.category-badge.reach   { background: #fde0e0; color: #7a1a1a; }

/* ── MODAL EXTRA: rank badge ─────────────────────────────── */
.modal-rank-badge {
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px;
}

.modal-website-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #1a1a1a;
  text-decoration: none;
  border: 1.5px solid #1a1a1a;
  border-radius: 50%;
  width: 32px; height: 32px;
  justify-content: center;
  margin-bottom: 4px;
}
.modal-website-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  margin-bottom: 20px;
}
.modal-website-label { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #1a1a1a; }

/* ── RANGE BAR FILL ──────────────────────────────────────── */
/* ranker uses var(--primary) for range bars; my-colleges uses #164B24 */
.range-bar-fill { background: var(--primary); }

/* ── STATE MSG & SPINNER ─────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 3px solid #e5e5e5;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin-bottom: 12px;
}

/* ── #compareView ────────────────────────────────────────── */
#compareView { display: none; padding: 24px 28px; max-width: 960px; }

.compare-back-btn {
  padding: 8px 16px;
  font-size: 13px;
}

/* ── MOBILE RESPONSIVENESS ───────────────────────────────── */
@media (max-width: 768px) {
  body {
    height: auto;
    overflow: visible;
  }

  #topHeader {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 16px 0;
    gap: 0;
    height: auto;
  }

  .top-nav {
    display: flex;
    flex: none;
    height: auto;
    align-items: center;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    width: 100%;
    justify-content: flex-start;
  }
  .top-nav::-webkit-scrollbar { display: none; }
  .top-nav-tab {
    font-size: 12px;
    padding: 8px 12px;
    white-space: nowrap;
    flex-shrink: 0;
    height: auto;
    border-bottom-width: 2px;
  }

  #appBody {
    flex-direction: column;
    overflow: visible;
    height: auto;
  }

  #priorities {
    display: none;
  }

  #rankings {
    width: 100%;
    padding: 16px;
    overflow-y: visible;
    height: auto;
  }

  #uniTableWrap {
    display: none;
  }

  #mobileCards {
    display: block;
  }

  #configurePanel {
    width: 100% !important;
    border-radius: 0 !important;
  }

  #mapContainer {
    height: 55vh;
  }

  .modal-body-cols {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .modal-main {
    overflow-y: visible;
  }
  .modal-sidebar {
    border-left: none;
    border-top: 1px solid #f0f0f0;
    overflow-y: visible;
  }
}

@media (min-width: 769px) {
  #mobileCards {
    display: none;
  }
  #mobilePrioritiesBtn {
    display: none;
  }
}

/* ── MOBILE CARDS ────────────────────────────────────────── */
.mobile-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border: 1px solid #e8e8e8;
  border-radius: 10px;
  margin-bottom: 10px;
  background: #fff;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.mobile-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.1); }

.mobile-card-rank {
  font-size: 16px;
  font-weight: 800;
  color: #1a1a1a;
  min-width: 28px;
  text-align: center;
}

.mobile-card-logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
}

.mobile-card-info {
  flex: 1;
  min-width: 0;
}

.mobile-card-name {
  font-size: 14px;
  font-weight: 700;
  color: #1a1a1a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-card-location {
  font-size: 12px;
  color: #888;
  margin-top: 2px;
}

.mobile-card-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.mobile-card-score-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  background: #F8F5EF;
  color: var(--primary-dark);
  border: 1px solid var(--primary);
}

/* ── FLOATING PRIORITIES BUTTON (mobile only) ────────────── */
#mobilePrioritiesBtn {
  position: fixed;
  bottom: 24px;
  right: 20px;
  z-index: 1500;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  white-space: nowrap;
}
#mobilePrioritiesBtn:hover { background: var(--primary-dark); }

/* ── MOBILE PRIORITIES OVERLAY ───────────────────────────── */
#mobilePrioritiesOverlay {
  display: none;
  position: fixed;
  top: 200px;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2000;
  background: #fff;
  overflow-y: auto;
  padding: 20px 20px 80px;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}
#mobilePrioritiesOverlay.open {
  display: block;
}

#mobilePrioritiesBackdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1999;
}
#mobilePrioritiesBackdrop.open { display: block; }

#mobileOverlayDoneBar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2001;
  padding: 12px 20px;
  background: #fff;
  border-top: 1px solid #e5e5e5;
}
#mobileOverlayDoneBar.open { display: block; }
#mobileOverlayDoneBar button {
  width: 100%;
  padding: 14px 0;
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  border-radius: 10px;
  cursor: pointer;
}
#mobileOverlayDoneBar button:hover { background: var(--primary-dark); }

.mobile-overlay-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 26px;
  color: #aaa;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.mobile-overlay-close:hover { color: #1a1a1a; }

/* ── SAVE TOAST ──────────────────────────────────────────── */
#saveToast {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: var(--primary);
  color: #fff;
  padding: 14px 24px;
  border-radius: 0 0 10px 10px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 9999;
  box-shadow: none;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
#saveToast.visible { box-shadow: 0 4px 16px rgba(0,0,0,.2); }
#saveToast.visible {
  transform: translateX(-50%) translateY(0);
}

/* ── COMPARE BUTTON ──────────────────────────────────────── */
#compareCollegesBtn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}
#compareCollegesBtn:hover { background: var(--primary-dark); }
