/* ============================================================
   MOTHER TERESA PUBLIC SCHOOL — Results Dashboard Styles
   ============================================================ */

.results-page {
  background: var(--bg-light);
  min-height: 100vh;
  padding-top: var(--nav-height);
}

/* --- Search Screen --- */
.results-search-section {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  background: linear-gradient(135deg, #0B3C8A 0%, #072d6b 50%, #0f4aaa 100%);
  position: relative;
  overflow: hidden;
}

.results-search-section::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  border-radius: 50%;
  background: rgba(212,175,55,0.08);
  pointer-events: none;
}

.results-search-section::after {
  content: '';
  position: absolute;
  bottom: -150px;
  left: -150px;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: rgba(255,255,255,0.04);
  pointer-events: none;
}

.results-search-card {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-2xl);
  padding: var(--space-12) var(--space-10);
  width: 100%;
  max-width: 520px;
  text-align: center;
  position: relative;
  z-index: 2;
  box-shadow: 0 32px 64px rgba(0,0,0,0.3);
}

.search-logo {
  width: 80px;
  height: 80px;
  margin: 0 auto var(--space-6);
  border-radius: 50%;
  border: 3px solid var(--accent);
  box-shadow: 0 0 0 8px rgba(212,175,55,0.15);
  object-fit: cover;
}

.search-school-name {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-2);
}

.search-title {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 900;
  color: white;
  margin-bottom: var(--space-3);
}

.search-subtitle {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.65);
  line-height: 1.7;
  margin-bottom: var(--space-8);
}

.search-form {
  position: relative;
  margin-bottom: var(--space-4);
}

.search-input {
  width: 100%;
  padding: 1.1rem 1.4rem;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-xl);
  color: white;
  font-size: var(--text-lg);
  font-family: var(--font-heading);
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.08em;
  outline: none;
  transition: all var(--transition-base);
}

.search-input::placeholder { color: rgba(255,255,255,0.4); }
.search-input:focus {
  border-color: var(--accent);
  background: rgba(255,255,255,0.15);
  box-shadow: 0 0 0 4px rgba(212,175,55,0.2);
}

.search-hint {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  margin-bottom: var(--space-6);
}

.search-btn {
  width: 100%;
  padding: 1rem;
  background: var(--gradient-gold);
  color: var(--primary-dark);
  font-weight: 800;
  font-size: var(--text-base);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
  box-shadow: var(--shadow-gold);
  position: relative;
  overflow: hidden;
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(212,175,55,0.5);
}

.search-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.search-loader {
  display: none;
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(11,60,138,0.3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.search-error {
  background: rgba(239,68,68,0.15);
  border: 1px solid rgba(239,68,68,0.3);
  color: #fca5a5;
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  margin-top: var(--space-4);
  display: none;
}

.demo-rolls {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-6);
}

.demo-roll-btn {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.7);
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-base);
}

.demo-roll-btn:hover {
  background: rgba(212,175,55,0.15);
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Results Dashboard --- */
.results-dashboard {
  display: none;
  padding: var(--space-8) 0 var(--space-16);
  animation: fadeInUp 0.6s ease forwards;
}

.results-dashboard.visible { display: block; }

.results-header {
  background: var(--gradient-primary);
  padding: var(--space-8) 0;
  margin-bottom: var(--space-8);
}

.results-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.results-back-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: rgba(255,255,255,0.8);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-base);
  cursor: pointer;
}

.results-back-btn:hover { color: var(--accent); }

.results-year-badge {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 700;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
}

/* Student Profile Card */
.student-profile-card {
  background: var(--bg-white);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
  margin-bottom: var(--space-8);
  border: 1px solid var(--border-light);
}

.student-card-header {
  background: var(--gradient-primary);
  padding: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.student-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  box-shadow: 0 0 0 6px rgba(212,175,55,0.2);
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.student-info {
  flex: 1;
}

.student-name {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 900;
  color: white;
  margin-bottom: var(--space-2);
}

.student-meta-row {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.student-meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.75);
}

.student-meta-label {
  font-weight: 500;
}

.student-meta-value {
  font-weight: 700;
  color: var(--accent);
}

