/* ============================================================
   BIS Standards Recommendation Engine — styles.css
   Team Code_ninja | BIS × SS Hackathon | AI/RAG Track
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --navy:       #0B1F3A;
  --navy-mid:   #142947;
  --navy-light: #1E3D5C;
  --gold:       #C9A84C;
  --gold-light: #E8C96E;
  --cream:      #F8F5EF;
  --white:      #FFFFFF;
  --muted:      #7A8DA0;
  --border:     rgba(255,255,255,0.09);
  --border-light: rgba(11,31,58,0.1);
  --success:    #2AAD6B;
  --warning:    #D97706;
  --info:       #3B82F6;
  --sidebar-w:  260px;
  --radius:     12px;
  --radius-sm:  8px;
}

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

html { font-size: 15px; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--navy);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

/* ============================================================
   SIDEBAR
   ============================================================ */

.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  padding: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.logo-mark {
  width: 40px; height: 40px;
  background: var(--gold);
  color: var(--navy);
  font-family: 'DM Serif Display', serif;
  font-size: 13px;
  font-weight: 400;
  display: flex;
  align-items: center; justify-content: center;
  border-radius: 8px;
  letter-spacing: 0.05em;
}

.logo-name {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--white);
  letter-spacing: -0.01em;
}

.logo-sub {
  display: block;
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding: 1.25rem 1.25rem 0.5rem;
}

.nav-links {
  list-style: none;
  padding: 0 0.75rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover {
  color: var(--white);
  background: rgba(255,255,255,0.07);
}

.nav-item.active {
  color: var(--gold-light);
  background: rgba(201,168,76,0.12);
}

.nav-item svg { flex-shrink: 0; }

.quick-links {
  list-style: none;
  padding: 0 0.75rem;
}

.quick-links li {
  padding: 0.4rem 0.75rem;
  font-size: 13px;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-links li:hover {
  color: rgba(255,255,255,0.8);
  background: rgba(255,255,255,0.05);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1.25rem;
  border-top: 1px solid var(--border);
}

.hackathon-badge {
  font-size: 10px;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.team-tag {
  font-size: 12px;
  color: rgba(255,255,255,0.4);
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  padding: 2.5rem 2.5rem 4rem;
  max-width: 920px;
}

.page { display: none; animation: fadeUp 0.25s ease; }
.page.active { display: block; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  font-weight: 400;
  color: var(--navy);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.page-desc {
  font-size: 15px;
  color: var(--muted);
  max-width: 600px;
  line-height: 1.6;
}

/* ============================================================
   SEARCH CARD
   ============================================================ */

.search-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 2px 12px rgba(11,31,58,0.06);
}

.input-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.75rem;
  font-weight: 500;
}

.input-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

textarea {
  flex: 1;
  border: 1px solid #D6DDE5;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--navy);
  resize: none;
  line-height: 1.6;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: #FAFCFF;
}

textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}

textarea::placeholder { color: #A8B5C0; }

.btn-primary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  background: var(--navy);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, transform 0.1s;
}

.btn-primary:hover { background: var(--navy-light); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.search-hint {
  margin-top: 0.6rem;
  font-size: 11px;
  color: #A8B5C0;
}

kbd {
  background: #F0F2F5;
  border: 1px solid #D6DDE5;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: monospace;
}

/* ============================================================
   PIPELINE
   ============================================================ */

.pipeline-wrap {
  margin-bottom: 1.5rem;
  overflow-x: auto;
}

.pipeline-track {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  min-width: 600px;
  box-shadow: 0 1px 4px rgba(11,31,58,0.04);
}

.pipe-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
  font-size: 11px;
  color: #A8B5C0;
  transition: all 0.3s ease;
}

.pipe-icon-wrap {
  width: 32px; height: 32px;
  border: 1px solid #E2E8F0;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center; justify-content: center;
  transition: all 0.3s;
  background: #F8FAFC;
}

.pipe-step span { font-weight: 500; }

.pipe-step.active .pipe-icon-wrap {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--navy);
  box-shadow: 0 0 12px rgba(201,168,76,0.4);
  animation: pulseIcon 1s infinite;
}

