/* Design tokens and shared colors */
:root {
  --ink: #1f1b16;
  --muted: #6d6156;
  --paper: #fbf7f2;
  --peach: #f4d3b8;
  --terracotta: #c26b4f;
  --navy: #1f3348;
  --sun: #f0b44a;
  --card: #fffdf9;
  --shadow: 0 18px 40px rgba(31, 27, 22, 0.12);
}

/* Consistent box model */
* {
  box-sizing: border-box;
}

/* Page baseline typography and background */
body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  color: var(--ink);
  background: radial-gradient(circle at top left, #fff3e7 0%, var(--paper) 55%, #f3ede3 100%);
  min-height: 100vh;
}

/* Subtle texture overlay */
.bg-texture {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(120deg, rgba(194, 107, 79, 0.08), rgba(31, 51, 72, 0.05)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><rect width='120' height='120' fill='none'/><circle cx='20' cy='20' r='1.2' fill='%23b59b86'/><circle cx='80' cy='60' r='1' fill='%239d8878'/><circle cx='60' cy='100' r='1.4' fill='%23c0a48c'/></svg>");
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}

/* Hero header layout */
header.hero {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 3.5rem 6vw 2.5rem;
  gap: 2rem;
}

/* Title block */
.hero-content h1 {
  font-size: clamp(2.4rem, 4vw, 4rem);
  margin: 0.2rem 0 0.4rem;
  letter-spacing: -0.02em;
}

/* Small top label */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.24em;
  font-size: 0.78rem;
  color: var(--navy);
  font-weight: 600;
  margin: 0;
}

/* Subtitle under the title */
.subtitle {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 36rem;
  margin: 0;
}

/* Data source chip in header */
.hero-chip {
  background: var(--card);
  border-radius: 999px;
  padding: 0.7rem 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Chip label text */
.chip-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* Chip value text */
.chip-value {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Main page spacing */
main {
  position: relative;
  z-index: 1;
  padding: 0 6vw 3rem;
}

/* Upload card wrapper at bottom */
.upload {
  margin-top: 2rem;
}

/* Upload card styling */
.upload-card {
  background: var(--card);
  border-radius: 1.25rem;
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 1rem;
}

/* Upload helper text */
.upload-subtitle {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Upload controls row */
.upload-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: center;
}

/* Keep file input font consistent */
.upload-controls input[type="file"] {
  font-family: inherit;
}

/* Upload action button */
.upload-controls button {
  border: none;
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  background: var(--navy);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}

/* Upload button disabled state */
.upload-controls button:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* Upload status line */
.upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Summary stat cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.2rem;
  margin-bottom: 2.5rem;
}

/* Individual stat card */
.card {
  background: var(--card);
  border-radius: 1.25rem;
  padding: 1.4rem 1.6rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

/* Decorative card highlight */
.card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% -20%;
  height: 120%;
  background: linear-gradient(120deg, rgba(240, 180, 74, 0.25), rgba(194, 107, 79, 0));
  transform: rotate(-8deg);
  opacity: 0.6;
}

/* Stat card label */
.card-label {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.95rem;
}

/* Stat card value */
.card-value {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
  position: relative;
  z-index: 1;
}

/* Filter controls container */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-end;
  background: var(--card);
  padding: 1.5rem;
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 2.5rem;
}

/* Filter label + input */
.control {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 200px;
  flex: 1;
  font-size: 0.95rem;
}

/* Inline checkbox control */
.control.inline {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  min-width: auto;
  flex: 0 0 auto;
}

/* Shared input styling */
input[type="search"],
select {
  padding: 0.6rem 0.8rem;
  border-radius: 0.8rem;
  border: 1px solid rgba(31, 27, 22, 0.15);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
}

/* Checkbox visual tuning */
input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--terracotta);
}

/* Table container card */
.table-section {
  background: var(--card);
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

/* Table header layout */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Header actions (count + PDF button) */
.table-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

/* Table title */
.table-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

/* Row count */
.table-header p {
  margin: 0;
  color: var(--muted);
}

/* Ghost button used for PDF action */
.ghost-button {
  border: 1px solid rgba(31, 27, 22, 0.2);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  background: transparent;
  color: var(--navy);
  font-size: 0.9rem;
  cursor: pointer;
}

/* Ghost button hover */
.ghost-button:hover {
  background: rgba(31, 51, 72, 0.08);
}

/* Horizontal scroll for narrow screens */
.table-wrap {
  overflow-x: auto;
}

/* Shared table cell styling */
th,
td {
  text-align: left;
  padding: 0.75rem 0.9rem;
  white-space: nowrap;
  border-bottom: 1px solid rgba(31, 27, 22, 0.08);
  font-size: 0.95rem;
}

/* Narrow columns with line breaks */
th.tight-header {
  white-space: normal;
  min-width: 90px;
}

/* Centered header text */
.center-header {
  text-align: center;
}

/* Centered table cell text */
td.welcome-cell {
  text-align: center;
}

/* Centered generic cell */
td.center-cell {
  text-align: center;
}

/* Time in Grade tag styling */
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  background: rgba(31, 51, 72, 0.08);
  color: var(--navy);
}

/* Base style for the check and X circle */
.flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.9rem;
  font-weight: 700;
}

/* Optional label spacing (unused by default) */
.flag-label {
  margin-left: 0.4rem;
}

/* Green check state */
.flag-ok {
  background: rgba(84, 162, 115, 0.18);
  color: #2f6b49;
}

/* Red X state */
.flag-missing {
  background: rgba(194, 107, 79, 0.18);
  color: #8b3b25;
}

/* Due soon tag */
.status-soon {
  background: rgba(240, 180, 74, 0.2);
  color: #7a4c00;
}

/* Overdue tag */
.status-overdue {
  background: rgba(194, 107, 79, 0.2);
  color: #8b3b25;
}

/* Table header typography */
th {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

/* Row hover feedback */
tbody tr:hover {
  background: rgba(240, 180, 74, 0.08);
}

/* Green highlight for "ready" rows */
tbody tr.row-complete {
  background: rgba(84, 162, 115, 0.16);
}

/* Stronger hover when highlighted */
tbody tr.row-complete:hover {
  background: rgba(84, 162, 115, 0.22);
}

/* Footer styling */
footer {
  padding: 2rem 6vw 3rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Medium screen layout tweaks */
@media (max-width: 900px) {
  header.hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-chip {
    align-self: flex-start;
  }
}

/* Small screen layout tweaks */
@media (max-width: 700px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control {
    min-width: auto;
  }
}

/* Simple entrance animation */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered animation for main sections */
.hero,
.cards,
.controls,
.table-section,
.upload {
  animation: fadeUp 0.8s ease both;
}

/* Slightly delayed entrance for each section */
.cards {
  animation-delay: 0.1s;
}

.controls {
  animation-delay: 0.2s;
}

.table-section {
  animation-delay: 0.3s;
}

.upload {
  animation-delay: 0.4s;
}
