/* ==========================================================================
   HEALTH SCIENCES PORTAL DESIGN SYSTEM (Responsive & Medical Theme)
   ========================================================================== */

:root {
  /* Medical Theme Palette */
  --primary-color: #0d9488;      /* Clean Teal */
  --primary-dark: #0f766e;       /* Deep Forest Teal */
  --primary-light: #ccfbf1;      /* Mint Accent */
  --bg-gradient-start: #f0fdfa;  /* Mint Ice base */
  --text-main: #1f2937;          /* Slate Dark */
  --text-muted: #6b7280;         /* Slate Neutral */
  --card-bg: rgba(255, 255, 255, 0.96);
  --border-color: #e5e7eb;
  
  /* System Feedback */
  --success: #16a34a;
  --error: #dc2626;
  --warning: #ea580c;
  
  /* Layout constraints */
  --radius-lg: 16px;
  --radius-md: 10px;
  --transition: all 0.25s ease-in-out;
}

/* Reset and Core Rules */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  background-color: #e6f4f1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
}

/* --- Slideshow Styling --- */
.bg-slideshow {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}
.bg-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 2s ease-in-out;
}
.bg-slide.active { opacity: 1; }

.bg-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.45), rgba(15, 23, 42, 0.75));
  z-index: -1;
}

/* --- Structural Portal Container --- */
.portal-container {
  width: 100%;
  max-width: 900px;
  padding: 20px;
  margin: 0 auto;
}

/* --- Card Bases (Glassmorphism Variant) --- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15), 
              0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.7);
  padding: 30px;
  width: 100%;
  transition: var(--transition);
}

.login-card {
  max-width: 480px;
  margin: 0 auto;
}

/* --- Typography & Headers --- */
.logo-box {
  text-align: center;
  margin-bottom: 25px;
}
.logo-box h2 {
  font-size: 1.6rem;
  color: var(--primary-dark);
  font-weight: 700;
  margin-top: 10px;
}
.logo-box .subtitle {
  font-size: 0.95rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.college-logo {
  max-width: 80px;
  height: auto;
  border-radius: 50%;
  border: 3px solid var(--primary-light);
}

/* --- Form Fields --- */
.form-group {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--primary-dark);
}
.form-group input, .select-wrap select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  background-color: #ffffff;
  transition: var(--transition);
}
.form-group input:focus, .select-wrap select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--primary-light);
}

/* Custom Select Dropdown Chevron */
.select-wrap {
  position: relative;
}
.select-wrap::after {
  content: '▼';
  font-size: 0.75rem;
  color: var(--primary-color);
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.select-wrap select {
  appearance: none;
  padding-right: 40px;
}

/* --- Interactive Action Elements --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  text-align: center;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(13, 148, 136, 0.42);
}
.btn-secondary {
  background-color: #f3f4f6;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover { background-color: #e5e7eb; }

.btn-danger {
  background-color: #fee2e2;
  color: var(--error);
  border: 1px solid #fca5a5;
}
.btn-danger:hover { background-color: #fca5a5; color: #ffffff; }

.card-footer-links {
  text-align: center;
  margin-top: 20px;
}
.back-link {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.back-link:hover { text-decoration: underline; }

/* --- Feedback Indicators --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  margin-top: 15px;
  font-weight: 500;
}
.error-alert {
  background-color: #fee2e2;
  color: var(--error);
  border-left: 4px solid var(--error);
}

.loading-spinner-wrap {
  text-align: center;
  margin-top: 15px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 4px solid var(--primary-light);
  border-top: 4px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- Results Section Styling --- */
.logo-box.compact {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 15px;
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 15px;
}
.logo-box.compact h2 { margin: 0; }
.college-logo-small {
  width: 55px;
  height: 55px;
  border-radius: 50%;
}
.tagline { font-size: 0.9rem; color: var(--text-muted); }

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0;
}
.action-buttons .btn { width: auto; flex: 1; min-width: 120px; padding: 10px 15px; font-size: 0.9rem; }

/* Student Profile Grid Layout */
.student-profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px;
  background-color: #f8fafc;
  padding: 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  margin-bottom: 25px;
}
.profile-item { font-size: 0.95rem; }
.profile-item strong { color: var(--primary-dark); }

/* --- Academic Tabular Layout --- */
.course-block { margin-top: 20px; }
.course-header h3 {
  font-size: 1.15rem;
  color: var(--primary-dark);
  margin-bottom: 12px;
  border-left: 4px solid var(--primary-color);
  padding-left: 8px;
}

.results-table-wrapper {
  width: 100%;
  overflow-x: auto; /* Fallback safe mobile responsiveness for wide rows */
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}
.results-table th {
  background-color: #f1f5f9;
  color: var(--text-main);
  font-weight: 600;
  padding: 12px 16px;
}
.results-table td {
  padding: 14px 16px;
  border-top: 1px solid var(--border-color);
}
.results-table tbody tr:hover { background-color: #f8fafc; }

/* Metrics Panels */
.metrics {
  margin-top: 15px;
  display: flex;
  justify-content: flex-end;
}
.metric {
  background: linear-gradient(135deg, var(--primary-light), #f0fdfa);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(13, 148, 136, 0.2);
  text-align: right;
}
.metric .label { font-size: 0.8rem; font-weight: 600; color: var(--primary-dark); uppercase; }
.metric .value { font-size: 1.4rem; font-weight: 700; color: var(--primary-dark); }

/* --- Responsive Media Queries --- */
@media (max-width: 640px) {
  .card { padding: 20px; }
  .logo-box.compact { flex-direction: column; text-align: center; }
  .action-buttons { flex-direction: column; }
  .action-buttons .btn { width: 100%; }
  .results-table th, .results-table td { padding: 10px 12px; font-size: 0.88rem; }
  .metric { width: 100%; text-align: center; }
}

/* --- Print Engine Rules --- */
@media print {
  body { background: white; color: black; }
  .bg-slideshow, .bg-overlay, .action-buttons, .filter-group, .card-footer-links { display: none !important; }
  .card { border: none !important; box-shadow: none !important; padding: 0 !important; background: transparent !important; }
  .results-table th { background-color: #e2e8f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}