.pipe-step.active { color: var(--gold); }

.pipe-step.done .pipe-icon-wrap {
  background: #ECFDF5;
  border-color: var(--success);
  color: var(--success);
}

.pipe-step.done { color: var(--success); }

@keyframes pulseIcon {
  0%, 100% { box-shadow: 0 0 8px rgba(201,168,76,0.35); }
  50%       { box-shadow: 0 0 16px rgba(201,168,76,0.65); }
}

.pipe-arrow { color: #D0D7E0; font-size: 14px; flex-shrink: 0; }

/* ============================================================
   RESULTS
   ============================================================ */

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

.results-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
}

.meta-info {
  font-size: 12px;
  color: var(--muted);
}

.result-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 4px rgba(11,31,58,0.04);
  animation: slideIn 0.3s ease both;
}

.result-card:nth-child(1) { animation-delay: 0.05s; }
.result-card:nth-child(2) { animation-delay: 0.10s; }
.result-card:nth-child(3) { animation-delay: 0.15s; }
.result-card:nth-child(4) { animation-delay: 0.20s; }
.result-card:nth-child(5) { animation-delay: 0.25s; }

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-card:hover {
  border-color: #C4CFDA;
  box-shadow: 0 4px 16px rgba(11,31,58,0.08);
}

.result-card.expanded { border-color: var(--gold); }

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.rank-badge {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 2px;
}

.rank-1 { background: #FEF3C7; color: #92400E; }
.rank-2 { background: #F1F5F9; color: #475569; }
.rank-3 { background: #F1F5F9; color: #475569; }
.rank-other { background: #F1F5F9; color: #94A3B8; }

.card-content { flex: 1; min-width: 0; }

.is-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--info);
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.std-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--navy);
  line-height: 1.4;
  margin-bottom: 8px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cat-tag {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  background: #EEF2FF;
  color: #4338CA;
  font-weight: 500;
}

.score-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 120px;
}

.score-bar {
  flex: 1;
  height: 3px;
  background: #E8EDF2;
  border-radius: 2px;
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--success), #52D49C);
  transition: width 0.7s cubic-bezier(0.25, 1, 0.5, 1);
}

.score-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--success);
  white-space: nowrap;
}

.expand-hint {
  font-size: 11px;
  color: #A8B5C0;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
}

.rationale-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #EEF0F3;
  display: none;
}

.rationale-block.show { display: block; }

.rationale-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 6px;
}

.rationale-text {
  font-size: 13.5px;
  color: #3A5068;
  line-height: 1.7;
}

.scope-row {
  margin-top: 8px;
  padding: 8px 12px;
  background: #F8FAFC;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--muted);
}

.scope-row strong { color: var(--navy); }

/* Footer note */
.results-footer {
  text-align: center;
  font-size: 12px;
  color: #B0BCC8;
  margin-top: 1rem;
  padding-bottom: 1rem;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--muted);
}

.empty-icon {
  margin: 0 auto 1rem;
  color: #CBD5E1;
}

.empty-state p { font-size: 14px; line-height: 1.8; }

/* Loading */
.loading-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 28px; height: 28px;
  border: 2px solid #E2E8F0;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 1rem;
}

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

.loading-steps {
  margin-top: 0.75rem;
  font-size: 12px;
  color: #94A3B8;
}

/* Error */
.error-msg {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  color: #B91C1C;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-size: 13px;
  margin-bottom: 1rem;
}

/* ============================================================
   ARCHITECTURE PAGE
   ============================================================ */

.arch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 2rem;
}

.arch-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  box-shadow: 0 1px 4px rgba(11,31,58,0.04);
}

.arch-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.arch-card p {
  font-size: 13px;
  color: #5A7080;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.arch-step-num {
  position: absolute;
  top: 1rem; right: 1rem;
  font-size: 22px;
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  opacity: 0.12;
  color: var(--navy);
}

.tech-pill {
  display: inline-block;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 20px;
  margin-right: 4px;
  margin-top: 4px;
  font-weight: 500;
}

