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

:root {
  /* Dark Mode Palette (Default) */
  --bg-color: #0b0f19;
  --bg-gradient: linear-gradient(135deg, #0b0f19 0%, #151b2d 100%);
  --panel-bg: rgba(22, 30, 49, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: rgba(0, 0, 0, 0.3);

  --primary-color: #6366f1;
  /* Indigo */
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --accent-color: #14b8a6;
  /* Teal */

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --card-hover-border: rgba(99, 102, 241, 0.4);
  --card-hover-shadow: rgba(99, 102, 241, 0.15);

  --badge-bg: rgba(99, 102, 241, 0.15);
  --badge-text: #a5b4fc;

  --transition-speed: 0.3s;
}

[data-theme="light"] {
  /* Light Mode Palette */
  --bg-color: #f1f5f9;
  --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  --panel-bg: rgba(255, 255, 255, 0.8);
  --panel-border: rgba(0, 0, 0, 0.08);
  --panel-shadow: rgba(148, 163, 184, 0.15);

  --primary-color: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --accent-color: #0d9488;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --card-hover-border: rgba(79, 70, 229, 0.4);
  --card-hover-shadow: rgba(79, 70, 229, 0.1);

  --badge-bg: rgba(79, 70, 229, 0.08);
  --badge-text: #4f46e5;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
  transition: background var(--transition-speed), color var(--transition-speed);
}

h1,
h2,
h3,
h4 {
  font-family: 'Outfit', sans-serif;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Header Container */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--panel-border);
  box-shadow: 0 4px 30px var(--panel-shadow);
  transition: background var(--transition-speed), border var(--transition-speed);
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  width: 42px;
  height: 42px;
  background: var(--primary-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.4rem;
  font-family: 'Outfit', sans-serif;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.logo-text h1 {
  font-size: 1.4rem;
  font-weight: 700;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.logo-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}

.theme-toggle-btn {
  background: var(--panel-border);
  border: 1px solid var(--panel-border);
  padding: 10px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.theme-toggle-btn:hover {
  transform: scale(1.1);
  background: var(--primary-color);
  color: white;
}

/* Hero Section */
.hero {
  max-width: 1200px;
  margin: 3rem auto 2rem auto;
  padding: 0 2rem;
  text-align: center;
  animation: fadeInUp 0.8s ease-out;
}

.hero h2 {
  font-size: 2.8rem;
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.hero h2 span {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto 2.5rem auto;
}

/* Statistics Bar */
.stats-bar {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 3rem;
  flex-wrap: wrap;
}

.stat-item {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 1rem 2rem;
  border-radius: 15px;
  box-shadow: 0 4px 20px var(--panel-shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 160px;
  transition: all 0.3s ease;
}

.stat-item:hover {
  transform: translateY(-5px);
  border-color: var(--primary-color);
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  font-family: 'Outfit', sans-serif;
  color: var(--primary-color);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Filters & Search Section */
.search-filter-section {
  max-width: 1200px;
  margin: 0 auto 3rem auto;
  padding: 0 2rem;
  animation: fadeInUp 1s ease-out;
}

.sponsor-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #ffffff;
  transition: transform 0.4s ease;
}

.controls-wrapper {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px var(--panel-shadow);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.search-bar-container {
  position: relative;
  width: 100%;
}

.search-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  padding: 1.1rem 1.5rem 1.1rem 3.5rem;
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s ease;
}

.search-input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.search-icon-svg {
  position: absolute;
  left: 1.2rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  width: 20px;
  height: 20px;
}

/* Interactive Tags Filter */
.tags-filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.filter-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-right: 0.5rem;
}

.filter-tag {
  background: var(--panel-border);
  border: 1px solid var(--panel-border);
  padding: 0.5rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-tag:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--text-primary);
}

.filter-tag.active {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* Grid layout for cards */
.grid-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 4rem 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}

.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  color: var(--text-secondary);
}

/* Cards style */
.test-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 320px;
  box-shadow: 0 8px 32px var(--panel-shadow);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: fadeInUp 0.6s ease-out;
}

.test-card:hover {
  transform: translateY(-8px);
  border-color: var(--card-hover-border);
  box-shadow: 0 15px 35px var(--panel-shadow), 0 0 20px var(--card-hover-shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.institution-logo {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  padding: 4px;
  border: 1px solid var(--panel-border);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}

.test-card:hover .institution-logo {
  transform: scale(1.1);
}

.card-body {
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.card-author {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 0.8rem;
}

.card-institution-name {
  font-size: 0.9rem;
  color: var(--accent-color);
  font-weight: 600;
  margin-bottom: 1rem;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.card-tag {
  background: var(--badge-bg);
  color: var(--badge-text);
  padding: 0.3rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
}

.card-footer {
  display: flex;
  gap: 0.8rem;
  margin-top: auto;
}

.btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--primary-gradient);
  color: white;
  border: none;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  opacity: 0.95;
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-secondary);
}

/* Modal Popup Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

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

.modal-content {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  width: 100%;
  max-width: 650px;
  padding: 2.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
  transform: translateY(30px);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  max-height: 90vh;
}

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

.modal-close-btn {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.modal-header-container {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  margin-bottom: 2rem;
}

.modal-logo {
  width: 64px;
  height: 64px;
  min-width: 64px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-title h3 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.modal-detail-group {
  margin-bottom: 1.5rem;
}

.modal-detail-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 0.4rem;
  font-weight: 700;
}

.modal-detail-val {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.modal-detail-val a {
  color: var(--primary-color);
  text-decoration: none;
}

.modal-detail-val a:hover {
  text-decoration: underline;
}

.modal-tags-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.modal-action-bar {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.5rem;
}

/* Sponsors Section Styles */
.sponsors-section {
  max-width: 1200px;
  margin: 0 auto 3rem auto;
  padding: 0 2rem;
  animation: fadeInUp 0.9s ease-out;
}

.sponsors-container {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 2.2rem;
  box-shadow: 0 10px 40px var(--panel-shadow);
}

.section-tag {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--accent-color);
  letter-spacing: 2px;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: inline-block;
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 4px;
}

.sponsors-grid {
  display: grid;
  grid-template-columns: 1fr; /* Stacked one on top of the other */
  gap: 1.5rem;
}

.sponsor-card {
  display: flex;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  overflow: hidden;
  transition: all 0.3s ease;
  min-height: 200px;
}

.sponsor-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary-color);
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.1);
}