.student-rank-badge {
  background: var(--gradient-gold);
  color: var(--primary-dark);
  border-radius: var(--radius-xl);
  padding: var(--space-4) var(--space-6);
  text-align: center;
  flex-shrink: 0;
}

.student-rank-number {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: 900;
  display: block;
  line-height: 1;
}

.student-rank-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: var(--space-1);
}

/* Summary Cards */
.results-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-8);
}

.summary-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  text-align: center;
  transition: all var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.summary-card.blue::before { background: var(--gradient-primary); }
.summary-card.gold::before { background: var(--gradient-gold); }
.summary-card.green::before { background: linear-gradient(90deg, #10B981, #34D399); }
.summary-card.purple::before { background: linear-gradient(90deg, #7C3AED, #A78BFA); }

.summary-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

.summary-icon {
  font-size: 2rem;
  margin-bottom: var(--space-3);
  display: block;
}

.summary-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  font-weight: 900;
  color: var(--text-dark);
  margin-bottom: var(--space-2);
  line-height: 1;
}

.summary-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
}

/* Charts Layout */
.charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.chart-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
}

.chart-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chart-title span { color: var(--primary); }
.chart-canvas { width: 100% !important; }

/* Subject Table */
.subject-table-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.subject-table-header {
  background: var(--gradient-primary);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.subject-table-title {
  color: white;
  font-weight: 700;
  font-size: var(--text-base);
}

.subject-table-year {
  color: var(--accent);
  font-size: var(--text-sm);
  font-weight: 600;
}

table.results-table {
  width: 100%;
  border-collapse: collapse;
}

.results-table th {
  background: var(--bg-light);
  padding: var(--space-3) var(--space-5);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-medium);
  border-bottom: 1px solid var(--border);
}

.results-table td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-light);
  font-size: var(--text-sm);
  color: var(--text-dark);
  vertical-align: middle;
}

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

.results-table tr:hover td { background: var(--primary-50); }

.grade-badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
}

.grade-A { background: rgba(16,185,129,0.1); color: #059669; }
.grade-B { background: rgba(11,60,138,0.1); color: var(--primary); }
.grade-C { background: rgba(245,158,11,0.1); color: #D97706; }
.grade-D { background: rgba(239,68,68,0.1); color: var(--error); }

/* Score Bar */
.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.score-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.score-bar-fill.high { background: linear-gradient(90deg, #10B981, #34D399); }
.score-bar-fill.mid { background: linear-gradient(90deg, #3B82F6, #93C5FD); }
.score-bar-fill.low { background: linear-gradient(90deg, #F59E0B, #FCD34D); }

/* Circular Progress */
.circular-progress-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.circular-card {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-light);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.circular-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: var(--space-5);
}

.circular-progress-svg {
  width: 140px;
  height: 140px;
  transform: rotate(-90deg);
}

.circular-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}

.circular-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 408;
  stroke-dashoffset: 408;
  transition: stroke-dashoffset 1.5s ease;
}

.circular-fill.blue { stroke: url(#blueGrad); }
.circular-fill.green { stroke: url(#greenGrad); }

.circular-value {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: 900;
  fill: var(--text-dark);
}

.circular-sub {
  font-size: 10px;
  fill: var(--text-light);
  font-weight: 500;
}

/* Attendance Log */
.attendance-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: var(--space-4);
}

.att-cell {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 3px;
}

.att-present { background: var(--success); opacity: 0.8; }
.att-absent { background: var(--error); opacity: 0.6; }
.att-holiday { background: var(--border); }

/* Print Button */
.print-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.7rem 1.5rem;
  background: var(--bg-white);
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-base);
  cursor: pointer;
}

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

/* Responsive */
@media (max-width: 768px) {
  .results-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .circular-progress-row { grid-template-columns: 1fr; }
  .student-card-header { flex-direction: column; align-items: flex-start; }
  .results-search-card { padding: var(--space-8) var(--space-6); }
  .results-table th, .results-table td { padding: var(--space-3); }
}

@media (max-width: 480px) {
  .results-summary-grid { grid-template-columns: 1fr 1fr; }
  .student-meta-row { flex-direction: column; gap: var(--space-2); }
}

@media print {
  .results-search-section, .results-header, .print-btn, .results-back-btn { display: none !important; }
  .results-dashboard { display: block !important; }
  body { background: white; }
}
