﻿:root {
  --page-bg: #eff4ee;
  --page-bg-deep: #e3ece3;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.82);
  --text: #173025;
  --text-soft: #57685f;
  --green: #0f5f3b;
  --green-deep: #0c3f29;
  --green-soft: #d9eee1;
  --gold: #c9a45c;
  --border: rgba(15, 95, 59, 0.12);
  --shadow: 0 24px 60px rgba(8, 45, 29, 0.12);
  --shadow-soft: 0 14px 34px rgba(8, 45, 29, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-pill: 999px;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(201, 164, 92, 0.14), transparent 22%),
    radial-gradient(circle at bottom right, rgba(15, 95, 59, 0.08), transparent 24%),
    linear-gradient(180deg, var(--page-bg), var(--page-bg-deep));
}

img {
  display: block;
  max-width: 100%;
}

select,
button {
  font: inherit;
}

.resultShell {
  width: min(1180px, calc(100% - 1rem));
  margin: 0 auto;
  padding: 1rem 0 2rem;
}

.resultHero,
.resultLookup,
.resultStatus,
.resultCanvas {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.resultHero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, rgba(12, 44, 30, 0.95), rgba(14, 74, 47, 0.92));
  color: #f7f3e8;
}

.resultHero__pattern {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1), transparent 18%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 40%);
  pointer-events: none;
}

.resultHero__brand {
  position: relative;
  z-index: 1;
  width: clamp(88px, 10vw, 118px);
  padding: 0.8rem;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(255, 248, 231, 0.96), rgba(214, 231, 220, 0.92));
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
}

.resultHero__content {
  position: relative;
  z-index: 1;
}

.resultHero__eyebrow,
.lookupBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.resultHero__eyebrow {
  background: rgba(244, 231, 194, 0.14);
  border: 1px solid rgba(244, 231, 194, 0.24);
  color: #f4e7c2;
}

.resultHero h1,
.resultLookup h2,
.resultStatus h3 {
  margin: 0;
  font-family: "Cormorant Garamond", serif;
}

.resultHero h1 {
  margin-top: 0.7rem;
  font-size: clamp(2rem, 3.6vw, 3.3rem);
  color: #fff8ea;
}

.resultHero p,
.resultLookup p,
.resultStatus p {
  margin: 0;
  color: rgba(247, 243, 232, 0.9);
  line-height: 1.75;
}

.resultHero p {
  max-width: 44rem;
  margin-top: 0.55rem;
}

.resultLookup,
.resultStatus,
.resultCanvas {
  margin-top: 1.2rem;
  background: linear-gradient(180deg, var(--surface), var(--surface-soft));
}

.resultLookup {
  padding: 1.3rem;
}

.resultLookup__intro {
  display: grid;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.lookupBadge {
  width: fit-content;
  background: rgba(15, 95, 59, 0.08);
  color: var(--green);
  border: 1px solid rgba(15, 95, 59, 0.12);
}

.resultLookup h2 {
  font-size: clamp(1.8rem, 2.6vw, 2.5rem);
  color: var(--text);
}

.resultLookup p,
.resultStatus p {
  color: var(--text-soft);
}

.resultFilters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.filterField {
  display: grid;
  gap: 0.55rem;
}

.filterField label {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text);
}

.selectShell {
  position: relative;
}

.selectShell::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 1rem;
  width: 12px;
  height: 12px;
  border-right: 2px solid var(--green);
  border-bottom: 2px solid var(--green);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.selectShell select {
  width: 100%;
  min-height: 58px;
  padding: 0.95rem 3rem 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 246, 240, 0.95));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
  color: var(--text);
  appearance: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.selectShell select:focus {
  outline: none;
  border-color: rgba(15, 95, 59, 0.36);
  box-shadow: 0 0 0 4px rgba(15, 95, 59, 0.12);
}

.resultStatus {
  padding: 1rem 1.2rem;
}

.resultStatus__card {
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  background: rgba(15, 95, 59, 0.04);
  border: 1px dashed rgba(15, 95, 59, 0.2);
}

