:root {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --primary: #2563eb;
  --primary-glow: rgba(37, 99, 235, 0.08);
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --accent: #0284c7;
  --accent-glow: rgba(2, 132, 199, 0.08);
  --scientific: #0369a1;
  --scientific-bg: #e0f2fe;
  --scientific-border: #bae6fd;
  --literary: #6b21a8;
  --literary-bg: #f3e8ff;
  --literary-border: #e9d5ff;
  --shared: #065f46;
  --shared-bg: #d1fae5;
  --shared-border: #a7f3d0;
  --success: #15803d;
  --success-bg: #dcfce7;
  --success-border: #bbf7d0;
  --danger: #b91c1c;
  --danger-bg: #fee2e2;
  --danger-border: #fecaca;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-focus: #3b82f6;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 24px rgba(0,0,0,0.08);
  --shadow-glow: 0 4px 14px rgba(37,99,235,0.2);
  --transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; height: 100%; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  direction: rtl;
  text-align: right;
  min-height: 100%;
  overflow-x: hidden;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 300px;
  background: linear-gradient(135deg, #dbeafe 0%, #d1fae5 50%, #ede9fe 100%);
  z-index: -1;
}

.container { width: 100%; max-width: 1350px; margin: 0 auto; padding: 1rem; }
@media (min-width: 768px) { .container { padding: 1.5rem; } }

/* Header */
header { padding: 2rem 0 1rem; text-align: center; }
.brand-wrapper { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }

.logo-container {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-glow);
  color: white; font-size: 1.6rem; font-weight: 800;
  border: 2px solid rgba(255,255,255,0.3);
}

.brand-title {
  font-size: 1.75rem; font-weight: 800; color: #1e3a8a;
}

.brand-subtitle {
  font-size: 0.85rem; color: var(--text-secondary);
  max-width: 550px; line-height: 1.5;
}

/* Stats Banner */
.stats-banner {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem; margin: 0.75rem 0 1.25rem; text-align: center;
}

.stat-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  padding: 0.6rem 0.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.stat-item:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.stat-item--accent { border-color: var(--scientific-border); background: linear-gradient(135deg, #f0f9ff, #ecfdf5); }

.stat-value { font-size: 1.3rem; font-weight: 800; color: var(--primary); line-height: 1.1; }
.stat-item--accent .stat-value { color: var(--success); }
.stat-label { font-size: 0.7rem; color: var(--text-secondary); margin-top: 0.15rem; }

/* Dashboard Grid */
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin-top: 0.5rem; }
@media (min-width: 992px) { .dashboard-grid { grid-template-columns: 280px 1fr; } }
@media (min-width: 1200px) { .dashboard-grid { grid-template-columns: 270px 1fr 290px; align-items: start; } }

/* Panels */
.panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.panel-title {
  font-size: 1.05rem; font-weight: 700; color: #1e3a8a;
  margin-bottom: 1rem;
  display: flex; align-items: center; gap: 0.5rem;
  border-bottom: 1px solid var(--border); padding-bottom: 0.5rem;
}

.panel-title i { color: var(--primary); font-size: 0.95rem; }

/* Forms */
.matcher-form { display: flex; flex-direction: column; gap: 1.15rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-label {
  font-size: 0.85rem; font-weight: 700; color: var(--text-primary);
  display: flex; justify-content: space-between; align-items: center;
}

.form-label span.badge-val {
  background: var(--primary-light); color: var(--primary);
  padding: 0.1rem 0.4rem; border-radius: 20px;
  font-size: 0.8rem; font-weight: 800;
}

.input-control {
  background: #f8fafc; border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  font-family: inherit; color: var(--text-primary);
  font-size: 0.9rem; transition: var(--transition);
  width: 100%; outline: none;
}

.input-control:focus {
  background: #fff; border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* Range Slider */
.range-slider-container { display: flex; align-items: center; gap: 0.75rem; }

.slider-input {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 3px; background: #e2e8f0; outline: none;
}

.slider-input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--primary); cursor: pointer;
  box-shadow: 0 2px 8px rgba(37,99,235,0.3);
  border: 3px solid white; transition: var(--transition);
}

.slider-input::-webkit-slider-thumb:hover { transform: scale(1.15); }

/* Track Selector */
.track-selector {
  display: grid; grid-template-columns: repeat(2, 1fr);
  background: #f1f5f9; border-radius: var(--radius-md);
  padding: 0.2rem; border: 1.5px solid #cbd5e1;
}

.track-option { position: relative; }
.track-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }

