/* ============================================
   SAT Diagnostic — Theme & Design System
   Matches tutoringwithsruthi branding
   ============================================ */

/* --- Variables --- */
:root {
  --white: #FFFFFF;
  --sage-l: #D0D6B3;
  --sage: #9BA06A;
  --sage-m: #e4e8cc;
  --slate: #525B76;
  --forest: #143109;
  --bg: #f5f6ee;
  --error: #dc3545;
  --error-bg: #fef2f2;
  --success: #2d6a30;
  --success-bg: #d1fae5;
  --fh: 'Young Serif', Georgia, serif;
  --fp: 'Dosis', 'Trebuchet MS', Arial, sans-serif;
  --fb: 'Bitter', Georgia, serif;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(20,49,9,0.06);
  --shadow-lg: 0 8px 32px rgba(82,91,118,0.15);
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  font-family: var(--fp);
  color: var(--forest);
  padding: 0;
  overflow-x: hidden;
  min-height: 100vh;
}

/* --- Typography --- */
h1, h2, h3 { font-family: var(--fh); color: var(--forest); }
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }

.text-body { font-family: var(--fp); font-size: 1.02rem; color: var(--forest); line-height: 1.7; }
.text-label { font-family: var(--fb); font-size: 0.88rem; color: var(--slate); }
.text-small { font-size: 0.82rem; color: var(--slate); }
.text-center { text-align: center; }

