/* ============================================================
   ScholarScout App CSS
   Covers: nav, search form, results page, scholarship detail,
           error pages. Builds on theme.css design tokens.
   ============================================================ */

/* ── GLOBAL OVERRIDES FOR APP PAGES ── */
.app-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.accent { color: var(--accent); }

/* ── APP NAV ── */
.app-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.app-nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-brand:hover { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 16px; }

.nav-link {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover { color: var(--fg); }

.nav-cta {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  transition: background 0.2s, color 0.2s;
}

.nav-cta:hover {
  background: var(--accent-glow);
  color: var(--accent);
}

/* ── BUTTONS ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: #0a0a0f;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  line-height: 1;
}

.btn-primary:hover {
  background: #f5b040;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary.btn-large {
  font-size: 1.05rem;
  padding: 16px 32px;
  border-radius: 12px;
  margin-top: 8px;
}

.btn-primary.btn-block {
  width: 100%;
  justify-content: center;
  margin-top: 24px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fg-muted);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 12px 24px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s;
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-apply {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(240,160,48,0.2);
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-apply:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.btn-details {
  display: inline-flex;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.2s;
}

.btn-details:hover {
  color: var(--fg);
  border-color: rgba(255,255,255,0.2);
}

.btn-arrow { transition: transform 0.2s; }
.btn-primary:hover .btn-arrow,
.btn-apply:hover .btn-arrow { transform: translateX(3px); }

/* ── BACK LINK ── */
.back-link {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  margin-bottom: 32px;
  transition: color 0.2s;
}

.back-link:hover { color: var(--fg); }

/* ── SEARCH PAGE ── */
.search-page {
  flex: 1;
  padding: 60px 24px 80px;
}

.search-container {
  max-width: 680px;
  margin: 0 auto;
}

.search-header {
  margin-bottom: 52px;
}

.search-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 24px;
}

.search-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 16px;
}

.search-lede {
  font-size: 1.05rem;
  color: var(--fg-muted);
  line-height: 1.65;
  max-width: 540px;
}

/* ── FORM ── */
.search-form {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.form-section { display: flex; flex-direction: column; gap: 10px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.form-label {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.form-optional {
  font-weight: 400;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

.form-error-inline {
  font-size: 0.82rem;
  font-weight: 500;
  color: #f56565;
  background: rgba(245, 101, 101, 0.1);
  padding: 3px 10px;
  border-radius: 6px;
}

.form-hint {
  font-size: 0.83rem;
  color: var(--fg-muted);
  margin-top: 2px;
}

.form-input,
.form-select,
.form-textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--fg);
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 13px 16px;
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a8892' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: rgba(138, 136, 146, 0.6);
}

.form-input.input-error {
  border-color: rgba(245, 101, 101, 0.5);
}

.form-input.input-error:focus {
  border-color: #f56565;
  box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.12);
}

.form-textarea { resize: vertical; min-height: 80px; }

/* ── EDU TYPE CARDS ── */
.edu-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.edu-type-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1.5px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 18px 16px;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.edu-type-card:hover {
  border-color: rgba(240,160,48,0.3);
  background: var(--bg-card);
}

.edu-type-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent);
}

.edu-type-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.edu-type-label {
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.3;
}

.edu-type-desc {
  font-size: 0.78rem;
  color: var(--fg-muted);
  line-height: 1.45;
}

.edu-type-card.selected .edu-type-label { color: var(--accent); }

/* ── RESULTS PAGE ── */
.results-page { flex: 1; }

.results-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding: 40px 24px 36px;
}

.results-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.results-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.ai-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--fg-muted);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 8px 14px;
  max-width: 520px;
}

.ai-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

.results-header h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.results-count {
  color: var(--accent);
}

.results-profile-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.profile-tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 5px 12px;
  border-radius: 6px;
}

/* ── RESULTS GRID ── */
.results-grid {
  padding-top: 36px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.scholarship-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  gap: 0;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
}