.accent-blue .tech-pill   { background: #EFF6FF; color: #1D4ED8; }
.accent-teal .tech-pill   { background: #F0FDFA; color: #0F766E; }
.accent-amber .tech-pill  { background: #FFFBEB; color: #92400E; }
.accent-coral .tech-pill  { background: #FFF1F2; color: #BE123C; }
.accent-purple .tech-pill { background: #F5F3FF; color: #6D28D9; }
.accent-green .tech-pill  { background: #F0FDF4; color: #166534; }

.accent-blue   { border-left: 3px solid #3B82F6; }
.accent-teal   { border-left: 3px solid #14B8A6; }
.accent-amber  { border-left: 3px solid #F59E0B; }
.accent-coral  { border-left: 3px solid #F43F5E; }
.accent-purple { border-left: 3px solid #8B5CF6; }
.accent-green  { border-left: 3px solid #22C55E; }

.flow-diagram {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  flex-wrap: nowrap;
}

.flow-node {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.node-input    { background: rgba(59,130,246,0.25); color: #93C5FD; }
.node-process  { background: rgba(139,92,246,0.25); color: #C4B5FD; }
.node-index    { background: rgba(20,184,166,0.25); color: #5EEAD4; }
.node-retrieve { background: rgba(245,158,11,0.25); color: #FCD34D; }
.node-generate { background: rgba(244,63,94,0.25);  color: #FDA4AF; }
.node-output   { background: rgba(34,197,94,0.25);  color: #86EFAC; }

.flow-arrow-h {
  color: rgba(255,255,255,0.3);
  font-size: 16px;
  flex-shrink: 0;
}

/* ============================================================
   METRICS PAGE
   ============================================================ */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 2rem;
}

.metric-big {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(11,31,58,0.04);
}

.metric-val {
  font-family: 'DM Serif Display', serif;
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin-bottom: 4px;
}

.metric-val.success { color: var(--success); }
.metric-val.perfect { color: var(--gold); }

.metric-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}

.metric-target {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
}

.metric-bar-wrap {
  height: 4px;
  background: #EEF0F3;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.metric-bar {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 1s ease;
}

.perfect-bar { background: var(--gold); }

.metric-def {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 1rem;
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(11,31,58,0.04);
  font-size: 13.5px;
}

.metrics-table th {
  background: #F8FAFC;
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
}

.metrics-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #F0F2F5;
  color: var(--navy);
}

.metrics-table tr:last-child td { border-bottom: none; }

.formula {
  font-family: 'Courier New', monospace;
  font-size: 12px;
  color: #6366F1;
  background: #F5F3FF;
  padding: 2px 8px;
  border-radius: 4px;
}

.impact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.impact-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: 0 1px 4px rgba(11,31,58,0.04);
}

.impact-icon {
  font-size: 24px;
  margin-bottom: 0.75rem;
}

.impact-card h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.4rem;
}

.impact-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* ============================================================
   ABOUT PAGE
   ============================================================ */

.about-hero {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  color: var(--white);
}

.about-problem h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 1.25rem;
  color: var(--gold-light);
}

.stat-row {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.stat-box { flex: 1; min-width: 120px; }

.stat-num {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--gold-light);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-lbl {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  line-height: 1.4;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 2rem;
}

.team-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
  box-shadow: 0 1px 4px rgba(11,31,58,0.04);
}

.avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--navy);
  color: var(--gold-light);
  font-size: 16px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 0.75rem;
}

.member-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}

.member-role {
  font-size: 12px;
  color: var(--muted);
}

.ack-list { display: flex; flex-direction: column; gap: 10px; }

.ack-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  font-size: 13.5px;
  color: #4A6070;
  box-shadow: 0 1px 3px rgba(11,31,58,0.03);
}

.ack-logo {
  width: 36px; height: 36px;
  background: #F1F5F9;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--navy);
  flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 1.5rem; }
  .input-row { flex-direction: column; }
  .btn-primary { width: 100%; justify-content: center; }
}
