/* Premium Dark Mode Styles for Vstup 2025 */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-color: #0b0f19;
  --surface: rgba(17, 24, 39, 0.6);
  --surface-solid: #111827;
  --surface-hover: rgba(31, 41, 55, 0.8);
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(59, 130, 246, 0.6);
  --text-primary: #f9fafb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --accent-gradient: linear-gradient(135deg, #3b82f6, #8b5cf6);
  
  --chance-green: #10b981;
  --chance-green-bg: rgba(16, 185, 129, 0.1);
  --chance-green-border: rgba(16, 185, 129, 0.25);
  
  --chance-yellow: #f59e0b;
  --chance-yellow-bg: rgba(245, 158, 11, 0.1);
  --chance-yellow-border: rgba(245, 158, 11, 0.25);
  
  --chance-red: #ef4444;
  --chance-red-bg: rgba(239, 68, 68, 0.1);
  --chance-red-border: rgba(239, 68, 68, 0.25);

  --chance-gray: #9ca3af;
  --chance-gray-bg: rgba(156, 163, 175, 0.1);
  --chance-gray-border: rgba(156, 163, 175, 0.25);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 100px;
  
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);
  
  --font-display: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;
}

/* Base Settings */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Background Glowing Shapes */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
}
.bg-glow-1 {
  top: -10%;
  left: 10%;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.2) 0%, transparent 80%);
}
.bg-glow-2 {
  bottom: -10%;
  right: 10%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 80%);
}

/* Application Layout */
.app-container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header styling */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}

.logo-icon {
  background: var(--accent-gradient);
  color: #fff;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 15px var(--accent-glow);
}

.logo-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.05em;
  background: linear-gradient(135deg, #fff, #9ca3af);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.accent-year {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* NMT Status Badge styling */
.nmt-status-badge {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 0.5rem 1.25rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
}

.nmt-status-badge:hover {
  background: var(--surface-hover);
  border-color: var(--border-focus);
  transform: translateY(-1px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--chance-gray);
  box-shadow: 0 0 8px var(--chance-gray);
  transition: all 0.3s ease;
}

.status-dot.active {
  background-color: var(--chance-green);
  box-shadow: 0 0 8px var(--chance-green);
}

.status-dot.not-taken {
  background-color: var(--chance-yellow);
  box-shadow: 0 0 8px var(--chance-yellow);
}

/* SPA Views Management */
.spa-view {
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

.spa-view.active {
  display: block;
  opacity: 1;
}

/* ==========================================================================
   1. HOMEPAGE VIEW
   ========================================================================== */
.hero-section {
  text-align: center;
  padding: 4rem 1.5rem;
  max-width: 800px;
  margin: 0 auto;
}

.hero-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 3rem;
}

/* Advanced Search Box */
.search-box-container {
  position: relative;
  max-width: 650px;
  margin: 0 auto;
  z-index: 10;
}

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

.search-icon {
  position: absolute;
  left: 1.25rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.search-box-container input, .search-box-mini input {
  width: 100%;
  padding: 1.1rem 3.5rem 1.1rem 3.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: 1.05rem;
  font-family: var(--font-body);
  outline: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.search-box-container input:focus, .search-box-mini input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow), var(--shadow-md);
  background: rgba(17, 24, 39, 0.85);
}

.search-clear-btn {
  position: absolute;
  right: 1.25rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: background 0.2s;
}

.search-clear-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.home-search-submit-btn {
  position: absolute;
  right: 6px;
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  padding: 0.65rem 1.25rem;
  border-radius: calc(var(--radius-lg) - 4px);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: all 0.2s ease;
}

.home-search-submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px var(--accent-glow);
}

.home-search-submit-btn:active {
  transform: translateY(0);
}

.search-box-container input {
  padding-right: 8.5rem;
}

.search-box-container .search-clear-btn {
  right: 8rem;
}

/* Suggestions Dropdown Box */
.suggestions-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 0.5rem;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 400px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  text-align: left;
  backdrop-filter: blur(12px);
}

.suggestions-dropdown.active {
  display: block;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.suggestion-group-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.1em;
  padding: 0.75rem 1rem 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: background 0.2s ease;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.suggestion-item:hover, .suggestion-item.selected {
  background: var(--surface-hover);
  color: #fff;
}

.suggestion-item-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.suggestion-item-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-highlight {
  color: #fff;
  font-weight: 600;
}

/* Popular list section */
.popular-section {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* ==========================================================================
   2. SEARCH & RESULTS VIEW
   ========================================================================== */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.back-home-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
  flex-shrink: 0;
}

.back-home-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-focus);
}

