/* Student dashboard — modern app shell (desktop rail + mobile bottom tabs) */

body.student-app {
  min-height: 100dvh;
  padding-bottom: 0;
  background:
    radial-gradient(ellipse 90% 60% at 10% -10%, rgba(0, 174, 239, 0.1), transparent 50%),
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(27, 74, 156, 0.08), transparent 45%),
    var(--bg-dark, #f4f7fb);
}

body.student-app .navbar,
body.student-app > .dashboard-layout {
  display: none !important;
}

.sd-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem max(1rem, env(safe-area-inset-right)) 0.7rem max(1rem, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(15, 47, 109, 0.06);
}

.sd-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  flex: 1;
}

.sd-logo {
  display: block;
  width: 64px;
  height: 64px;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  border-radius: 12px;
  background: #fff url('../images/logo1.png?v=5') center / contain no-repeat;
  text-indent: -9999px;
  overflow: hidden;
  box-shadow: none;
  border: none;
}

.sd-brand-mark {
  display: none;
}

.sd-brand-text {
  min-width: 0;
}

.sd-brand-text strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-brand-text span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sd-top-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.sd-icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.sd-icon-btn:hover,
.sd-icon-btn:focus-visible {
  border-color: var(--border-glow);
  background: rgba(27, 74, 156, 0.12);
  outline: none;
}

.sd-icon-btn .sd-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #35d0f5;
  box-shadow: 0 0 0 2px rgba(12, 18, 32, 0.9);
  display: none;
}

.sd-icon-btn.has-alerts .sd-dot { display: block; }

.sd-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-glow);
  background: linear-gradient(145deg, rgba(27, 74, 156, 0.35), rgba(0, 174, 239, 0.25));
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.sd-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.45rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.sd-logout-btn:hover,
.sd-logout-btn:focus-visible {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
  outline: none;
}

/* Profile view / edit */
.profile-card:not(.is-editing) .form-control {
  background: rgba(255, 255, 255, 0.03);
  border-color: transparent;
  color: var(--text);
  cursor: default;
  box-shadow: none;
  opacity: 1;
  -webkit-text-fill-color: var(--text);
}

.profile-card:not(.is-editing) select.form-control {
  appearance: none;
  pointer-events: none;
  background-image: none;
  padding-right: 0.85rem;
}

.profile-card.is-editing .form-control[readonly] {
  opacity: 0.75;
  cursor: default;
}

.profile-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.profile-form-actions[hidden] {
  display: none !important;
}

.profile-edit-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 0.35rem;
}

.profile-edit-btn[hidden] {
  display: none !important;
}

.profile-form-actions .btn {
  width: 100%;
  min-height: 44px;
}

@media (max-width: 900px) {
  .profile-form-actions {
    grid-template-columns: 1fr;
  }

  .profile-form-actions[hidden] {
    display: none !important;
  }
}

.sd-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: calc(100dvh - 58px);
  max-width: 1280px;
  margin: 0 auto;
}

.sd-rail {
  padding: 1.1rem 0.85rem 1.5rem;
  border-right: 1px solid var(--border);
  background: rgba(14, 20, 34, 0.55);
  position: sticky;
  top: 58px;
  height: calc(100dvh - 58px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.sd-rail-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.35rem 0.75rem 0.55rem;
  font-weight: 600;
}

.sd-rail a,
.sd-rail button.sd-rail-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.2rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.sd-rail a i,
.sd-rail button.sd-rail-link i {
  width: 1.15rem;
  text-align: center;
  opacity: 0.9;
}

.sd-rail a:hover,
.sd-rail button.sd-rail-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.sd-rail a.active,
.sd-rail button.sd-rail-link.active {
  color: #fff;
  background: rgba(27, 74, 156, 0.16);
  border-color: rgba(27, 74, 156, 0.28);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.08);
}

.sd-rail-divider {
  height: 1px;
  background: var(--border);
  margin: 0.65rem 0.5rem;
}

.sd-main {
  padding: 1.25rem 1.5rem 2rem;
  min-width: 0;
}

.sd-main .dash-section {
  display: none;
  animation: sdFadeUp 0.28s ease;
}

.sd-main .dash-section.active {
  display: block;
}

@keyframes sdFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Home hero */
.sd-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.15rem;
  border-radius: 20px;
  border: 1px solid rgba(27, 74, 156, 0.25);
  background:
    radial-gradient(ellipse 80% 120% at 100% 0%, rgba(0, 174, 239, 0.18), transparent 50%),
    radial-gradient(ellipse 70% 100% at 0% 100%, rgba(27, 74, 156, 0.2), transparent 55%),
    rgba(22, 32, 52, 0.72);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.sd-hero h1 {
  font-size: clamp(1.35rem, 3.5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.sd-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.sd-band-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(34, 211, 238, 0.28);
  text-align: center;
}

.sd-band-pill em {
  font-style: normal;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  font-weight: 600;
}

.sd-band-pill strong {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 800;
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
}

.sd-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.sd-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 1rem 0.95rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
  min-height: 96px;
}