.track-label {
  display: flex; align-items: center; justify-content: center; gap: 0.3rem;
  text-align: center; padding: 0.55rem;
  font-size: 0.85rem; font-weight: 700;
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-secondary); transition: var(--transition);
}

.track-label i { font-size: 0.8rem; }

.track-option input[type="radio"]:checked + .track-label {
  background: white; color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.track-option input[type="radio"]:checked + .track-label.lit-label { color: var(--literary); }

/* Toggle Switch */
.toggle-switch {
  display: flex; align-items: center; gap: 0.6rem;
  cursor: pointer; user-select: none;
}

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

.toggle-slider {
  position: relative; width: 40px; height: 22px;
  background: #cbd5e1; border-radius: 11px;
  transition: var(--transition); flex-shrink: 0;
}

.toggle-slider::before {
  content: ''; position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  background: white; border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { right: 20px; }
.toggle-text { font-size: 0.8rem; color: var(--text-secondary); }

/* Search bar */
.search-controls { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.75rem; }
.search-bar-wrapper { position: relative; width: 100%; }

.search-input {
  padding-left: 2.5rem; padding-right: 1rem;
  font-size: 0.95rem; background: #fff;
  border: 1.5px solid #cbd5e1;
}

.search-icon {
  position: absolute; left: 0.9rem; top: 50%;
  transform: translateY(-50%); color: var(--text-muted);
  pointer-events: none; font-size: 1rem;
}

.search-clear-btn {
  position: absolute; left: 2.5rem; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 0.85rem; padding: 0.25rem;
  border-radius: 50%; transition: var(--transition);
}

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

.filters-row { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
@media (min-width: 600px) { .filters-row { grid-template-columns: 1fr 1fr; } }
@media (min-width: 900px) { .filters-row { grid-template-columns: 1.5fr 1.5fr 1fr; } }

/* ====================== */
/* CUSTOM DROPDOWN SYSTEM */
/* ====================== */
.custom-dropdown { position: relative; width: 100%; }

.dropdown-trigger {
  width: 100%; display: flex; align-items: center; gap: 0.4rem;
  background: #f8fafc; border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm); padding: 0.65rem 0.8rem;
  font-family: inherit; color: var(--text-primary);
  font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: var(--transition);
  text-align: right; outline: none;
}

.dropdown-trigger:hover { border-color: var(--primary); }
.dropdown-trigger:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.dropdown-trigger-icon { color: var(--primary); font-size: 0.85rem; }
.dropdown-trigger-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dropdown-arrow { color: var(--text-muted); font-size: 0.65rem; transition: var(--transition); }
.custom-dropdown.open .dropdown-arrow { transform: rotate(180deg); }

/* Desktop Panel */
.dropdown-panel {
  display: none; position: absolute;
  top: calc(100% + 6px); right: 0; left: 0;
  background: white; border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); z-index: 300;
  max-height: 380px; overflow: hidden;
  flex-direction: column;
}

.custom-dropdown.open .dropdown-panel { display: flex; }

.dropdown-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
}

.dropdown-panel-header h3 { font-size: 0.9rem; font-weight: 700; color: var(--text-primary); }

.dropdown-close-btn {
  background: none; border: none;
  color: var(--text-muted); cursor: pointer;
  font-size: 1rem; padding: 0.2rem;
  border-radius: 50%; transition: var(--transition);
}

.dropdown-close-btn:hover { color: var(--text-primary); background: #f1f5f9; }

.dropdown-search-wrapper { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); }

.dropdown-search {
  width: 100%; border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.7rem; font-family: inherit;
  font-size: 0.85rem; outline: none;
  transition: var(--transition);
}

.dropdown-search:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }

.dropdown-options {
  overflow-y: auto; max-height: 260px;
  padding: 0.3rem;
}

.dropdown-option {
  display: flex; align-items: center; gap: 0.5rem;
  width: 100%; text-align: right;
  padding: 0.6rem 0.75rem;
  font-family: inherit; font-size: 0.85rem;
  font-weight: 500; color: var(--text-primary);
  border: none; background: none;
  cursor: pointer; border-radius: var(--radius-sm);
  transition: var(--transition);
}

