/*
 * index.css – Style for the main screen (the first page after login).
 * Used by: frontend/index.html.
 * Layout: notices are the widest panel; announcements sit beside them. On phones the two become tabs.
 * How to edit: colours and fonts come from css/liquid-crystal.css.
 */

/* This is the layout of the main screen: one column on phones (the bottom bar takes the menu).
   On wide screens it becomes a 12-column grid, and each card takes the number of columns set below. */
.home-layout {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
  align-items: start;
}

/* This is the wide-screen layout: today, messages and announcements sit in one row of three,
   notices take two thirds of the next row, and the rest fills the gaps (dense packing). */
@media (min-width: 900px) {
  .home-layout {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-flow: dense;
  }

  .home-greeting,
  .write-panel {
    grid-column: 1 / -1;
  }

  .today-panel,
  .notifications-panel,
  .announcements-panel {
    grid-column: span 4;
  }

  .notices-panel {
    grid-column: span 8;
  }

  .today-glance-panel {
    grid-column: span 4;
  }

  .results-panel {
    grid-column: span 8;
  }

  .later-panel {
    grid-column: span 2;
  }
}

/* The menu links are replaced by the bottom bar, so they are hidden on pages that have it. */
body.has-bottom-nav .menu-links {
  display: none;
}

/* This is the greeting area at the top, with the menu links below the name. */
.home-greeting {
  display: grid;
  gap: 10px;
}

/* This is the row of menu links that this person can open. */
.menu-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* This is one menu link. Phase 2 links are faded and cannot be clicked. */
.menu-link {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--colour-primary);
  color: var(--colour-link);
  font-weight: 600;
  text-decoration: none;
  font-size: 0.95rem;
}

/* This is the faded style for a menu that comes in a later phase. */
.menu-link-later {
  opacity: 0.5;
  border-style: dashed;
  pointer-events: none;
}

/* This is the style for the today panel (date, time and weather). */
.today-panel {
  padding: 24px;
}

/* This is the large date line, the most important text in the today panel. */
.today-date {
  font-family: var(--font-display);
  font-size: 1.6rem;
  margin: 0;
}

/* This is the live clock under the date. */
.today-time {
  font-size: 1.1rem;
  color: var(--colour-text-soft);
  margin: 2px 0 12px;
  font-variant-numeric: tabular-nums;
}

/* This is the weather line. */
.today-weather {
  margin-bottom: 14px;
  color: var(--colour-text-soft);
}

/* This is the notices and announcements panel. */
.notices-panel,
.announcements-panel {
  padding: 24px;
}

/* This is the row of tabs that switches between notices and announcements on phones. */
.panel-tabs {
  display: none;
  gap: 8px;
  margin-bottom: 14px;
}

/* This is one tab button (Notices / Announcements): a glass pill, like the Itachi segment buttons. */
.tab-button {
  flex: 1;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--colour-edge);
  background: var(--colour-field);
  color: var(--colour-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--motion-short) ease, transform var(--motion-short) ease;
}

/* This is the tab that is open right now: a red gradient pill. */
.tab-button.tab-active {
  background: linear-gradient(135deg, var(--colour-primary), var(--colour-accent));
  color: var(--colour-primary-text);
  border-color: transparent;
}

.tab-button:active {
  transform: scale(0.98);
}

/* This is the list of rows in the entry forms (rules, students, fined students): each row has a choice box, extra text, and a remove button */
.choice-list {
  display: grid;
  gap: 10px;
}

/* This is one row in such a list. On wide screens it sits in one line; on phones it stacks. */
.choice-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.5fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border-radius: 12px;
  background: var(--colour-panel-solid);
}

/* This is the points text shown next to a rule choice */
.choice-row .rule-points {
  margin: 0;
}