.resultStatus h3 {
  font-size: 1.55rem;
  color: var(--text);
}

.resultCanvas {
  padding: 1.1rem;
}

.result-container {
  display: grid;
  justify-content: center;
  
}

.result-card {
  width: 100%;
  max-width: 760px;
  background: #fff;
  border: 3px solid #1a5c2a;
  border-radius: 12px;
  padding: 0;
  position: relative;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.12);
  overflow: hidden;
}

.card-header {
  background: linear-gradient(180deg, #0a3d1a 0%, #1a5c2a 100%);
  color: #fff;
  text-align: center;
  padding: 14px 12px;
  position: relative;
}

.print-area {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.16);
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease;
}

.print-area:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.2);
}

.print-area img {
  width: 20px;
  height: 20px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

@media (min-width: 48em) {
  .card-header {
    width: 700px;
  }
  
}

.card-header::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 20px;
  right: 20px;
  height: 20px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.15) 0%, transparent 70%);
}

.card-header h2 {
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.5px;
  opacity: 0.9;
  margin-bottom: 2px;
}

.card-header h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 1px;
}

.print-area {
  position: absolute;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 6px;
}

.print-area img {
  width: 32px;
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #1a5c2a;
  font-weight: bold;
}

.w-ornament {
  color: #ffd700;
  font-size: 18px;
  letter-spacing: 3px;
}

.student-info {
  text-align: center;
  padding: 18px 20px 8px;
  background: #f7faf5;
}

.student-name {
  font-size: 28px;
  font-weight: 700;
  color: #1a3a1a;
  margin-bottom: 4px;
}

.student-roll {
  font-size: 15px;
  color: #4a6741;
  background: #e8f5e9;
  display: inline-block;
  padding: 4px 18px;
  border-radius: 20px;
  font-weight: 600;
}

.result-summary {
  display: flex;
  justify-content: space-around;
  padding: 10px 12px 14px;
  background: #f7faf5;
  gap: 8px;
  flex-wrap: wrap;
}

.summary-box {
  flex: 1 1 auto;
  min-width: 90px;
  background: #fff;
  border: 2px solid #d4e7d0;
  border-radius: 10px;
  padding: 10px 6px;
  text-align: center;
}

.summary-label {
  font-size: 11px;
  color: #666;
  margin-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.summary-value {
  font-size: 22px;
  font-weight: 700;
  color: #1a3a1a;
}

.summary-box.grade-box {
  background: linear-gradient(135deg, #1a5c2a, #0a4a15);
  color: #fff;
  border-color: #1a5c2a;
}

.summary-box.grade-box .summary-label {
  color: #ffd700;
}

.summary-box.grade-box .summary-value {
  color: #ffd700;
  font-size: 20px;
}

.summary-box.rank-box {
  background: #fffdf0;
  border-color: #e6c200;
}

.summary-box.rank-box .summary-value {
  color: #b8860b;
}

.marks-table-wrap {
  padding: 0 16px 8px;
  text-align: center;
}

.marks-table-wrap h3 {
  font-size: 15px;
  color: #1a5c2a;
  margin-bottom: 8px;
  font-weight: 600;
  background: #e8f5e9;
  display: inline-block;
  padding: 4px 20px;
  border-radius: 15px;
}

.marks-table {
  width: calc(100% - 32px);
  margin: 8px 16px;
  border-collapse: collapse;
  font-size: 14px;
}

.marks-table thead th {
  background: #1a5c2a;
  color: #fff;
  padding: 10px 8px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.5px;
}

.marks-table thead th:first-child {
  border-radius: 8px 0 0 0;
  text-align: left;
  padding-left: 16px;
}

.marks-table thead th:last-child {
  border-radius: 0 8px 0 0;
  text-align: center;
}

.marks-table tbody td {
  padding: 10px 8px;
  border-bottom: 1px solid #e0e8da;
  font-size: 14px;
  color: #333;
  text-align: center;
}

.marks-table tbody td:first-child {
  text-align: left;
  padding-left: 16px;
  font-weight: 500;
  color: #1a3a1a;
}

.marks-table tbody tr:nth-child(even) {
  background: #f9fcf7;
}

.marks-table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}

.marks-table tbody tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}

