/* ─────────────────────────────────────────────────────
   tools.css — Shared styles for calculator/tool pages
   Uses site design tokens from homepage-ui-system.css
   ───────────────────────────────────────────────────── */

/* ── Layout ── */
.gc-page { max-width: 1100px; margin: 0 auto; padding: 0 1rem; }
.gc-row { display: flex; gap: 2rem; align-items: flex-start; }
.gc-main { flex: 1; min-width: 0; max-width: 720px; padding-bottom: 3rem; }

/* ── Sidebar (desktop only) ── */
.gc-sidebar { display: none; width: 300px; flex-shrink: 0; }
.gc-sidebar-inner { position: sticky; top: 1.5rem; }
@media (min-width: 960px) { .gc-sidebar { display: block; } }

.gc-sb-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.15rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(13,21,38,0.04);
}
.gc-sb-card h3 {
  font-family: var(--f-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.75rem;
}
.gc-sb-card a {
  display: block;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.2rem;
  border-radius: 7px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--blue-600);
  text-decoration: none;
  transition: all 0.15s;
}
.gc-sb-card a:hover { background: var(--blue-50); color: var(--blue-700); }

.gc-sb-mini-tbl { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.gc-sb-mini-tbl th {
  text-align: left;
  padding: 0.4rem 0.5rem;
  background: var(--off);
  color: var(--ink-3);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.gc-sb-mini-tbl td {
  padding: 0.35rem 0.5rem;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border-s);
}

/* ── Hero ── */
.gc-hero { text-align: center; padding: 2.5rem 0 1.5rem; }
.gc-hero h1 {
  font-family: var(--f-display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.25;
  margin: 0 0 0.6rem;
}
.gc-hero p {
  font-family: var(--f-sans);
  font-size: 1rem;
  color: var(--ink-3);
  max-width: 560px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Tabs (calculators page) ── */
.gc-tabs-wrap { position: relative; }
.gc-tabs-wrap::after {
  content: '';
  position: absolute; top: 0; right: 0; bottom: 0; width: 2rem;
  background: linear-gradient(to right, transparent, var(--off));
  pointer-events: none; z-index: 1; transition: opacity 0.2s;
}
.gc-tabs-wrap.scrolled-end::after { opacity: 0; }
.gc-tabs {
  display: flex; gap: 0.4rem; padding: 0 0 0.75rem; margin: 0 0 1rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.gc-tab {
  flex: 0 0 auto; scroll-snap-align: start;
  padding: 0.5rem 1rem;
  font-family: var(--f-sans);
  font-size: 0.8rem; font-weight: 600;
  color: var(--ink-3);
  background: var(--off);
  border: 1.5px solid transparent;
  border-radius: 99px;
  cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.gc-tab:hover { color: var(--blue-600); background: var(--blue-50); border-color: var(--blue-200); }
.gc-tab.active { color: #fff; background: var(--blue-600); border-color: var(--blue-600); }

/* ── Panels ── */
.gc-panel { display: none; }
.gc-panel.active { display: block; }

/* ── Card ── */
.gc-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: 0 1px 4px rgba(13,21,38,0.04);
  margin-bottom: 1.25rem;
}
.gc-card h2 {
  font-family: var(--f-display);
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 0.2rem;
}
.gc-card .gc-sub {
  font-family: var(--f-sans);
  font-size: 0.88rem;
  color: var(--ink-3);
  margin: 0 0 1.25rem;
  line-height: 1.55;
}

/* ── Form fields ── */
.gc-field { margin-bottom: 1rem; }
.gc-field label {
  display: block;
  font-family: var(--f-sans);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.4rem;
}
.gc-field select,
.gc-field input[type=number],
.gc-field input[type=text] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-family: var(--f-sans);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
}
.gc-field select {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%235a718c' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.5rem;
}
.gc-field select:focus,
.gc-field input:focus {
  outline: none;
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* ── Primary button ── */
.gc-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--blue-600);
  color: #fff;
  border: none;
  border-radius: 9px;
  font-family: var(--f-sans);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.gc-btn:hover { background: var(--blue-700); box-shadow: 0 4px 14px rgba(29,80,202,0.25); }
.gc-btn:active { transform: scale(0.985); }

/* ── Result display ── */
.gc-result {
  margin-top: 1.15rem;
  padding: 1.15rem 1.25rem;
  border-radius: 12px;
  background: linear-gradient(135deg, #eefbf3 0%, #e6f9ed 100%);
  border: 1.5px solid #86efac;
  display: none;
  animation: gcFadeIn 0.3s ease;
}
.gc-result.error,
.gc-result.danger { background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%); border-color: #fca5a5; }
.gc-result.warn { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: #fcd34d; }
.gc-result .gc-rlabel {
  font-family: var(--f-sans);
  font-size: 0.7rem; font-weight: 700;
  color: #15803d;
  margin: 0 0 0.15rem;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.gc-result.error .gc-rlabel,
.gc-result.danger .gc-rlabel { color: #b91c1c; }
.gc-result.warn .gc-rlabel { color: #92400e; }
.gc-result .gc-rval {
  font-family: var(--f-display);
  font-size: 1.8rem; font-weight: 800;
  color: #15803d;
  margin: 0; line-height: 1.2;
}
.gc-result.error .gc-rval,
.gc-result.danger .gc-rval { color: #dc2626; font-size: 1rem; font-weight: 600; font-family: var(--f-sans); }
.gc-result.warn .gc-rval { color: #92400e; }
.gc-result .gc-rformula {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  color: #166534;
  margin: 0.4rem 0 0;
  opacity: 0.8;
  word-break: break-all;
}
.gc-result.error .gc-rformula { color: #991b1b; }
.gc-result .gc-rdetail {
  font-family: var(--f-sans);
  font-size: 0.85rem; color: #166534;
  margin: 0.5rem 0 0; line-height: 1.6;
}
.gc-result.warn .gc-rdetail { color: #78350f; }
.gc-result.danger .gc-rdetail { color: #991b1b; }
@keyframes gcFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Progress bar (attendance) ── */
.gc-pbar-wrap { margin-top: 0.85rem; background: var(--border); border-radius: 8px; height: 10px; overflow: hidden; }
.gc-pbar { height: 100%; border-radius: 8px; transition: width 0.4s ease, background 0.3s ease; min-width: 2%; }
.gc-pbar.safe { background: linear-gradient(90deg, #22c55e, #16a34a); }
.gc-pbar.warn { background: linear-gradient(90deg, #f59e0b, #d97706); }
.gc-pbar.danger { background: linear-gradient(90deg, #ef4444, #dc2626); }
.gc-pbar-label { display: flex; justify-content: space-between; margin-top: 0.25rem; font-size: 0.68rem; color: var(--ink-4); font-weight: 600; }

/* ── Grade table (exam marks) ── */
.gc-grade-tbl { width: 100%; border-collapse: collapse; font-size: 0.8rem; margin-top: 0.85rem; }
.gc-grade-tbl th {
  text-align: left; padding: 0.5rem 0.6rem; background: var(--off);
  color: var(--ink-3); font-weight: 700; border-bottom: 1px solid var(--border); font-size: 0.7rem;
}
.gc-grade-tbl td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--border-s); color: var(--ink-2); }
.gc-grade-tbl tr:last-child td { border-bottom: none; }
.gc-grade-tbl .pass { color: #15803d; font-weight: 700; }
.gc-grade-tbl .hard { color: #92400e; font-weight: 600; }
.gc-grade-tbl .impossible { color: #dc2626; text-decoration: line-through; opacity: 0.6; }

/* ── Source citation ── */
.gc-source {
  margin-top: 0.75rem;
  font-family: var(--f-sans);
  font-size: 0.7rem;
  color: var(--ink-4);
  line-height: 1.5;
}
.gc-source strong { color: var(--ink-3); }

/* ── Dynamic rows (SGPI→CGPI, GPA calc) ── */
.gc-dyn-header { display: grid; gap: 0.6rem; margin-bottom: 0.3rem; padding: 0 0.15rem; }
.gc-dyn-header span {
  font-family: var(--f-sans);
  font-size: 0.68rem; font-weight: 700;
  color: var(--ink-4);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.gc-dyn-row { display: grid; gap: 0.6rem; align-items: center; margin-bottom: 0.4rem; }
.gc-dyn-row .gc-rlbl { font-size: 0.75rem; color: var(--ink-3); font-weight: 700; text-align: center; }
.gc-dyn-row input {
  padding: 0.55rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: var(--f-sans);
  font-size: 0.88rem;
  background: var(--white);
  box-sizing: border-box; width: 100%;
  transition: border-color 0.2s;
}
.gc-dyn-row input:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.gc-2col { grid-template-columns: 44px 1fr 1fr; }
.gc-3col { grid-template-columns: 44px 1fr 1fr; }

/* ── Grade reference tables ── */
.gc-tables { margin-top: 2rem; }
.gc-tables h2 { font-family: var(--f-display); font-size: 1.35rem; font-weight: 800; color: var(--ink); margin: 0 0 1rem; }
.gc-tgrid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .gc-tgrid { grid-template-columns: 1fr 1fr; } }
.gc-tcard {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 1px 2px rgba(13,21,38,0.03);
}
.gc-tcard h3 { font-family: var(--f-sans); font-size: 0.85rem; font-weight: 700; color: var(--ink); margin: 0 0 0.65rem; }
.gc-tbl { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.gc-tbl th {
  text-align: left; padding: 0.5rem 0.55rem; background: var(--off);
  color: var(--ink-3); font-weight: 700; border-bottom: 1px solid var(--border); font-size: 0.7rem;
}
.gc-tbl td { padding: 0.4rem 0.55rem; border-bottom: 1px solid var(--border-s); color: var(--ink-2); }
.gc-tbl tr:last-child td { border-bottom: none; }
.gc-tbl .fail { color: #dc2626; }

/* ── FAQ ── */
.gc-faq { margin-top: 2rem; }
.gc-faq h2 { font-family: var(--f-display); font-size: 1.35rem; font-weight: 800; color: var(--ink); margin: 0 0 0.85rem; }
.gc-faq-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}
.gc-faq-q {
  padding: 0.9rem 1.15rem;
  font-family: var(--f-sans);
  font-size: 0.88rem; font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  user-select: none; -webkit-tap-highlight-color: transparent;
}
.gc-faq-q::after { content: '+'; font-size: 1.1rem; color: var(--ink-4); font-weight: 400; transition: transform 0.2s; }
.gc-faq-item.open .gc-faq-q::after { content: '\2212'; }
.gc-faq-a { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.gc-faq-item.open .gc-faq-a { max-height: 500px; }
.gc-faq-a p {
  padding: 0 1.15rem 0.9rem;
  font-family: var(--f-sans);
  font-size: 0.85rem;
  color: var(--ink-2);
  margin: 0; line-height: 1.7;
}

/* ── Sources ── */
.gc-sources {
  margin-top: 1.5rem;
  padding: 1.15rem;
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.gc-sources h2 { font-family: var(--f-sans); font-size: 0.9rem; font-weight: 700; color: var(--ink); margin: 0 0 0.65rem; }
.gc-sources ul { margin: 0; padding: 0 0 0 1.15rem; font-size: 0.8rem; color: var(--ink-3); line-height: 1.7; }

/* ── Internal links (cross-linking) ── */
.gc-links {
  margin-top: 1.25rem;
  padding: 1.15rem;
  background: var(--blue-50);
  border: 1px solid var(--blue-200);
  border-radius: 10px;
}
.gc-links h3 { font-family: var(--f-sans); font-size: 0.85rem; font-weight: 700; color: var(--blue-800); margin: 0 0 0.6rem; }
.gc-links a {
  display: inline-block;
  padding: 0.4rem 0.85rem;
  margin: 0.2rem;
  background: var(--white);
  border: 1px solid var(--blue-200);
  border-radius: 7px;
  font-family: var(--f-sans);
  font-size: 0.8rem; font-weight: 600;
  color: var(--blue-600);
  text-decoration: none;
  transition: all 0.15s;
}
.gc-links a:hover { background: var(--blue-100); border-color: var(--blue-300); }

/* ── Explainer section ── */
.gc-explainer { margin-top: 2rem; }
.gc-explainer p {
  font-family: var(--f-sans);
  font-size: 0.95rem;
  color: var(--ink-2);
  line-height: 1.8;
  margin: 0 0 0.85rem;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .gc-page { padding: 0 0.85rem; }
  .gc-main { padding-bottom: 2rem; }
  .gc-hero { padding: 1.5rem 0 1rem; }
  .gc-hero h1 { font-size: 1.55rem; }
  .gc-hero p { font-size: 0.9rem; }
  .gc-tabs-wrap { margin: 0 -0.85rem; }
  .gc-tabs-wrap::after { width: 1.5rem; }
  .gc-tabs { padding: 0 0.85rem 0.65rem; }
  .gc-tab { padding: 0.45rem 0.9rem; font-size: 0.76rem; }
  .gc-card { padding: 1.25rem 1.1rem; border-radius: 12px; }
  .gc-card h2 { font-size: 1.2rem; }
  .gc-field input,
  .gc-field select { padding: 0.75rem 0.9rem; font-size: 0.95rem; }
  .gc-btn { padding: 0.85rem; font-size: 0.95rem; }
  .gc-result .gc-rval { font-size: 1.5rem; }
  .gc-tgrid { grid-template-columns: 1fr; }
  .gc-dyn-row input { padding: 0.6rem 0.5rem; font-size: 0.85rem; }
}