.sponsor-img-link {
  width: 35%; /* Wider view for non-cropped display */
  min-height: 200px;
  position: relative;
  overflow: hidden;
  border-right: 1px solid var(--panel-border);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.sponsor-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain; /* Prevent cropping */
  transition: transform 0.4s ease;
}

.sponsor-card:hover .sponsor-img {
  transform: scale(1.04);
}

.sponsor-info {
  width: 65%;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sponsor-badge {
  background: var(--primary-gradient);
  color: white;
  padding: 0.3rem 0.8rem;
  border-radius: 30px;
  font-size: 0.75rem;
  font-weight: 700;
  width: fit-content;
  margin-bottom: 0.8rem;
  box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.sponsor-info h4 {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
}

.sponsor-info p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* Institutions & Universities Showcase */
.partners-section {
  max-width: 1200px;
  margin: 6rem auto;
  padding: 0 2rem;
  animation: fadeInUp 1s ease-out;
}

.partners-title {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.partners-subtitle {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 600px;
  margin: 0 auto 3.5rem auto;
}

.institutions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 2rem;
}

.institution-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 40px var(--panel-shadow);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.inst-card-banner {
  width: 100%;
  height: 140px;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--panel-border);
  background: var(--primary-gradient);
}

.inst-card-banner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.institution-card:hover .inst-card-banner img {
  transform: scale(1.1);
}

.inst-card-content {
  padding: 1.8rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-grow: 1;
}

/* Background gradient orb effect */
.institution-card::before {
  content: '';
  position: absolute;
  top: 30%;
  right: -20%;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--primary-color);
  opacity: 0.05;
  filter: blur(40px);
  transition: opacity 0.3s ease;
}

.institution-card:hover::before {
  opacity: 0.15;
}

.institution-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--primary-color);
  box-shadow: 0 20px 40px var(--panel-shadow), 0 0 25px rgba(99, 102, 241, 0.15);
}

.inst-card-header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-bottom: 1.2rem;
}

.inst-card-logo {
  width: 54px;
  height: 54px;
  min-width: 54px;
  background: var(--bg-color);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
  position: relative;
  z-index: 2;
  margin-top: -38px; /* Offset to float over the banner */
}

.institution-card:hover .inst-card-logo {
  transform: rotate(5deg) scale(1.1);
}

.inst-card-title-area {
  flex-grow: 1;
}

.inst-card-title-area h4 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.inst-card-tagline {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-color);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin-top: 0.2rem;
}

.inst-card-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.inst-card-tests-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 0.5rem;
}

.inst-card-tests-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.inst-card-test-badge {
  background: rgba(20, 184, 166, 0.1);
  color: var(--accent-color);
  border: 1px solid rgba(20, 184, 166, 0.2);
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.inst-card-test-badge:hover {
  background: var(--accent-color);
  color: white;
}

.inst-card-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.inst-card-btn:hover {
  background: var(--primary-gradient);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

/* Footer Section */
footer {
  border-top: 1px solid var(--panel-border);
  background: rgba(5, 8, 16, 0.5);
  padding: 2.5rem 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer p {
  margin-bottom: 0.5rem;
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--primary-color);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .hero h2 {
    font-size: 2.2rem;
  }
  
  .header-container {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }
  
  .controls-wrapper {
    padding: 1rem;
  }
  
  .grid-container {
    grid-template-columns: 1fr;
    padding: 0 1rem 3rem 1rem;
  }
  
  .modal-content {
    padding: 1.5rem;
  }
  
  .modal-header-container {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  
  .modal-action-bar {
    flex-direction: column;
  }

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

  .sponsor-card {
    flex-direction: column;
  }

  .sponsor-img-link {
    width: 100%;
    min-height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--panel-border);
  }

  .sponsor-info {
    width: 100%;
    padding: 1.5rem;
  }
}