.dropdown-option:hover { background: #f1f5f9; }
.dropdown-option.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.dropdown-option i { color: var(--text-muted); font-size: 0.8rem; width: 1.2rem; text-align: center; }
.dropdown-option.active i { color: var(--primary); }
.dropdown-option.hidden { display: none; }

.dropdown-panel--compact { max-height: 300px; }

/* Overlay for dropdowns */
.dropdown-overlay {
  position: fixed; top: 0; bottom: 0; left: 0; right: 0;
  background: rgba(15,23,42,0.45);
  z-index: 250; display: none;
}

.dropdown-overlay.open { display: block; }

/* Mobile Bottom Sheet for Dropdowns */
@media (max-width: 767px) {
  .dropdown-panel {
    position: fixed !important;
    top: auto !important; bottom: 0; right: 0; left: 0;
    max-height: 75vh; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    border-bottom: none;
    z-index: 350;
    animation: slideUp 0.3s ease;
  }
  
  .dropdown-panel-header {
    padding: 1rem 1.25rem;
    position: relative;
  }
  
  .dropdown-panel-header::before {
    content: '';
    position: absolute;
    top: 0.5rem; left: 50%;
    transform: translateX(-50%);
    width: 36px; height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
  }
  
  .dropdown-panel-header h3 { font-size: 1rem; }
  
  .dropdown-search-wrapper { padding: 0.5rem 1rem; }
  
  .dropdown-options {
    max-height: calc(75vh - 130px);
    padding: 0.5rem;
  }
  
  .dropdown-option {
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    border-bottom: 1px solid #f1f5f9;
  }

  .dropdown-option:last-child { border-bottom: none; }
}

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

/* Active Filter Tags */
.active-filters {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}

.active-filter-tag {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: var(--primary-light); color: var(--primary);
  font-size: 0.75rem; font-weight: 700;
  padding: 0.25rem 0.5rem;
  border-radius: 20px;
  animation: fadeIn 0.2s ease;
}

.active-filter-tag button {
  background: none; border: none;
  color: var(--primary); cursor: pointer;
  font-size: 0.7rem; padding: 0.1rem;
  border-radius: 50%; transition: var(--transition);
}

.active-filter-tag button:hover { color: var(--danger); }

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

.results-count { font-size: 0.85rem; color: var(--text-secondary); }
.results-count span { color: var(--primary); font-weight: 800; font-size: 1.1rem; }

/* Cards Grid */
.cards-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 500px) { .cards-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); } }

/* College Card */
.college-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex; flex-direction: column;
  gap: 0.6rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  position: relative;
}

.college-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #94a3b8;
}

.college-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0;
  height: 3px; border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.college-card.card-scientific::before { background: var(--scientific); }
.college-card.card-literary::before { background: var(--literary); }
.college-card.card-shared::before { background: var(--shared); }

.card-univ {
  font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.3rem;
}

.card-univ i { color: var(--primary); font-size: 0.8rem; }

.univ-link {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}

.univ-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

.card-location {
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-secondary);
  display: flex; align-items: center; gap: 0.3rem;
  margin-top: 0.15rem;
}

.card-location i { color: var(--accent); font-size: 0.75rem; }


.card-faculty {
  font-size: 0.95rem; font-weight: 800;
  color: var(--text-primary); line-height: 1.35;
}

.card-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.4rem; background: #f8fafc;
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
}

.card-stat { display: flex; flex-direction: column; }
.card-stat-label { font-size: 0.65rem; color: var(--text-muted); }
.card-stat-value { font-size: 1.1rem; font-weight: 800; color: var(--text-primary); }
.card-stat-value.percent-value { color: var(--primary); }

.college-card.eligible {
  border-color: var(--success-border);
  background: linear-gradient(to bottom, #fff, #f0fdf4);
}

.college-card.eligible .card-stat-value.percent-value { color: var(--success); }
.college-card.ineligible { opacity: 0.8; }

.card-footer { display: flex; flex-direction: column; gap: 0.5rem; margin-top: auto; }

.footer-top {
  display: flex; justify-content: space-between; align-items: center;
}

.track-badge {
  font-size: 0.7rem; font-weight: 700;
  padding: 0.12rem 0.4rem; border-radius: 5px;
}

.track-badge.track-scientific { background: var(--scientific-bg); color: var(--scientific); }
.track-badge.track-literary { background: var(--literary-bg); color: var(--literary); }
.track-badge.track-shared { background: var(--shared-bg); color: var(--shared); }

.eligibility-badge {
  font-size: 0.65rem; font-weight: 700;
  display: flex; align-items: center; gap: 0.2rem;
  padding: 0.12rem 0.4rem; border-radius: 5px;
}

.eligibility-badge.badge-eligible { color: var(--success); background: var(--success-bg); }
.eligibility-badge.badge-ineligible { color: var(--danger); background: var(--danger-bg); }

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

.keyword-tag {
  background: #f1f5f9; color: var(--text-secondary);
  font-size: 0.65rem; padding: 0.1rem 0.35rem;
  border-radius: 4px; cursor: pointer;
  transition: var(--transition); border: 1px solid transparent;
}

.keyword-tag:hover { background: var(--primary-glow); color: var(--primary); border-color: rgba(37,99,235,0.1); }

/* Add to Wishlist Button */
.btn-add-wishlist {
  width: 100%; padding: 0.45rem;
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  gap: 0.35rem; outline: none;
}

.btn-add-wishlist.not-added { background: #f8fafc; border: 1.5px solid #cbd5e1; color: var(--text-secondary); }
.btn-add-wishlist.not-added:hover { background: var(--primary-glow); color: var(--primary); border-color: var(--primary); }
.btn-add-wishlist.added { background: var(--success-bg); border: 1.5px solid var(--success-border); color: var(--success); }
.btn-add-wishlist.added:hover { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger); }

/* Reset Filters Button */
.btn-reset-filters {
  background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm);
  padding: 0.6rem 1.2rem; font-family: inherit;
  font-size: 0.85rem; font-weight: 700;
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 0.3rem;
}

