/*
 * UM Student Dashboard — product UI layer
 *
 * This file deliberately sits last in the stylesheet chain. It gives the
 * existing views a consistent visual language while keeping their IDs,
 * endpoint-driven rendering and interaction hooks unchanged.
 */

:root {
  --color-bg: #f4f6f9;
  --color-surface: #ffffff;
  --color-sidebar: #172033;
  --color-primary: #3157c8;
  --color-primary-hover: #2547ad;
  --color-primary-soft: #edf2ff;
  --color-text: #182235;
  --color-text-secondary: #667085;
  --color-border: #e3e8f0;
  --color-success: #11865b;
  --color-warning: #b7791f;
  --color-error: #c53b4d;
  --radius-card: 14px;
  --radius-btn: 9px;
  --shadow-card: 0 1px 2px rgba(23, 32, 51, .04), 0 8px 24px rgba(23, 32, 51, .045);
  --shadow-elevated: 0 12px 28px rgba(23, 32, 51, .12);
  --transition: 160ms ease;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 15px;
}

button,
a,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.header-global {
  min-height: 76px;
  padding: 16px clamp(20px, 4vw, 56px);
  border-bottom: 1px solid var(--color-border);
  background: rgba(255, 255, 255, .96);
}

.brand {
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--color-primary);
  box-shadow: 0 5px 12px rgba(49, 87, 200, .2);
}

.brand-text strong {
  font-size: 1rem;
  letter-spacing: -.01em;
}

.brand-text span {
  margin-top: 3px;
  font-size: .68rem;
  letter-spacing: .09em;
  color: #8590a4;
}

.header-actions {
  gap: 16px;
}

.user-profile {
  gap: 10px;
}

.user-profile > svg {
  width: 36px;
  height: 36px;
  padding: 8px;
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

.user-info {
  gap: 2px;
}

.user-info strong {
  font-size: .82rem;
}

.system-status {
  font-size: .75rem;
  font-weight: 600;
}

.nav-horizontal {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text-secondary);
}

.nav-container {
  max-width: 1440px;
  padding: 0 clamp(12px, 3.5vw, 48px);
}

.nav-item {
  position: relative;
  min-height: 52px;
  padding: 0 16px;
  color: var(--color-text-secondary);
  font-size: .84rem;
  font-weight: 600;
  border: 0;
  gap: 8px;
}

.nav-item::after {
  position: absolute;
  right: 14px;
  bottom: -1px;
  left: 14px;
  height: 2px;
  content: "";
  background: transparent;
}

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

.nav-item.is-active {
  color: var(--color-primary);
  background: transparent;
}

.nav-item.is-active::after {
  background: var(--color-primary);
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.sub-header {
  padding: 11px clamp(20px, 4vw, 56px);
  background: #fbfcfe;
  border-bottom: 1px solid var(--color-border);
}

.sub-header-container {
  max-width: 1440px;
  font-size: .78rem;
}

.current-page-badge {
  padding: 4px 9px;
  border: 0;
  border-radius: 6px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: .75rem;
}

.view-container {
  max-width: 1440px;
  padding: clamp(24px, 4vw, 48px) clamp(20px, 4vw, 56px) 72px;
}

.view[hidden] {
  display: none;
}

.view-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.view-heading--home {
  align-items: center;
}

.eyebrow {
  margin-bottom: 7px;
  color: var(--color-primary);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.view-heading h1 {
  color: var(--color-text);
  font-size: clamp(1.65rem, 2.6vw, 2.15rem);
  font-weight: 720;
  letter-spacing: -.035em;
  line-height: 1.1;
}

.view-heading-description {
  max-width: 620px;
  margin-top: 8px;
  color: var(--color-text-secondary);
  font-size: .92rem;
}

.view-heading-date,
.view-heading-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 9px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: .78rem;
  font-weight: 600;
  white-space: nowrap;
}

.view-heading-date svg {
  width: 16px;
  height: 16px;
  color: var(--color-primary);
}

.home-grid-pronote {
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr);
  gap: 20px;
}

.home-grid-pronote > div:first-child {
  grid-row: span 2;
}

.widget,
.card,
.hero-widget,
.agenda-header,
.personal-event-form,
.agenda-grid-container,
.settings-list,
.ent-card {
  border-color: var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.widget {
  margin-bottom: 20px;
}

.widget-header {
  min-height: 52px;
  padding: 14px 18px;
  background: var(--color-surface);
  color: var(--color-text);
}

.widget-header-title {
  font-size: .86rem;
}

.widget-header-title svg {
  width: 17px;
  height: 17px;
  color: var(--color-primary);
}

.widget-body {
  padding: 18px;
}

.hero-widget {
  align-items: flex-start;
  min-height: 166px;
  margin-bottom: 20px;
  padding: 23px;
  background: var(--color-primary);
  color: white;
  box-shadow: 0 12px 28px rgba(49, 87, 200, .18);
}

.hero-icon {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,.16);
  color: white;
}

.hero-content h3,
.hero-title,
.hero-time {
  color: white;
}