.search-box-mini {
  flex: 1;
  position: relative;
  max-width: 500px;
}

.search-box-mini input {
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
}

.filter-toggle-btn {
  display: none; /* Mobile only */
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  cursor: pointer;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s;
}

.filter-toggle-btn:hover {
  background: var(--surface-hover);
}

.results-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 2rem;
  align-items: start;
}

/* Sidebar Filters */
.filters-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: sticky;
  top: 1.5rem;
  backdrop-filter: blur(12px);
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
}

.close-sidebar-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.75rem;
  cursor: pointer;
}

.filter-group {
  margin-bottom: 1.25rem;
}

.filter-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.filter-group select, .filter-group input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s;
}

.filter-group select:focus, .filter-group input:focus {
  border-color: var(--accent);
}

.range-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

/* Chance filters styled buttons */
.chance-filter-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.4rem;
}

.chance-btn {
  padding: 0.5rem;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.chance-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.chance-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.chance-btn-green.active {
  background: var(--chance-green);
  border-color: var(--chance-green);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.chance-btn-yellow.active {
  background: var(--chance-yellow);
  border-color: var(--chance-yellow);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.chance-btn-red.active {
  background: var(--chance-red);
  border-color: var(--chance-red);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* Quota Toggle Styling */
.checkbox-group {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.toggle-switch-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--border);
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(20px);
}

.toggle-description {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.reset-filters-btn {
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.75rem;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.reset-filters-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fff;
}

/* Results Content */
.results-content {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.results-stats {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* Direction Result Card */
.result-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.result-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: var(--shadow-lg);
}

.card-spec-code {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.result-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  color: #fff;
  padding-right: 5.5rem; /* Space for absolute badge */
}

.result-card .univ-name {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.result-card .univ-name svg {
  color: var(--accent);
  flex-shrink: 0;
}

.result-card .program-details {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 1.25rem;
  padding-left: 0.25rem;
  border-left: 2px solid rgba(255, 255, 255, 0.05);
}

.result-card .stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 1rem;
}

.stat-box {
  background: rgba(0, 0, 0, 0.25);
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.result-card .view-applicants-btn {
  width: 100%;
  margin-top: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.65rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.result-card .view-applicants-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Chance indicators badges absolute positioning in card */
.chance-badge {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chance-badge::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.chance-high {
  background: var(--chance-green-bg);
  color: var(--chance-green);
  border: 1px solid var(--chance-green-border);
}
.chance-high::before {
  background: var(--chance-green);
  box-shadow: 0 0 6px var(--chance-green);
}

.chance-medium {
  background: var(--chance-yellow-bg);
  color: var(--chance-yellow);
  border: 1px solid var(--chance-yellow-border);
}
.chance-medium::before {
  background: var(--chance-yellow);
  box-shadow: 0 0 6px var(--chance-yellow);
}

.chance-low {
  background: var(--chance-red-bg);
  color: var(--chance-red);
  border: 1px solid var(--chance-red-border);
}
.chance-low::before {
  background: var(--chance-red);
  box-shadow: 0 0 6px var(--chance-red);
}

.chance-neutral {
  background: var(--chance-gray-bg);
  color: var(--chance-gray);
  border: 1px solid var(--chance-gray-border);
}
.chance-neutral::before {
  background: var(--chance-gray);
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pagination-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-focus);
}

.pagination-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.3);
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ==========================================================================
   3. MODAL DESIGN (NMT Modal + Detail Modal Overlay)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 15, 30, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 1.5rem;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 500px;
  /* Mobile: allow scrolling inside the modal so Save button is always reachable */
  max-height: calc(100vh - 3rem);
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  box-shadow: var(--shadow-lg);
  transform: translateY(30px);
  transition: transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.2);
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

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

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1.75rem;
  cursor: pointer;
  line-height: 1;
}

.modal-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 1.5rem;
}

/* NMT Form Layout */
.scores-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.span-2 {
  grid-column: span 2;
}

.form-group {
  margin-bottom: 0.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 0.95rem;
  font-family: var(--font-body);
  outline: none;
  transition: all 0.3s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.form-group select option {
  background: var(--bg-color);
  color: #fff;
}

.modal-options {
  margin-bottom: 1.75rem;
}

.not-taken-btn {
  width: 100%;
  padding: 0.75rem;
  background: rgba(245, 158, 11, 0.1);
  border: 1px dashed var(--chance-yellow-border);
  color: var(--chance-yellow);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
}

.not-taken-btn:hover {
  background: rgba(245, 158, 11, 0.2);
}

.modal-actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

#saveScoresBtn {
  width: 100%;
  min-height: 50px;
  font-size: 1.05rem;
  font-weight: 700;
  background: var(--accent-gradient);
  box-shadow: 0 4px 15px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#saveScoresBtn:active {
  transform: scale(0.98);
}

#resetScoresBtn {
  width: 100%;
  min-height: 42px;
  font-size: 0.95rem;
  font-weight: 500;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

#resetScoresBtn:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--chance-red);
  border-color: rgba(239, 68, 68, 0.2);
}

.btn {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

/* ==========================================================================
   4. SPECIALTY DETAIL OVERLAY
   ========================================================================== */
.detail-modal-overlay {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}

.detail-modal-content {
  max-width: 900px;
  /* Use dvh so the iOS Safari dynamic toolbar is accounted for */
  height: 100vh;
  height: 100dvh;
  border-radius: 0;
  border-left: 1px solid var(--border);
  border-top: none;
  border-right: none;
  border-bottom: none;
  margin: 0;
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  padding: 2rem;
  /* Bottom safe area so the applicants table is not hidden behind iOS home bar */
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-modal-overlay.active .detail-modal-content {
  transform: translateX(0);
}

.detail-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.detail-back-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.detail-back-btn:hover {
  color: #fff;
}

.detail-back-btn svg {
  transition: transform 0.2s;
}

.detail-back-btn:hover svg {
  transform: translateX(-4px);
}

.detail-badges .chance-badge {
  position: static;
  font-size: 0.85rem;
}

.detail-main-content {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  flex: 1;
}

.detail-title-block {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 1.5rem;
}

.detail-spec-code {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: inline-block;
  margin-bottom: 0.5rem;
}

.detail-spec-name {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.75rem;
  color: #fff;
}

.detail-univ-name {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.detail-program {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.detail-faculty {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Detail cards grid */
.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.detail-info-card {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-info-card .card-label {
  font-size: 0.7rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.detail-info-card .card-value {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
}

.detail-info-card .card-value.highlight {
  color: var(--accent);
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.detail-info-card .card-sub-value {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.25rem;
}

.detail-info-card .card-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.color-green { color: var(--chance-green); }
.color-blue { color: var(--accent); }

/* Applicants list design */
.applicants-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
  flex: 1;
}

.applicants-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.applicants-header-row h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.applicants-search {
  width: 300px;
}

.applicants-search input {
  width: 100%;
  padding: 0.5rem 1rem;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.85rem;
  outline: none;
  transition: all 0.2s;
}

.applicants-search input:focus {
  border-color: var(--accent);
}

/* Applicants list table */
.table-container {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.15);
  max-height: 450px;
  overflow-y: auto;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.applicants-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.85rem;
}

.applicants-table th, .applicants-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.applicants-table th {
  background: rgba(17, 24, 39, 0.9);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.applicants-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Specific column configurations for responsiveness and alignment */
.applicants-table th:nth-child(1),
.applicants-table td:nth-child(1) {
  width: 8%;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-muted);
}

.applicants-table th:nth-child(2),
.applicants-table td:nth-child(2) {
  width: 38%;
  min-width: 160px;
  font-weight: 500;
  color: #fff;
  white-space: normal;
  word-break: break-word;
}

.applicants-table th:nth-child(3),
.applicants-table td:nth-child(3) {
  width: 10%;
  text-align: center;
  white-space: nowrap;
}

.applicants-table th:nth-child(4),
.applicants-table td:nth-child(4) {
  width: 14%;
  white-space: nowrap;
}

.applicants-table th:nth-child(5),
.applicants-table td:nth-child(5) {
  width: 12%;
  white-space: nowrap;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--accent);
}

.applicants-table th:nth-child(6),
.applicants-table td:nth-child(6) {
  width: 18%;
  min-width: 160px;
  white-space: normal;
  word-break: break-word;
}

.status-badge {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-badge-budget {
  background: rgba(16, 185, 129, 0.15);
  color: var(--chance-green);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.status-badge-contract {
  background: rgba(59, 130, 246, 0.15);
  color: var(--accent);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.status-badge-other {
  background: rgba(156, 163, 175, 0.1);
  color: var(--text-secondary);
}

.quota-tag {
  background: rgba(245, 158, 11, 0.15);
  color: var(--chance-yellow);
  border: 1px solid rgba(245, 158, 11, 0.25);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-left: 0.5rem;
  display: inline-block;
}

/* Loading indicators */
.loading {
  text-align: center;
  padding: 3rem;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.loading::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   5. RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
  .results-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  
  .filters-sidebar {
    display: none; /* Hide on tablets and mobile, toggled with JS */
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 500;
    /* Use dvh so the drawer respects the iOS dynamic toolbar */
    max-height: 80vh;
    max-height: 80dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: 0 -10px 45px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
    /* Account for iOS home bar so Reset button is never hidden */
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .filters-sidebar.active {
    display: block;
  }

  .close-sidebar-btn {
    display: block;
  }

  .filter-toggle-btn {
    display: flex;
  }

  .detail-info-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Sticky Results Header on Tablet & Mobile */
  .results-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-color);
    margin-top: -1.5rem;
    margin-left: -1.5rem;
    margin-right: -1.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
  }

  /* Touch Target Optimizations (44px min height) */
  .back-home-btn, .filter-toggle-btn {
    min-height: 44px;
    padding: 0.65rem 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .search-box-mini input {
    min-height: 44px;
  }

  .form-group input, .form-group select {
    min-height: 44px;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.25rem;
  }

  .hero-subtitle {
    font-size: 1rem;
    margin-bottom: 2rem;
  }

  .results-header {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  .search-box-mini {
    order: 3;
    min-width: 100%;
    margin-top: 0.25rem;
  }

  /* Specialty Detail Drawer full width on mobile */
  .detail-modal-content {
    width: 100%;
    max-width: 100%;
    padding: 1.25rem;
  }

  .detail-modal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .modal-content {
    padding: 1.5rem;
  }

  .applicants-table {
    min-width: 480px;
    font-size: 0.78rem;
  }

  .applicants-table th, .applicants-table td {
    padding: 0.5rem 0.45rem;
  }

  .table-container {
    max-height: 600px;
  }

  .detail-spec-name {
    font-size: 1.5rem;
  }

  .applicants-header-row {
    flex-direction: column;
    align-items: stretch;
  }

  .applicants-search {
    width: 100%;
  }

  .scores-form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .span-2 {
    grid-column: auto;
  }

  .detail-back-btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
    display: inline-flex;
    align-items: center;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 1.85rem;
  }
  
  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .logo-text {
    font-size: 1.25rem;
  }

  .nmt-status-badge {
    min-height: 40px;
    padding: 0.4rem 0.85rem;
    font-size: 0.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .results-grid {
    grid-template-columns: 1fr;
  }

  .popular-grid {
    grid-template-columns: 1fr;
  }

  .home-search-submit-btn span {
    display: none;
  }

  .search-box-container input {
    padding-right: 3.5rem;
  }

  .search-box-container .search-clear-btn {
    right: 3.25rem;
  }
}

/* Wiki and Career Prospects details block */
.prospects-container {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: rgba(59, 130, 246, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(10px);
}

.wiki-card {
  display: flex;
  gap: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.25rem;
  border-radius: var(--radius-md);
}

.wiki-logo-wrapper {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.wiki-logo {
  width: 90%;
  height: 90%;
  object-fit: contain;
}

.wiki-text {
  display: flex;
  flex-direction: column;
}

.prospects-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.05em;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.wiki-excerpt {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.career-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.25rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.career-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  margin: 0.35rem 0;
}

.career-field-label {
  color: var(--text-secondary);
}

.career-field-value {
  font-weight: 600;
  white-space: nowrap;
}

.career-progress-bg {
  background: rgba(255, 255, 255, 0.05);
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.career-progress-bar {
  background: var(--chance-green);
  height: 100%;
  border-radius: 3px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.career-tags-section {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.5rem;
  margin-top: 0.25rem;
}

.career-tags-title {
  color: var(--text-secondary);
  font-size: 0.75rem;
  display: block;
  margin-bottom: 0.35rem;
}

.career-tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.career-tag {
  color: var(--text-primary);
  font-size: 0.7rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.color-yellow {
  color: #f59e0b;
}

.color-green {
  color: #10b981;
}

@media (max-width: 768px) {
  .prospects-container {
    grid-template-columns: 1fr;
  }
}
