/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", sans-serif;
}

body {
  background: #f4f6fb;
}

/* HEADER */
header {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: white;
  padding: 20px;
  text-align: center;
}

/* MAIN */
.main {
  display: flex;
  gap: 20px;
  padding: 15px;
}

/* FILTER PANEL */
.filters {
  display: block;
  width: 260px;
  background: white;
  padding: 15px;
  border-radius: 12px;
  height: fit-content;
  position: sticky;
  top: 20px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.filters input,
.filters select,
.filters button {
  width: 100%;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #ddd;
  font-size: 14px;
}

.filters button {
  background: #4f46e5;
  color: white;
  border: none;
  cursor: pointer;
}

/* RESULTS */
.results {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 15px;
}

/* CARD */
.card {
  background: white;
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 3px 10px rgba(0,0,0,0.08);
}

.card h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.card p {
  font-size: 13px;
  margin: 2px 0;
}

.percentile {
  margin-top: 8px;
  font-weight: bold;
  color: #4f46e5;
}

.download-btn {
  display: inline-block;
  text-decoration: none;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Hover */
.download-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.2);
  background: linear-gradient(135deg, #16a34a, #15803d);
}

/* Click */
.download-btn:active {
  transform: scale(0.97);
}

/* Mobile full width */
@media (max-width: 768px) {
  .download-btn {
    display: block;
    width: 100%;
    text-align: center;
  }
}

.filter-toggle {
  display: none; /* visible only on mobile */
  width: 10%;
  padding: 14px 16px;
  border-radius: 12px;
  border: none;

  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: white;

  font-size: 15px;
  font-weight: 600;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
  transition: all 0.25s ease;

  cursor: pointer;
}

/* Icon */
.filter-toggle .icon {
  font-size: 16px;
}

/* Hover */
.filter-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
}

/* Click */
.filter-toggle:active {
  transform: scale(0.97);
}

/* Mobile only */
@media (max-width: 600px) {
  .filter-toggle {
    display: flex;
  }
}
/* ========================= */
/* 📱 MOBILE RESPONSIVE */
/* ========================= */

/* ========================= */
/* 📱 TABLET (<=1000px) */
/* ========================= */

@media (max-width: 1000px) {

  .main {
    flex-direction: column;
    padding: 10px;
  }

  /* Filters become top bar (NOT hidden) */
  .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    position: static;
  }

  .filters input,
  .filters select,
  .filters button {
    flex: 1 1 calc(50% - 10px);
  }

  .results {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }
}

/* ========================= */
/* 📱 MOBILE (<=600px) */
/* ========================= */

@media (max-width: 600px) {

  /* Show toggle button */
  .filter-toggle {
    display: block;
  }

  /* Hide filters */
  .filters {
    display: none;
    flex-direction: column;
  }

  /* Active state */
  .filters.active {
    display: flex;
    animation: slideDown 0.3s ease;
  }

  .filters input,
  .filters select,
  .filters button {
    width: 100%;
  }

  .results {
    grid-template-columns: 1fr;
  }
}

/* Animation */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}@media (max-width: 1000px) {

  .main {
    flex-direction: column;
    padding: 10px;
  }

  /* Toggle button visible */
  .filter-toggle {
    display: block;
  }

  /* Filters hidden by default */
  .filters {
    display: none;
    width: 100%;
    position: static;
  }

  /* When active */
  .filters.active {
    display: block;
    animation: slideDown 0.3s ease;
  }

  /* Animation (smooth feel) */
  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .results {
    grid-template-columns: 1fr;
  }
}

/* ========================= */
/* MODAL STYLES */
/* ========================= */

.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: #fff;
  margin: 5% auto;
  padding: 20px;
  border-radius: 12px;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.3s;
}

.close:hover,
.close:focus {
  color: #000;
  text-decoration: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-section {
  margin-bottom: 20px;
}

.modal-section h3 {
  margin-bottom: 10px;
  color: #4f46e5;
}

.modal-section ul {
  list-style-type: disc;
  padding-left: 20px;
}

.table-container {
  overflow-x: auto;
  margin-top: 10px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  border: 1px solid #ddd;
  padding: 8px 12px;
  text-align: left;
}

th {
  background-color: #f4f6fb;
  font-weight: bold;
}

tbody tr:nth-child(even) {
  background-color: #f9f9f9;
}

tbody tr:hover {
  background-color: #e0e7ff;
}

/* ========================= */
/* COURSE PILLS */
/* ========================= */

.course-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.course-pill {
  background: #e0e7ff;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.course-pill:hover {
  background: #c7d2fe;
  transform: translateY(-1px);
}

.course-pill.active {
  background: #4f46e5;
  color: white;
  border-color: #4f46e5;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}

/* ========================= */
/* COURSE STATS */
/* ========================= */

.course-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

.course-stats p {
  margin: 0;
  font-size: 14px;
}

/* ========================= */
/* MOBILE RESPONSIVE FOR MODAL */
/* ========================= */

@media (max-width: 600px) {
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 15px;
    max-height: 90vh;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 6px 8px;
  }

  .course-pills {
    gap: 6px;
  }

  .course-pill {
    padding: 6px 12px;
    font-size: 12px;
  }

  .course-stats {
    flex-direction: column;
    gap: 8px;
  }
}

/* Mobile responsiveness for modal */
@media (max-width: 600px) {
  .modal-content {
    width: 95%;
    margin: 10% auto;
    padding: 15px;
    max-height: 90vh;
  }

  table {
    font-size: 12px;
  }

  th, td {
    padding: 6px 8px;
  }
}

.footer {
  padding: 40px 20px;
  background: #0b0b0b;
  color: #ffffff;
  text-align: center;
  border-top: 1px solid #222;
}

.footer-content p {
  color: #aaa;
  margin-bottom: 8px;
}