.hero-content h3 {
  opacity: .78;
}

.hero-title {
  margin-top: 9px;
  font-size: 1.3rem;
  line-height: 1.25;
}

.hero-time {
  opacity: .84;
}

.timeline-v-item {
  padding: 13px 0;
}

.timeline-v-time {
  width: 58px;
  color: #7d899e;
  font-variant-numeric: tabular-nums;
}

.timeline-v-content {
  border-left-width: 2px;
  border-left-color: #8aa0e8;
}

.course-mini-item {
  min-width: 0;
  padding: 9px 0;
}

.course-mini-icon {
  flex: 0 0 34px;
  border-radius: 9px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
}

.course-mini-title {
  min-width: 0;
}

.btn {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: .82rem;
  font-weight: 650;
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

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

.btn-secondary:hover:not(:disabled) {
  border-color: #b9c5da;
  background: #f8faff;
}

.btn-ghost {
  min-height: 32px;
  color: var(--color-primary);
}

.input,
.settings-auth-field input {
  min-height: 40px;
  border-color: #d6deeb;
  border-radius: 9px;
}

.input:focus,
.settings-auth-field input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(49, 87, 200, .12);
}

.notice {
  border-radius: 10px;
  line-height: 1.45;
}

.agenda-header {
  margin-bottom: 18px;
  padding: 14px;
  background: var(--color-surface);
}

.agenda-controls {
  gap: 7px;
}

.agenda-current-range {
  color: var(--color-text);
  font-size: 1rem;
}

.agenda-grid-container {
  box-shadow: var(--shadow-card);
}

.agenda-day-header,
.agenda-time-column {
  background: #fbfcfe;
}

.agenda-day-header.is-today {
  background: var(--color-primary-soft);
}

.agenda-day-header.is-today strong {
  color: var(--color-primary);
}

.agenda-event {
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(49, 87, 200, .08);
}

.courses-toolbar {
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.courses-search {
  width: min(100%, 460px);
  max-width: none;
}

.courses-grid {
  gap: 18px;
}

.course-card {
  min-height: 220px;
}

.course-title {
  font-size: 1rem;
}

.course-actions .btn {
  width: 100%;
}

.productivity-grid {
  gap: 20px;
}

.task-form {
  margin-bottom: 18px;
}

.task-item {
  border-radius: 10px;
  background: #fbfcfe;
}

.task-delete {
  opacity: 1;
}

.pomodoro-card {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.pomodoro-timer {
  margin: 26px 0 20px;
  font-size: 3.4rem;
  color: var(--color-primary);
}

.ent-section {
  margin-bottom: 34px;
}

.ent-section h2,
.settings-section-title {
  margin-bottom: 13px;
  color: var(--color-text);
  font-size: .78rem;
  letter-spacing: .09em;
}

.ent-grid {
  gap: 14px;
}

.ent-card {
  min-height: 82px;
  padding: 16px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.ent-card:hover {
  border-color: #b8c5de;
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
}

.ent-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
}

.ent-title {
  font-size: .92rem;
}

.ent-notice {
  margin-top: 8px;
  padding: 14px 0 0;
  font-size: .8rem;
}

.settings-container {
  max-width: 860px;
}

.settings-section {
  margin-bottom: 30px;
}

.settings-list {
  box-shadow: var(--shadow-card);
}

.settings-row {
  gap: 20px;
  padding: 18px 20px;
}

.settings-title {
  font-size: .9rem;
  font-weight: 650;
}

.settings-desc {
  max-width: 560px;
  line-height: 1.45;
}

.settings-auth-form {
  max-width: 560px;
  margin: 0 20px;
  padding: 18px 0 22px;
}

.connector-status-badge {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #f7f9fc;
}

.mobile-bottom-nav {
  box-shadow: 0 -8px 24px rgba(23, 32, 51, .08);
}

@media (max-width: 1000px) {
  .home-grid-pronote {
    grid-template-columns: 1fr 1fr;
  }

  .home-grid-pronote > div:first-child {
    grid-row: auto;
    grid-column: 1 / -1;
  }
}

@media (max-width: 700px) {
  .header-global {
    min-height: 68px;
    padding: 13px 16px;
  }

  .brand-text span,
  .user-info {
    display: none;
  }

  .nav-horizontal {
    display: none;
  }

  .sub-header {
    padding: 9px 16px;
  }

  .view-container {
    padding: 25px 16px 86px;
  }

  .view-heading,
  .view-heading--home {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 22px;
  }

  .view-heading-date,
  .view-heading-note {
    align-self: flex-start;
  }

  .home-grid-pronote {
    grid-template-columns: 1fr;
  }

  .home-grid-pronote > div:first-child {
    grid-column: auto;
  }

  .agenda-header {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .agenda-controls {
    justify-content: space-between;
  }

  .agenda-current-range {
    min-width: 0;
    order: -1;
  }

  .personal-event-fields {
    grid-template-columns: 1fr;
  }

  .task-form {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-row > *:last-child {
    align-self: stretch;
  }

  .settings-auth-form {
    margin: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
