/* ===========================
   Grant-Matcher UI – full CSS
   Palette:
     --primary: #213646  (deep navy)
     --accent : #1DBEE6  (vivid cyan)
=========================== */

:root {
  --primary: #213646;
  --accent : #1DBEE6;
  --bg     : #fefbf2;
  --text   : #213646;
}

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

body {
  font-family: 'Inter', sans-serif;
  background : var(--bg);
  color      : var(--text);
  line-height: 1.55;
  display    : flex;
  flex-direction: column;
  min-height : 100vh;
}

/* ========= Fancy animated header ========= */
header {
  background: linear-gradient(-45deg,
              var(--primary) 0%,
              #19506a 25%,
              var(--accent) 55%,
              #3ee1ff 80%);
  background-size: 400% 400%;
  animation: bgShift 14s ease-in-out infinite;

  color        : #ffffff;
  padding      : 3.8rem 1rem;
  text-align   : center;
  position     : relative;
  overflow     : hidden;
  border-bottom: 4px solid #ffffff10;
  box-shadow   : 0 6px 18px rgba(0,0,0,0.25);
}
header::before,
header::after {
  content : '';
  position: absolute;
  width   : 260px;
  height  : 260px;
  background: rgba(255,255,255,0.08);
  filter  : blur(60px);
  border-radius: 45% 55% 60% 40%;
  pointer-events: none;
  animation: float 20s ease-in-out infinite;
}
header::before { top:-70px; left:-90px; animation-delay:2.5s; }
header::after  { bottom:-90px; right:-70px; animation-direction:reverse; }

@keyframes bgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position:100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes float {
  0%,100% { transform: translate(0,0) rotate(0deg); }
  50%     { transform: translate(25px,-20px) rotate(10deg); }
}

h1 {
  font-size: clamp(2.2rem, 4vw + 1rem, 3rem);
  font-weight: 600;
  letter-spacing: 0.6px;
}

.hero-tagline {
  font-size: clamp(1rem, 2vw + 0.5rem, 1.25rem);
  opacity: 0.95;
  margin-top: 0.5rem;
  font-weight: 400;
}

/* ======== Tab navigation ======== */
.tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.tab {
  background: #ffffff;
  border: none;
  color: var(--primary);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.tab.active {
  background: var(--accent);
  color: #ffffff;
}

.tab:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.tab.active:focus {
  outline-color: #ffffff;
}

.hidden { display: none; }

/* ================= Main layout ================ */
main {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 1rem;
}

/* ========== Landing Stats Bar ========== */
.landing-stats-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-radius: 12px;
  border: 1px solid #bae6fd;
}

.landing-stat {
  color: var(--primary);
  font-size: 0.95rem;
}

.landing-stat strong {
  color: var(--accent);
  font-weight: 700;
}

.landing-stat-divider {
  color: #94a3b8;
  font-weight: 300;
}

@media (max-width: 500px) {
  .landing-stat-divider {
    display: none;
  }
  .landing-stats-bar {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* ========== How It Works ========== */
.how-it-works {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-top: 1.5rem;
  padding: 1rem;
  background: #fafafa;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
}

.how-it-works .step {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--primary);
}

.how-it-works .step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
}

.how-it-works .step-arrow {
  color: #94a3b8;
  font-weight: 300;
}

@media (max-width: 500px) {
  .how-it-works .step-arrow {
    display: none;
  }
  .how-it-works {
    flex-direction: column;
  }
}

/* ========== Researcher selector ========== */
.selector {
  position: relative;
  text-align: center;
  margin-bottom: 2rem;
}
.selector label {
  display: block;
  font-weight: 600;
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  color: var(--primary);
}
.input-wrapper {
  position: relative;
  width: 100%;
  max-width: 450px;
  margin: 0 auto;
}
#researcher-input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--primary);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
#researcher-input:focus { border-color: var(--accent); }

/* Suggestions dropdown */
.suggestions {
  position: absolute;
  top : calc(100% + 0.3rem);
  left: 0;
  right: 0;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  z-index: 20;
  max-height: 300px;
  overflow-y: auto;
  display: none;  /* shown via JS */
}
.suggestion-item {
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  transition: background 0.15s ease;
  border-bottom: 1px solid #f0f0f0;
}
.suggestion-name {
  font-weight: 500;
}
.suggestion-affiliation {
  font-size: 0.8rem;
  color: #6b7280;
}
.suggestion-item:last-child { border-bottom: none; }
.suggestion-item:hover,
.suggestion-item:focus  { background: var(--accent); color: #ffffff; }
.suggestion-item:hover .suggestion-affiliation,
.suggestion-item:focus .suggestion-affiliation { color: #e0e0e0; }

/* ========== Dataset stats dashboard ========== */
.dashboard {
  margin: 2rem auto;
  max-width: 900px;
  padding: 0 1rem;
}
.stats-dashboard {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.chart-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
}

.chart-grid canvas {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 400px;
  max-height: 250px;
}

.section-title {
  margin-top: 2rem;
  text-align: center;
  color: var(--primary);
}

.topic-charts-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2rem;
  margin-top: 1rem;
}

.topic-chart-container {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  width: 400px;
  height: 280px;
}

.comparison-chart-container {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  margin-top: 1rem;
  height: 550px;
}

.stat {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 1rem 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  text-align: center;
  min-width: 120px;
}

.stat-number {
  display: block;
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.stat-label {
  font-weight: 600;
  color: var(--primary);
}

/* ========== Most Matched Grants Section ========== */
.most-matched-section {
  margin-top: 2rem;
  background: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  padding: 1.5rem;
}

.most-matched-section h3 {
  margin: 0 0 0.5rem;
  color: var(--primary);
  font-size: 1.1rem;
}

.section-subtitle {
  color: #666;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.section-subtitle.centered {
  text-align: center;
}

.most-matched-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.most-matched-item {
  padding: 0.75rem 0;
  border-bottom: 1px solid #eee;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.most-matched-item:last-child {
  border-bottom: none;
}

.most-matched-item a {
  flex: 1;
  min-width: 200px;
  color: var(--primary);
  text-decoration: none;
}

.most-matched-item a:hover {
  text-decoration: underline;
}

.match-count-badge {
  background: var(--accent);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.provider-tag {
  background: #f0f0f0;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #666;
  white-space: nowrap;
}

/* ========== Researcher header ========== */
.researcher-header {
  grid-column: 1 / -1;
  text-align: center;
  margin-bottom: 1rem;
}
.researcher-name {
  font-size: 1.5rem;
  color: var(--primary);
  margin-bottom: 0.25rem;
}
.researcher-affiliation {
  color: #6b7280;
  font-size: 0.95rem;
  margin: 0;
}

/* ========== Grant cards ========== */
.grants {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px,1fr));
  gap: 1.5rem;
}
.grant {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-left: 6px solid var(--accent);
  border-radius: 14px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.grant:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}
.grant h3 {
  font-size: 1.125rem;
  color: var(--accent);
  margin-bottom: 0.5rem;
  font-weight: 600;
}
.grant p { margin-bottom: 0.25rem; font-size: 0.95rem; }

/* Summary toggle */
.summary-toggle {
  margin-top: 0.4rem;
  align-self: flex-start;
  background: none;
  border: none;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
  font-size: 0.95rem;
}
.summary {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

.ai-reason {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  line-height: 1.45;
}

/* ========== Footer with LinkedIn ========== */
footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  text-align: center;
  padding: 1rem 0 1.5rem;
  font-size: 0.85rem;
  color: #7a8b99;
}
footer .social-icon {
  display: inline-flex;
  width: 20px;
  height: 20px;
  transition: transform 0.15s ease;
}
footer .social-icon svg { fill: var(--accent); }
footer .social-icon:hover { transform: scale(1.15); }
footer .social-icon:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  transform: scale(1.15);
}

/* === Landing Welcome Card === */
.landing-welcome {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}

.welcome-card {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 2rem 2.5rem;
  max-width: 500px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.welcome-wizard {
  width: 120px;
  height: auto;
  margin-bottom: 1rem;
  border-radius: 12px;
}

.welcome-card h2 {
  color: var(--primary);
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
}

.welcome-card p {
  color: #64748b;
  margin-bottom: 1rem;
  line-height: 1.5;
}

.welcome-features {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
  margin-top: 1rem;
}

.welcome-features span {
  color: var(--primary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* === Empty Suggestion State === */
.suggestion-empty {
  padding: 1rem;
  text-align: center;
  color: var(--primary);
}

.suggestion-empty p {
  margin: 0.25rem 0;
}

.empty-hint {
  font-size: 0.85rem;
  color: #64748b;
}

/* Highlighted request button */
.request-to-add.highlighted .request-add-btn {
  background: var(--accent);
  color: #fff;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}
.teaser-card {
  grid-column: 1 / -1;
  width: 95%;
  max-width: 700px;
  margin: 2rem auto;
  padding: 1.5rem;
  background: var(--primary);
  color: #ffffff;
  border: 2px solid var(--primary);
  border-radius: 14px;
  text-align: center;
  box-shadow: 0 6px 14px rgba(0,0,0,0.15);
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 0.6s forwards;
}
.teaser-card img {
  display: block;
  width: 100%;
  max-width: 650px;
  height: auto;
  border-radius: 8px;
  margin: 0 auto 1rem;
}
.teaser-card button {
  margin-top: 1rem;
  background: var(--accent);
  border: none;
  color: #ffffff;
  padding: 0.8rem 1.4rem;
  font-size: 1rem;
  border-radius: 8px;
  cursor: pointer;
}
.teaser-card button:hover { opacity: 0.9; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-overlay.hidden {
  display: none;
}
.modal {
  position: relative;
  background: #ffffff;
  padding: 1.5rem;
  border-radius: 10px;
  width: 90%;
  max-width: 400px;
  text-align: center;
}
.modal h2 { margin-bottom: 0.5rem; }
.modal .close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #333;
}

@keyframes fadeUp {
  to { opacity: 1; transform: none; }
}

/* ======== Grants table ======== */
#tab-grants {
  max-width: 95%;
  margin: 2rem auto;
  padding: 0 1rem;
}

.table-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}

.table-controls input[type="search"] {
  flex: 0 1 400px;
  max-width: 500px;
  padding: 0.4rem 0.6rem;
  border: 2px solid var(--primary);
  border-radius: 6px;
}

.table-controls button {
  background: var(--accent);
  border: none;
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  cursor: pointer;
}

.dt-button {
  background: var(--accent) !important;
  color: #fff !important;
  border: none !important;
  padding: 0.4rem 0.8rem !important;
  border-radius: 6px !important;
  margin-right: 0.3rem;
}

.dataTables_wrapper .dataTables_filter {
  display: none; /* hide default search */
}

/* === Clickable collaborator links in Grants table === */
.collab-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, text-decoration 0.15s ease;
}

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

.collab-link:focus {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

/* === Voting === */
.vote-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.4rem;
}

.vote-btn {
  border: 2px solid var(--primary);
  background: #fff;
  border-radius: 999px;
  /* Increased padding for minimum 44x44px touch target (WCAG) */
  padding: 0.5rem 0.75rem;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  font: inherit;
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s ease;
}

.vote-btn:hover {
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.vote-btn:focus {
  outline: 2px dashed var(--accent);
  outline-offset: 2px;
}

.vote-btn.liked {
  background: #28a745;
  color: #fff;
}

.vote-btn.disliked {
  background: #dc3545;
  color: #fff;
}

.vote-bar .count {
  display: none !important;
}

@media (min-width: 400px) {
  .grant h3 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
  }
  .grant h3 + .vote-bar {
    margin-top: 0;
  }
}

/* ========== Collaborations Tab ========== */
#collaborations {
  flex: 1;
  width: 100%;
  max-width: 900px;
  margin: 3rem auto;
  padding: 0 1rem;
}

.collab-description {
  color: #6b7280;
  font-size: 0.9rem;
  font-style: italic;
  margin-bottom: 0.5rem;
}

#collab-researcher-input {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--primary);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.04);
}
#collab-researcher-input:focus { border-color: var(--accent); }