.scholarship-card:hover {
  border-color: rgba(240,160,48,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.card-rank {
  display: flex;
  align-items: flex-start;
  padding: 24px 0 24px 20px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(240,160,48,0.35);
  letter-spacing: 0.02em;
  min-width: 44px;
  padding-top: 28px;
}

.card-body {
  flex: 1;
  padding: 24px 24px 20px 0;
  min-width: 0;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 12px;
}

.card-provider {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.card-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--fg);
}

.card-amount {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
  flex-shrink: 0;
}

.amount-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.amount-varies { color: var(--fg-muted); font-size: 0.9rem; }

.renewable-badge {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #34d399;
  background: rgba(52,211,153,0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

.card-description {
  font-size: 0.9rem;
  color: var(--fg-muted);
  line-height: 1.55;
  margin-bottom: 14px;
  /* Truncate long descriptions */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 12px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.meta-icon { font-size: 0.85em; }
.meta-text { line-height: 1; }

.eligibility-note {
  font-size: 0.82rem;
  color: var(--fg-muted);
  background: rgba(255,255,255,0.03);
  border-left: 2px solid var(--accent-soft);
  border-radius: 0 6px 6px 0;
  padding: 8px 12px;
  margin-bottom: 12px;
  line-height: 1.5;
}

.eligibility-label {
  font-weight: 600;
  color: var(--fg);
  margin-right: 6px;
}

/* ── TAGS ── */
.card-tags, .detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  display: inline-block;
  font-size: 0.73rem;
  font-weight: 500;
  color: var(--fg-muted);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.07);
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* ── CARD FOOTER ── */
.card-footer {
  display: flex;
  align-items: center;
  padding: 0 20px 20px 0;
  align-self: flex-end;
}

/* ── RESULTS FOOTER ── */
.results-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 24px 60px;
  text-align: center;
}

.results-disclaimer {
  font-size: 0.82rem;
  color: rgba(138,136,146,0.6);
  max-width: 480px;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 80px 24px;
}

.empty-icon { font-size: 3rem; margin-bottom: 24px; }

.empty-state h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.empty-state p {
  color: var(--fg-muted);
  margin-bottom: 28px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

/* ── DETAIL PAGE ── */
.detail-page {
  flex: 1;
  padding: 48px 24px 80px;
}

.detail-container {
  max-width: 900px;
  margin: 0 auto;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  overflow: hidden;
}

.detail-header {
  padding: 40px 48px 36px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.detail-provider {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.detail-name {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}

.detail-amount {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 0;
}

.detail-main {
  padding: 40px 48px;
  border-right: 1px solid rgba(255,255,255,0.06);
}

.detail-section {
  margin-bottom: 32px;
}

.detail-section h2 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.detail-section p {
  color: var(--fg-muted);
  line-height: 1.65;
  font-size: 0.975rem;
}

.detail-sidebar { padding: 40px 32px; }

.sidebar-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  overflow: hidden;
}

.sidebar-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-row:last-child { border-bottom: none; }

.sidebar-label {
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(138,136,146,0.7);
}

.sidebar-value {
  font-size: 0.9rem;
  color: var(--fg);
  line-height: 1.4;
}

.sidebar-value.accent { color: var(--accent); }

/* ── ERROR PAGES ── */
.error-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
}

.error-container { text-align: center; }

.error-code {
  font-family: var(--font-display);
  font-size: 6rem;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.25;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.error-container h1 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 28px;
}

/* ── LANDING PAGE HERO CTA (added below hero stat row) ── */
.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-top: 48px;
}

/* ── RESPONSIVE ── */
@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .detail-main { border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); padding: 32px 28px; }
  .detail-header { padding: 32px 28px 28px; }
  .detail-sidebar { padding: 28px 28px 32px; }
  .edu-type-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .search-page { padding: 40px 20px 60px; }
  .form-row { grid-template-columns: 1fr; }
  .card-header-row { flex-direction: column; gap: 8px; }
  .card-amount { align-items: flex-start; }
  .results-header { padding: 28px 20px 24px; }
  .results-container { padding: 0 16px; }
  .card-body { padding: 20px 16px 16px 0; }
  .card-rank { padding: 24px 0 20px 14px; }
  .card-footer { padding: 0 16px 16px 0; }
}

@media (max-width: 480px) {
  .search-header h1 { font-size: 1.8rem; }
  .results-header h1 { font-size: 1.4rem; }
  .results-meta { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ── HERO LANDING PAGE ADDITIONS ── */
.hero-cta-note {
  font-size: 0.85rem;
  color: var(--fg-muted);
  letter-spacing: 0.01em;
}