.btn-reset-filters:hover { background: var(--primary-hover); }

/* Load More */
.load-more-container {
  display: flex; flex-direction: column;
  align-items: center; gap: 0.5rem;
  padding: 1.5rem 0; grid-column: 1 / -1;
}

.btn-load-more {
  background: white; border: 1.5px solid var(--border);
  color: var(--primary); font-family: inherit;
  font-size: 0.9rem; font-weight: 700;
  padding: 0.65rem 2rem; border-radius: var(--radius-md);
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; gap: 0.4rem;
  box-shadow: var(--shadow-sm);
}

.btn-load-more:hover {
  background: var(--primary); color: white;
  border-color: var(--primary); box-shadow: var(--shadow-glow);
}

.load-more-info {
  font-size: 0.75rem; color: var(--text-muted);
}

/* Wishlist sidebar */
.wishlist-sidebar { display: flex; flex-direction: column; gap: 0.75rem; }

.wishlist-count-badge {
  background: var(--primary); color: white;
  font-size: 0.75rem; padding: 0.1rem 0.35rem;
  border-radius: 10px; margin-inline-start: auto;
}

.wishlist-items {
  display: flex; flex-direction: column;
  gap: 0.5rem; max-height: 400px;
  overflow-y: auto; padding: 0.1rem;
}

.wishlist-item {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem;
  display: flex; align-items: center;
  gap: 0.4rem; box-shadow: var(--shadow-sm);
  animation: fadeIn 0.2s ease;
}

.wishlist-rank {
  background: #f1f5f9; color: var(--text-secondary);
  font-size: 0.8rem; font-weight: 800;
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; border: 1px solid var(--border);
}

.wishlist-item.ineligible-choice .wishlist-rank { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }

.wishlist-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.wishlist-faculty {
  font-size: 0.8rem; font-weight: 700; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.wishlist-univ {
  font-size: 0.7rem; color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.wishlist-percent { font-size: 0.7rem; font-weight: 700; color: var(--text-muted); }

.wishlist-reorder { display: flex; flex-direction: column; gap: 0.1rem; }

.btn-reorder {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px; font-size: 0.7rem;
  border-radius: 3px; transition: var(--transition);
}

.btn-reorder:hover { color: var(--primary); background: #f1f5f9; }
.btn-reorder:disabled { color: #e2e8f0; cursor: not-allowed; }

.btn-delete-item {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 0.2rem; font-size: 0.8rem;
  border-radius: 4px; transition: var(--transition);
}

.btn-delete-item:hover { color: var(--danger); background: var(--danger-bg); }

.wishlist-actions {
  display: grid; grid-template-columns: 1.5fr 1fr;
  gap: 0.4rem; margin-top: 0.4rem;
  border-top: 1px solid var(--border); padding-top: 0.6rem;
}

.btn-action {
  font-family: inherit; font-size: 0.8rem; font-weight: 700;
  padding: 0.5rem; border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
  gap: 0.25rem; outline: none;
}

.btn-print { background: var(--primary); color: white; border: 1px solid var(--primary); }
.btn-print:hover { background: var(--primary-hover); }
.btn-clear { background: #fff; border: 1px solid #cbd5e1; color: var(--text-secondary); }
.btn-clear:hover { background: #f1f5f9; color: var(--danger); border-color: var(--danger-border); }

.wishlist-empty {
  text-align: center; padding: 1.5rem 1rem;
  color: var(--text-secondary); font-size: 0.8rem;
  border: 1.5px dashed var(--border); border-radius: var(--radius-md);
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
}

.wishlist-empty i { font-size: 1.5rem; color: var(--text-muted); }

/* Mobile wishlist toggle */
.wishlist-mobile-toggle {
  position: fixed; bottom: 1.5rem; left: 1.5rem;
  background: var(--primary); color: white;
  width: 52px; height: 52px; border-radius: 50%;
  box-shadow: 0 4px 15px rgba(37,99,235,0.35);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 100;
  transition: var(--transition); border: 2px solid white;
}

.wishlist-mobile-toggle:hover { transform: scale(1.05); }

.wishlist-mobile-toggle .badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--danger); color: white;
  font-size: 0.7rem; font-weight: 800;
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}

@media (min-width: 1200px) { .wishlist-mobile-toggle { display: none; } }

/* Scroll to Top Button */
.scroll-top-btn {
  position: fixed; bottom: 5rem; left: 1.5rem;
  background: white; color: var(--text-secondary);
  width: 40px; height: 40px; border-radius: 50%;
  box-shadow: var(--shadow-md);
  display: none; align-items: center; justify-content: center;
  cursor: pointer; z-index: 90;
  transition: var(--transition); border: 1.5px solid var(--border);
  font-size: 0.85rem;
}

.scroll-top-btn.visible { display: flex; }
.scroll-top-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }

@media (min-width: 1200px) { .scroll-top-btn { bottom: 2rem; } }

/* Mobile Drawer */
@media (max-width: 1199px) {
  .wishlist-sidebar-container {
    position: fixed; top: 0; bottom: 0; left: 0; right: 0;
    width: 100%; max-width: 100%;
    background: white; z-index: 200;
    box-shadow: none;
    padding: 1.25rem; transform: translateX(-100%);
    transition: transform 0.3s ease; overflow-y: auto;
  }
  
  .wishlist-sidebar-container.open { transform: translateX(0); }
  
  .wishlist-overlay {
    position: fixed; top: 0; bottom: 0; left: 0; right: 0;
    background: rgba(15,23,42,0.5);
    z-index: 150; display: none;
  }
  
  .wishlist-overlay.open { display: block; }
  
  .btn-close-wishlist {
    display: flex; align-items: center;
    background: none; border: none;
    font-size: 1rem; font-family: inherit;
    color: var(--text-muted); cursor: pointer;
    margin-bottom: 0.75rem;
  }
  
  .btn-close-wishlist:hover { color: var(--text-primary); }

  .wishlist-items {
    max-height: calc(100vh - 220px);
  }
}

@media (min-width: 1200px) { .btn-close-wishlist { display: none; } }

/* Empty State */
.empty-state {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 3rem 1.5rem; background: var(--bg-secondary);
  border: 1.5px dashed var(--border); border-radius: var(--radius-lg);
  text-align: center; gap: 0.75rem; grid-column: 1 / -1;
}

.empty-state-icon {
  width: 56px; height: 56px; background: #f1f5f9;
  border-radius: 50%; display: flex;
  align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--text-muted);
}

.empty-state-title { font-size: 1.1rem; font-weight: 700; }

.empty-state-desc { font-size: 0.85rem; color: var(--text-secondary); }

/* Footer */
footer {
  margin-top: 3rem; padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center; color: var(--text-muted);
  font-size: 0.75rem; display: flex;
  flex-direction: column; gap: 0.3rem;
}

/* Print */
@media print {
  body { background: white; color: black; font-size: 12pt; }
  body::before, .stats-banner, aside#smartMatcherPanel, .search-controls, .results-header, .cards-grid, footer, .wishlist-mobile-toggle, .wishlist-actions, .btn-reorder, .btn-delete-item, .btn-close-wishlist, .scroll-top-btn, .dropdown-overlay { display: none !important; }
  .container { width: 100%; max-width: 100%; margin: 0; padding: 0; }
  .wishlist-sidebar-container { position: static; transform: none; box-shadow: none; width: 100%; padding: 0; display: block !important; }
  .panel-title { font-size: 18pt; border-bottom: 2px solid black; padding-bottom: 5px; margin-bottom: 20px; }
  .wishlist-items { max-height: none; overflow: visible; }
  .wishlist-item { border: 1px solid #ccc; page-break-inside: avoid; margin-bottom: 10px; padding: 10px; }
  .wishlist-rank { border: 1px solid black; background: #eee !important; color: black !important; }
}

/* Keyframes */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