/* Collaborators grid - responsive 2-column layout */
.collaborators {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

/* Collaborator card - same style as grant cards */
.collaborator-card {
  background: #ffffff;
  border: 2px solid var(--primary);
  border-left: 6px solid var(--accent);
  border-radius: 14px;
  padding: 1.25rem 1.25rem 1.5rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.collaborator-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.12);
}

.collaborator-header {
  margin-bottom: 0.75rem;
  border-bottom: 1px solid #eee;
  padding-bottom: 0.75rem;
}

.collaborator-name {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collaborator-affiliation {
  font-size: 0.85rem;
  color: #6b7280;
  margin: 0.25rem 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Shared grants section */
.shared-grants-section h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
  margin: 0 0 0.5rem;
}

.shared-grants-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.shared-grant-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid #f0f0f0;
}

.shared-grant-item:last-child {
  border-bottom: none;
}

.grant-title-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  display: block;
  margin-bottom: 0.25rem;
}

.grant-title-link:hover {
  text-decoration: underline;
  color: var(--accent);
}

.grant-details {
  background: #f9f9f9;
  border-radius: 6px;
  padding: 0.75rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.grant-details p {
  margin: 0.25rem 0;
}

.grant-details .detail-label {
  font-weight: 600;
  color: var(--primary);
}

.collab-summary-toggle {
  background: none;
  border: none;
  font-weight: 600;
  cursor: pointer;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  user-select: none;
  font-size: 0.85rem;
  padding: 0;
}

.collab-summary-toggle:hover {
  color: var(--accent);
}

/* No results message */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  color: #6b7280;
  padding: 2rem;
}