/* On phones each row stacks into one column */
@media (max-width: 600px) {
  .choice-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* This is a home panel that is also a link to its page: it keeps the look of a panel, without the link underline */
.later-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

/* This is the row of tabs used by several pages (dashboard, Class of Perfection, Fund). Each tab shows one group of panels.
   On phones the row scrolls sideways instead of wrapping. */
.dash-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin: 0 0 16px;
  scrollbar-width: thin;
}

.dash-tabs .tab-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* This is the phone layout: the two panels share one place and the tabs choose which one shows. */
@media (max-width: 899px) {
  .panel-tabs {
    display: flex;
  }

  .home-layout[data-tab="announcements"] .notices-panel {
    display: none;
  }

  .home-layout[data-tab="notices"] .announcements-panel {
    display: none;
  }

  .announcements-panel h2 {
    display: none;
  }
}

/* This is the list of notices and announcements. */
.notice-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

/* This is one notice: its badges, title, text and who posted it. */
.notice-item {
  padding: 14px 16px;
  border-radius: var(--radius-control);
  background: var(--colour-field);
  border: 1px solid var(--colour-field-border);
}

/* This is the urgent notice style: a clear marker on the left edge. */
.notice-urgent {
  border-left: 5px solid var(--colour-error);
}

/* This is the important notice style. */
.notice-important {
  border-left: 5px solid var(--colour-accent);
}

/* This is the row of small labels on top of a notice (priority, category, audience). */
.notice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--colour-text-soft);
  margin-bottom: 4px;
}

/* This is the title of a notice. */
.notice-title {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

/* This is the text of a notice. */
.notice-body {
  margin: 0;
  white-space: pre-line;
}

/* This is the small label shown next to the time, for example "Urgent". */
.priority-badge {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--colour-accent);
  color: var(--colour-on-accent);
  font-weight: 600;
}

/* This is the style for the principal's "seen by" line under a notice. */
.seen-line {
  font-size: 0.85rem;
  color: var(--colour-text-soft);
  margin-top: 6px;
}

/* This is the write-a-notice panel. It is only shown to the principal. */
.write-panel {
  padding: 24px;
}

/* This is the style for the today-at-a-glance rows (principal only). Its wide-screen width is set in the media query above. */
.glance-list {
  display: grid;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.glance-item {
  display: grid;
  gap: 0.15rem;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  background: var(--colour-panel-solid);
}

/* This is the style for the class chooser above the results chart */
.class-choice {
  display: grid;
  gap: 0.3rem;
  margin: 0.8rem 0;
}

/* This is the results panel. */
.results-panel {
  padding: 24px;
}

/* This is the row with the earlier and later buttons and the term name. */
.results-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

/* This is the two-column layout of the grade and subject bars (one column on phones). */
.results-columns {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

/* This is the two-column layout of the results on wider screens. */
@media (min-width: 640px) {
  .results-columns {
    grid-template-columns: 1fr 1fr;
  }
}

/* This is the list of bars (grades or subjects). */
.bar-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

/* This is one bar row: the name, the value, and a bar whose length shows the value. */
.bar-row {
  display: grid;
  gap: 4px;
}

/* This is the coloured bar itself. Its width is set by the page from the value. */
.bar-track {
  height: 10px;
  border-radius: 999px;
  background: var(--colour-field-border);
  overflow: hidden;
}

/* This is the filled part of a bar. */
.bar-fill {
  height: 100%;
  background: var(--colour-primary);
}

/* This is the panel for a later phase: it is faded so it is clearly not active. */
.later-panel {
  padding: 20px 24px;
  opacity: 0.7;
}


/* This is the quiet button style (log out, earlier and later). */
.button-quiet {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius-control);
  border: 1px solid var(--colour-field-border);
  background: transparent;
  color: var(--colour-text);
  font: inherit;
  cursor: pointer;
}

/* This is the today date and time when the screen is narrow: the date is a little smaller. */
@media (max-width: 480px) {
  .today-date {
    font-size: 1.3rem;
  }
}
