/* App shell and page styles: calculator, dashboard, academic records and transcripts. */

:root {
  --primary: #1a365d;
  --accent: #2b6cb0;
  --accent-light: #2f78c711;
  --bg: #f7fafc;
  --card-bg: #ffffff;
  --text-main: #2d3748;
  --text-light: #5a6b82;
  --border: #e2e8f0;
  --sidebar-bg: #ffffff;
  --radius: 8px;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.dark-mode {
  --bg: #0f172a;
  --card-bg: #1e293b;
  --sidebar-bg: #1e293b;
  --text-main: #ffffff;
  --text-light: #94a3b8;
  --border: #334155;
  --primary: #3182ce;
  --shadow: none;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: "Inter", system-ui, sans-serif;
}

body {
  background-color: var(--bg);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px;
  transition: background 0.3s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  color: var(--primary);
}

.logo-icon {
  font-size: 1.8rem;
  text-align: center;
}

.logo-text {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
}

.nav-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 12px;
  margin-top: 24px;
  letter-spacing: 0.05em;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  text-decoration: none;
  color: var(--text-light);
  border-radius: var(--radius);
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav-item:hover {
  background-color: var(--bg);
  color: var(--primary);
}

.nav-item.active {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* Utility nav entries are buttons (they open the feedback dialog, not a page). */
.nav-item-button {
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  font-family: inherit;
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.user-mini-profile {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.avatar {
  width: 36px;
  height: 36px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
}

.user-info {
  flex: 1;
}

.user-info .name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.user-info .role {
  display: block;
  font-size: 0.75rem;
  color: var(--text-light);
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 1.2rem;
}

.main-content {
  overflow-y: auto;
  padding: 32px 40px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding: 1rem 0;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.actions {
  display: flex;
  gap: 12px;
}

button {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition: 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  border: 1px solid var(--primary);
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-secondary {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--bg);
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 11px;
}

.table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  align-items: center;
}

.table-row:last-child {
  border-bottom: none;
}

.table-row.header {
  background: var(--bg);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-light);
}

.user-profile-container {
  margin-top: auto;
  position: relative;
}

.user-mini-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  transition: background 0.2s;
  border-radius: var(--radius);
}

.user-mini-profile:hover {
  background-color: var(--bg);
}

.settings-container {
  max-width: 900px;
  margin: 0 auto;
}

.settings-header h1 {
  font-size: 1.8rem;
  color: var(--text-main);
}

.settings-header p {
  color: var(--text-light);
  margin-bottom: 2rem;
}

.settings-tabs {
  display: flex;
  gap: 30px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 30px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 10px 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.settings-section {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  padding: 30px 0;
  border-bottom: 1px solid var(--border);
}

.section-info h3 {
  font-size: 1.1rem;
  margin-bottom: 8px;
}

.section-info p {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.5;
}

.input-group-settings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.input-group-settings label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
}

.input-group-settings input {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 0.95rem;
}

.readonly-input {
  background: var(--bg) !important;
  color: var(--text-light);
  cursor: not-allowed;
}

.profile-upload {
  display: flex;
  align-items: center;
  gap: 20px;
}

.avatar-large {
  width: 80px;
  height: 80px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-footer {
  display: flex;
  justify-content: flex-end;
  gap: 15px;
  padding: 30px 0;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: var(--text-main);
  cursor: pointer;
  padding: 0;
  margin-right: 15px;
}

.dashboard-overview {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-bottom: 30px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.q-card {
  position: relative;
  padding: 24px;
  color: white;
  border: none;
  overflow: hidden;
}

.grad-orange {
  background: linear-gradient(135deg, #ff8c42 0%, #ff5e62 100%);
}

.grad-blue {
  background: linear-gradient(135deg, #48c6ef 0%, #6f86d6 100%);
}

.grad-lightblue {
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
}

.grad-green {
  background: linear-gradient(135deg, #00b09b 0%, #96c93d 100%);
}

.q-label {
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0.9;
  text-transform: uppercase;
}

.q-value {
  font-size: 1.8rem;
  font-weight: 800;
  margin: 8px 0;
}

.q-sub {
  font-size: 0.75rem;
  opacity: 0.8;
}

.q-icon {
  position: absolute;
  right: 20px;
  top: 20px;
  font-size: 2rem;
  opacity: 0.3;
}

.main-graph-card {
  padding: 30px;
}

.graph-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.graph-select {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-main);
  font-size: 0.85rem;
}

.progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.chart-box {
  position: relative;
  width: 100px;
  height: 100px;
  flex-shrink: 0;
}

.chart-wrapper {
  height: 350px;
  width: 100%;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.light-mode .accent-orange {
  background: linear-gradient(135deg, #ff8c42, #ff5e62);
  color: white;
}

.light-mode .accent-blue {
  background: linear-gradient(135deg, #48c6ef, #6f86d6);
  color: white;
}

.light-mode .accent-lightblue {
  background: linear-gradient(135deg, #00c6ff, #0072ff);
  color: white;
}

.light-mode .accent-green {
  background: linear-gradient(135deg, #00b09b, #96c93d);
  color: white;
}

.dark-mode .q-card {
  background: #1a202c;
  border-left: 5px solid transparent;
  color: #e2e8f0;
}

.dark-mode .accent-orange {
  border-left-color: #ff8c42;
}

.dark-mode .accent-blue {
  border-left-color: #48c6ef;
}

.dark-mode .accent-lightblue {
  border-left-color: #00c6ff;
}

.dark-mode .accent-green {
  border-left-color: #00b09b;
}

.dark-mode .q-icon {
  color: var(--text-light);
  opacity: 0.5;
}

@media (max-width: 1024px) {
  .progress-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .menu-toggle {
    display: block;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
    box-shadow: 10px 0 15px rgba(0, 0, 0, 0.1);
  }

  .sidebar.open {
    transform: translateX(280px);
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    z-index: 999;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-content {
    padding: 20px;
  }

  .settings-section {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .progress-grid {
    grid-template-columns: 1fr;
  }

  .top-bar .actions {
    display: none;
  }
}

@media (min-width: 2000px) {
  .summary-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 40px;
  }
}

@media (max-width: 600px) {
  .graph-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .graph-select {
    width: 100%;
  }

  .chart-wrapper {
    height: 320px;
    margin-top: 10px;
  }

  .page-title {
    font-size: 1.25rem;
  }
}

.progress-grid .q-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 25px;
}

.chart-container {
  position: relative;
  width: 100px;
  height: 100px;
}

.percent-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
}

.light-mode .percent-circle {
  background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 480px) {
  .progress-grid .q-card {
    flex-direction: column;
    text-align: center;
  }
}

/* ---- Shared shell (shell.js) ---- */

a.brand {
  text-decoration: none;
}

.profile-link {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: inherit;
  text-align: left;
  color: inherit;
  cursor: pointer;
}

.profile-link .user-info {
  min-width: 0;
}

.profile-link .name,
.profile-link .role {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item:focus-visible,
.profile-link:focus-visible,
.btn-icon:focus-visible,
.menu-toggle:focus-visible,
a.brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Profile menu ("Your data") ---- */

.profile-dropup {
  position: absolute;
  bottom: 100%;
  left: 0;
  width: 100%;
  background-color: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: 8px;
  margin-bottom: 10px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease-in-out;
  z-index: 100;
}

.profile-dropup.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropup-note {
  padding: 6px 12px 8px;
  font-size: 0.75rem;
  color: var(--text-light);
}

.dropup-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  color: var(--text-main);
  cursor: pointer;
  transition: background 0.2s;
}

.dropup-item:hover,
.dropup-item:focus-visible {
  background-color: var(--bg);
  color: var(--primary);
}

.dropup-item.danger {
  color: #e53e3e;
}

.dropup-item.danger:hover,
.dropup-item.danger:focus-visible {
  background-color: rgba(229, 62, 62, 0.1);
  color: #e53e3e;
}

.dropup-divider {
  height: 1px;
  background-color: var(--border);
  margin: 6px 0;
}

/* ---- Dialog and toast (core/ui.js) ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  z-index: 1200;
}

.modal-content {
  width: 100%;
  max-width: 420px;
  padding: 28px;
  background: var(--card-bg);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.modal-content p {
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.modal-field label {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-light);
}

.modal-field input {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
}

.modal-field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.modal-btn {
  justify-content: center;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  font-weight: 600;
}

.modal-btn.confirm {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.modal-btn.danger {
  background: #e53e3e;
  border-color: #e53e3e;
  color: #fff;
}

.modal-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  max-width: 90%;
  background: var(--primary);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1300;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---- Help & feedback dialog (core/feedback.js) ---- */

.feedback-dialog {
  width: calc(100% - 32px);
  max-width: 440px;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: auto;
}

.feedback-dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
}

.feedback-body {
  position: relative;
  padding: 28px;
}

.feedback-body h2 {
  margin-bottom: 8px;
  padding-right: 28px;
  font-size: 1.2rem;
}

.feedback-lead {
  margin-bottom: 20px;
  color: var(--text-light);
  font-size: 0.95rem;
  line-height: 1.5;
}

.feedback-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-light);
  font-size: 1.4rem;
  line-height: 1;
}

.feedback-close:hover {
  background: var(--bg);
  color: var(--text-main);
}

.feedback-channels {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feedback-channel {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-main);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.feedback-channel:hover {
  background: var(--bg);
  border-color: var(--accent);
}

.feedback-channel-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.feedback-channel-primary:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  opacity: 0.92;
}

.feedback-channel-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
}

.feedback-channel:focus-visible,
.feedback-close:focus-visible,
.feedback-contact-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feedback-contact-link {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.feedback-contact-link:hover {
  text-decoration: underline;
}

/* ---- Feedback nudge (core/feedback-nudge.js) ---- */

.feedback-nudge {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1150;
  width: min(340px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text-main);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.feedback-nudge.show {
  opacity: 1;
  transform: translateY(0);
}

.feedback-nudge h2 {
  margin-bottom: 4px;
  padding-right: 24px;
  font-size: 1rem;
}

.feedback-nudge p {
  margin-bottom: 14px;
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1.4;
}

.feedback-nudge-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  padding: 0;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-light);
  font-size: 1.2rem;
  line-height: 1;
}

.feedback-nudge-close:hover {
  background: var(--bg);
  color: var(--text-main);
}

.feedback-nudge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feedback-nudge-primary {
  background: var(--primary);
  border: 1px solid var(--primary);
  color: #fff;
}

.feedback-nudge-primary:hover {
  opacity: 0.9;
}

.feedback-nudge-secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.feedback-nudge-secondary:hover {
  background: var(--bg);
}

.feedback-nudge-close:focus-visible,
.feedback-nudge-primary:focus-visible,
.feedback-nudge-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 600px) {
  .feedback-nudge {
    left: 16px;
    right: 16px;
    bottom: 16px;
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-nudge {
    transition: none;
    transform: none;
  }
}

/* ---- Print: show only the page content ---- */
@media print {
  body {
    height: auto;
    overflow: visible;
    background: #fff;
    color: #000;
  }

  .app-shell {
    display: block;
    height: auto;
  }

  .sidebar,
  .sidebar-overlay,
  .top-bar,
  .feedback-nudge,
  .no-print {
    display: none !important;
  }

  .main-content {
    overflow: visible;
    padding: 0;
  }
}