/* Loading spinner */
.loading-spinner {
  text-align: center;
  padding: 3rem;
  color: var(--primary);
  font-size: 1.1rem;
}

.loading-spinner::before {
  content: '';
  display: block;
  width: 40px;
  height: 40px;
  margin: 0 auto 1rem;
  border: 3px solid #e5e7eb;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== Mobile Responsiveness ========== */
@media (max-width: 600px) {
  .stat {
    min-width: 100px;
    padding: 0.75rem 1rem;
  }

  .stat-number {
    font-size: 1.3rem;
  }

  .chart-grid canvas {
    max-width: 100%;
  }

  .tab {
    padding: 0.4rem 0.75rem;
    font-size: 0.9rem;
  }
}

@media (max-width: 400px) {
  .stats-dashboard {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .stat {
    min-width: unset;
  }
}

/* ========== Search Row with Subscribe Button ========== */
.search-row {
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  width: 100%;
  max-width: 500px;
}

.search-row .input-wrapper {
  flex: 1;
  min-width: 0;
}

.subscribe-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  width: 44px;
}

.subscribe-btn:hover {
  opacity: 0.9;
  transform: scale(1.05);
}

.subscribe-btn.hidden { display: none; }

.subscribe-btn.subscribed {
  background: #28a745;
}

/* ========== Subscribe Modal ========== */
.subscribe-modal {
  max-width: 400px;
}

.subscribe-status {
  font-size: 0.9rem;
  margin-bottom: 1rem;
  text-align: center;
}

.subscribe-status.success { color: #28a745; }
.subscribe-status.error { color: #dc3545; }

.subscribe-form-modal {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subscribe-form-modal input[type="email"] {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.submit-subscribe-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
}

.submit-subscribe-btn:hover { opacity: 0.9; }
.submit-subscribe-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.submit-subscribe-btn.unsubscribe-mode {
  background: #dc3545;
}

.submit-subscribe-btn.unsubscribe-mode:hover {
  background: #c82333;
}

/* ========== Request to be Added Button ========== */
.request-to-add {
  margin-top: 1rem;
  text-align: center;
}

.request-add-btn {
  background: transparent;
  border: 2px solid var(--accent);
  color: var(--accent);
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.request-add-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ========== Request Modal ========== */
.request-modal {
  max-width: 500px;
  min-height: 400px;
  overflow: visible;
  text-align: left;
}

.modal-subtitle {
  color: #6b7280;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  text-align: center;
}

.openalex-search {
  position: relative;
  margin-bottom: 1rem;
}

#openalex-search-input {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--primary);
  border-radius: 10px;
  font-size: 1rem;
  box-sizing: border-box;
}

.openalex-suggestions {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  z-index: 30;
  max-height: 250px;
  overflow-y: auto;
  display: none;
}

.openalex-suggestion-item {
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.openalex-suggestion-item:last-child { border-bottom: none; }
.openalex-suggestion-item:hover { background: var(--accent); color: #fff; }
.openalex-suggestion-item:hover .openalex-institution,
.openalex-suggestion-item:hover .openalex-works { color: #e0e0e0; }

.openalex-name { font-weight: 500; }
.openalex-institution { font-size: 0.8rem; color: #6b7280; }
.openalex-works { font-size: 0.75rem; color: #9ca3af; }

/* Selected Profile */
.selected-profile {
  background: #f9f9f9;
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 1rem;
  margin: 1rem 0;
}

.selected-profile h4 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--primary);
}

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.profile-name { font-weight: 600; color: var(--accent); }
.profile-institution { font-size: 0.9rem; color: #6b7280; }
.profile-works { font-size: 0.8rem; color: #9ca3af; }

/* Request email */
.request-email-section {
  margin: 1rem 0;
}

.request-email-section label {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 0.3rem;
}

.request-email-section input {
  width: 100%;
  padding: 0.6rem 1rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-sizing: border-box;
}

/* Submit button */
.submit-request-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 1rem;
  margin-top: 0.5rem;
}

.submit-request-btn:hover { opacity: 0.9; }
.submit-request-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.request-status {
  margin-top: 0.75rem;
  font-size: 0.9rem;
  text-align: center;
}

.request-status.success { color: #28a745; }
.request-status.error { color: #dc3545; }

/* Privacy Modal */
.privacy-modal {
  position: fixed;
  inset: 0;
  background: rgba(33, 54, 70, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.privacy-modal.hidden { display: none; }

.privacy-content {
  background: var(--bg);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.privacy-content h2 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.4rem;
}

.privacy-content h3 {
  color: var(--primary);
  margin: 1rem 0 0.5rem;
  font-size: 1rem;
}

.privacy-body ul {
  margin-left: 1.2rem;
  font-size: 0.9rem;
}

.privacy-body li {
  margin-bottom: 0.4rem;
}

.privacy-note {
  background: #e3f6fc;
  border-left: 3px solid var(--accent);
  padding: 0.75rem;
  margin-top: 1rem;
  font-size: 0.85rem;
  border-radius: 4px;
}

.privacy-actions {
  margin-top: 1.5rem;
  text-align: center;
}

.privacy-actions .btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.privacy-actions .btn-primary:hover {
  background: #18a8cc;
}

/* ========== Toast Notifications ========== */
.toast-notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--primary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 2000;
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  max-width: 90%;
  text-align: center;
}

.toast-notification.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.toast-notification.toast-success {
  background: #28a745;
}

.toast-notification.toast-error {
  background: #dc3545;
}

.toast-notification.toast-info {
  background: var(--accent);
}

/* ========== Screen Reader Only (Accessibility) ========== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== Reduced Motion Support ========== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  header {
    animation: none;
    background-position: 0% 50%;
  }

  header::before,
  header::after {
    animation: none;
  }

  .grant:hover,
  .collaborator-card:hover {
    transform: none;
  }

  .loading-spinner::before {
    animation: none;
    border-color: var(--accent);
  }

  .toast-notification {
    transition: none;
  }
}