.marks-table tbody tr.total-row {
  background: #e8f0e0;
  font-weight: 700;
  font-size: 15px;
  border-top: 2px solid #1a5c2a;
}

.marks-table tbody tr.total-row td {
  color: #1a5c2a;
  font-weight: 700;
}

.marks-table tbody tr.avg-row {
  background: #f2f7ed;
  font-weight: 600;
}

.marks-table tbody tr.avg-row td {
  color: #2e5a2e;
}

.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 80px;
  color: rgba(26, 92, 42, 0.03);
  font-weight: 900;
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 10px;
}

.card-footer {
  text-align: center;
  padding: 12px;
  font-size: 11px;
  color: #888;
  border-top: 1px solid #e0e8da;
  margin: 0 16px;
}

.grade-arabic {
  font-family: "Traditional Arabic", "KFGQPC Uthman Taha Naskh", serif;
  font-size: 24px;
}

.print-area {
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  gap: 0;
}

.print-area img {
  width: 20px;
  height: 20px;
}

@media (max-width: 64em) {
  .resultFilters {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 48em) {
  .resultShell {
    width: min(100% - 0.5rem, 100%);
    padding-top: 0.5rem;
  }

  .resultHero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 1rem;
  }

  .resultHero,
  .resultLookup,
  .resultStatus,
  .resultCanvas {
    border-radius: 22px;
  }

  .resultHero,
  .resultLookup,
  .resultCanvas {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .resultLookup {
    padding-top: 1.1rem;
    padding-bottom: 1.1rem;
  }

  .resultStatus {
    padding: 0.9rem;
  }

  .resultCanvas {
    padding: 0.8rem;
  }

  .resultCard,
  .result-card {
    max-width: 100%;
  }

  .student-name {
    font-size: 23px;
  }

  .marks-table {
    width: calc(100% - 16px);
    margin: 8px;
    font-size: 13px;
  }

  .marks-table tbody td,
  .marks-table thead th {
    padding: 8px 6px;
  }

  .summary-box {
    min-width: calc(50% - 8px);
  }
}

@media print {
  @page {
    size: auto;
    margin: 10mm;
  }

  html,
  body {
    width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    background: white;
  }

  body * {
    visibility: hidden !important;
  }

  .resultCanvas,
  .resultCanvas *,
  .result-container,
  .result-container *,
  .result-card,
  .result-card * {
    visibility: visible !important;
  }

  .resultShell,
  .resultCanvas,
  .result-container {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: white !important;
  }

  .resultCanvas {
    position: static !important;
    overflow: visible !important;
  }

  .result-container {
    display: block !important;
  }

  .result-card {
    width: 100% !important;
    max-width: none !important;
    margin: 0 auto !important;
    box-shadow: none !important;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-area,
  .resultHero,
  .resultLookup,
  .resultStatus {
    display: none !important;
  }

  .marks-table {
    width: 100% !important;
    margin: 8px 0 0 !important;
  }

  .marks-table-wrap {
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .card-header::after {
    display: none !important;
  }
}


.resultStatus__card {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border-radius: 12px;
  background: #fff;
  transition: all 0.3s ease;
}

/* Loading state */
.resultStatus__card.loading {
  background: #f5f5f5;
}

/* shimmer overlay */
.resultStatus__card.loading::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 150%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgb(244 231 194),
    transparent
  );
  animation: shimmer 2s infinite;
  pointer-events: none;
}

/* keep text visible */
.resultStatus__card.loading h3,
.resultStatus__card.loading p {
  position: relative;
  z-index: 1;
}

@keyframes shimmer {
  0% {
    left: -150%;
  }
  100% {
    left: 100%;
  }
}