/* --- Layout --- */
.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 52px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-wide {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 52px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* --- Header --- */
.pg-head {
  background: var(--sage-m);
  border: 2px solid var(--sage-l);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
}
.pg-head h1 { margin-bottom: 6px; }
.pg-head p { color: var(--slate); font-family: var(--fp); font-size: 1rem; }

.pg-head-gradient {
  background: linear-gradient(135deg, #525B76, #143109);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: var(--white);
  text-align: center;
}
.pg-head-gradient h1 { color: var(--white); margin-bottom: 6px; }
.pg-head-gradient p { color: var(--sage-l); }

/* --- Cards --- */
.card {
  background: var(--white);
  border: 2px solid var(--sage-l);
  border-radius: var(--radius-lg);
  padding: 28px 26px;
  box-shadow: var(--shadow);
}
.card-title {
  font-family: var(--fh);
  font-size: 1.35rem;
  color: var(--forest);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title .icon { font-size: 1.4rem; }

.card-flat {
  background: var(--white);
  border: 2px solid var(--sage-l);
  border-radius: var(--radius-md);
  padding: 20px;
}

/* --- Buttons --- */
.btn {
  font-family: var(--fp);
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  border-radius: 30px;
  padding: 11px 24px;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, opacity 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--sage); color: var(--white); }
.btn-primary:hover { background: var(--forest); }

.btn-dark { background: linear-gradient(135deg, #525B76, #143109); color: var(--white); }
.btn-dark:hover { opacity: 0.9; }

.btn-secondary { background: var(--white); color: var(--forest); border: 2px solid var(--sage-l); }
.btn-secondary:hover { background: var(--sage-m); }

.btn-ghost { background: transparent; color: var(--sage); border: none; padding: 8px 16px; }
.btn-ghost:hover { background: var(--sage-m); }

.btn-sm { font-size: 0.85rem; padding: 7px 16px; }
.btn-lg { font-size: 1.05rem; padding: 14px 28px; }
.btn-full { width: 100%; justify-content: center; }

/* --- Form Elements --- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-family: var(--fp);
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 6px;
  font-size: 0.95rem;
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--sage-l);
  border-radius: var(--radius-md);
  font-family: var(--fp);
  font-size: 1rem;
  color: var(--forest);
  background: var(--white);
  transition: border-color 0.18s;
}
.form-input:focus { outline: none; border-color: var(--sage); }
.form-input::placeholder { color: #aaa; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-radio-group { display: flex; gap: 20px; margin-top: 6px; }
.form-radio-group label {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-weight: 600; color: var(--forest); margin-bottom: 0;
}
.form-radio-group input[type="radio"] { width: 18px; height: 18px; accent-color: var(--sage); }

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

/* --- Badges --- */
.badge {
  display: inline-block;
  font-family: var(--fp);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 4px 12px;
  border-radius: 99px;
}
.badge-math { background: var(--slate); color: var(--white); }
.badge-english { background: var(--sage); color: var(--white); }
.badge-full { background: linear-gradient(135deg, #525B76, #143109); color: var(--white); }
.badge-topic { background: var(--sage-m); color: var(--forest); border: 1px solid var(--sage-l); }
.badge-free { background: #fef3cd; color: #856404; }
.badge-status { background: var(--sage-m); color: var(--forest); }
.badge-due { background: var(--error-bg); color: var(--error); }

/* --- Tabs --- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab {
  font-family: var(--fp);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 20px;
  border: 2px solid var(--sage-l);
  border-radius: 30px;
  cursor: pointer;
  background: var(--white);
  color: var(--slate);
  transition: all 0.18s;
}
.tab:hover { background: var(--sage-m); }
.tab.active { background: var(--sage); color: var(--white); border-color: var(--sage); }

/* --- Tables --- */
.table-wrap { overflow-x: auto; margin: 12px 0; }
table.sat-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--fp);
  font-size: 0.92rem;
}
table.sat-table thead th {
  background: var(--slate);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 0.85rem;
}
table.sat-table thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
table.sat-table thead th:last-child { border-radius: 0 var(--radius-sm) 0 0; }
table.sat-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--sage-l);
  color: var(--forest);
}
table.sat-table tbody tr:nth-child(even) { background: #f9faf4; }
table.sat-table tbody tr:hover { background: var(--sage-m); }

/* --- Highlight / Info Boxes --- */
.highlight-box {
  background: var(--sage-m);
  border: 2px solid var(--sage-l);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 12px 0;
}

.info-box {
  background: linear-gradient(135deg, #D0D6B3, #9BA06A);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  margin: 12px 0;
}
.info-box h3 { color: var(--forest); margin-bottom: 8px; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  margin: 10px 0;
}
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid #fca5a5; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #86efac; }

/* --- Progress Bar --- */
.progress { width: 100%; height: 8px; background: var(--sage-l); border-radius: 99px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--sage), var(--slate));
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* --- Tooltip (CSS only) --- */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--forest);
  color: var(--white);
  font-family: var(--fp);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
}

/* --- Score Display --- */
.score-card {
  text-align: center;
  padding: 24px;
  border-radius: var(--radius-lg);
}
.score-card.composite {
  background: linear-gradient(135deg, var(--sage-l), var(--sage));
}
.score-card.section {
  background: var(--white);
  border: 2px solid var(--sage-l);
}
.score-val {
  font-size: 2.5rem;
  font-weight: 800;
  font-family: var(--fp);
}
.score-val.composite { font-size: 3rem; color: var(--forest); }
.score-val.math { color: var(--slate); }
.score-val.english { color: var(--sage); }
.score-label { font-weight: 600; color: var(--forest); font-size: 0.92rem; margin-top: 4px; }
.score-detail { font-size: 0.82rem; color: var(--slate); margin-top: 2px; }

.scores-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* --- Expandable Rows --- */
.expand-row { cursor: pointer; }
.expand-row td:first-child::before {
  content: '\25B6';
  display: inline-block;
  margin-right: 8px;
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.expand-row.open td:first-child::before { transform: rotate(90deg); }
.expand-content { display: none; }
.expand-content.show { display: table-row; }
.expand-content td { padding-left: 36px !important; background: #f9faf4; }

/* --- Loading / Spinner --- */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--sage-l);
  border-top-color: var(--sage);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(245,246,238,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease; }

/* --- Utility --- */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 24px; }
.mb-sm { margin-bottom: 8px; }
.mb-md { margin-bottom: 16px; }

/* --- Footer --- */
.footer {
  text-align: center;
  font-family: var(--fb);
  font-size: 0.82rem;
  color: var(--slate);
  padding: 18px 0 0;
}

/* --- Responsive --- */
@media (max-width: 600px) {
  .page, .page-wide { padding: 16px 12px 40px; }
  .pg-head { padding: 24px 16px; }
  .pg-head h1 { font-size: 1.5rem; }
  .card { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .scores-grid { grid-template-columns: 1fr; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
}