.sd-action:hover {
  border-color: var(--border-glow);
  background: rgba(27, 74, 156, 0.1);
  transform: translateY(-2px);
}

.sd-action i {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(0, 174, 239, 0.14);
  color: var(--accent-2);
  font-size: 0.95rem;
}

.sd-action span {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.25;
}

.sd-kpi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.sd-kpi .kpi-card {
  padding: 1rem 1.05rem;
  border-radius: 14px;
}

.sd-kpi .kpi-card strong {
  font-size: 1.45rem;
}

.sd-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.sd-section-head h1 {
  font-size: clamp(1.25rem, 3.5vw, 1.55rem);
  margin: 0;
}

.sd-section-head p {
  margin: 0.35rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  width: 100%;
}

/* Bottom tab bar (mobile) */
.sd-bottom {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  padding: 0.4rem 0.35rem max(0.45rem, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 20px rgba(15, 47, 109, 0.06);
  grid-template-columns: repeat(5, 1fr);
  gap: 0.15rem;
}

.sd-bottom a,
.sd-bottom button {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 52px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  padding: 0.35rem 0.2rem;
}

.sd-bottom i {
  font-size: 1.1rem;
}

.sd-bottom a.active,
.sd-bottom button.active {
  color: #fff;
  background: rgba(27, 74, 156, 0.16);
}

.sd-bottom a.active i,
.sd-bottom button.active i {
  color: var(--accent-2);
}

/* More sheet */
.sd-sheet-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.55);
}

.sd-sheet-backdrop.open { display: block; }

.sd-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 110;
  max-height: min(78dvh, 560px);
  padding: 0.65rem 1rem max(1.25rem, env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: #121a2a;
  border: 1px solid var(--border);
  border-bottom: 0;
  transform: translateY(110%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sd-sheet.open { transform: translateY(0); }

.sd-sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0.25rem auto 0.85rem;
}

.sd-sheet h3 {
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.sd-sheet-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
}

.sd-sheet a,
.sd-sheet button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.9rem 0.4rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  min-height: 84px;
  -webkit-tap-highlight-color: transparent;
}

.sd-sheet a i,
.sd-sheet button i {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(27, 74, 156, 0.14);
  color: var(--primary-light);
  font-size: 1rem;
}

.sd-sheet a.danger,
.sd-sheet button.danger {
  color: #fca5a5;
}

.sd-sheet a.danger i,
.sd-sheet button.danger i {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}

/* Mobile */
@media (max-width: 900px) {
  body.student-app {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .sd-shell {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .sd-rail { display: none; }

  .sd-main {
    padding: 1rem max(0.9rem, env(safe-area-inset-right)) 1.25rem max(0.9rem, env(safe-area-inset-left));
  }

  .sd-bottom { display: grid; }

  .sd-logo {
    width: 56px;
    height: 56px;
    border-radius: 10px;
  }

  .sd-logout-btn span {
    display: none;
  }

  .sd-logout-btn {
    width: 42px;
    justify-content: center;
    padding: 0;
  }

  .sd-hero {
    grid-template-columns: 1fr;
    gap: 0.85rem;
    padding: 1.1rem 1.05rem;
    border-radius: 18px;
  }

  .sd-band-pill {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    padding: 0.75rem 1rem;
  }

  .sd-band-pill strong {
    font-size: 1.45rem;
  }

  .sd-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
  }

  .sd-action {
    min-height: 88px;
    padding: 0.9rem 0.85rem;
  }

  .sd-action:active {
    transform: scale(0.98);
    background: rgba(27, 74, 156, 0.14);
  }

  .sd-kpi {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sd-kpi .kpi-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .dash-grid {
    grid-template-columns: 1fr !important;
  }

  .dash-panel {
    border-radius: 16px;
  }

  .projection-refresh-btn {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .form-card {
    max-width: none !important;
    padding: 1.15rem;
  }

  .form-control {
    font-size: 16px;
  }
}

@media (max-width: 380px) {
  .sd-logo {
    width: 52px;
    height: 52px;
  }

  .sd-brand-text strong {
    font-size: 0.88rem;
  }

  .sd-sheet-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sd-bottom a span,
  .sd-bottom button span {
    font-size: 0.58rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sd-main .dash-section,
  .sd-sheet,
  .sd-action {
    animation: none !important;
    transition: none !important;
  }
}
