/* ==========================================================================
   GIU Student Portal - stylesheet
   Palette taken from the GIU logo: black, German red and gold.
   Flat, document-like UI. No glow shadows.
   ========================================================================== */

:root {
  /* brand */
  --navy: #16181c;          /* logo black — sidebar, primary buttons */
  --navy-dark: #000000;
  --navy-soft: #3d4148;     /* muted ink for links and accents */
  --red: #c8102e;           /* logo red */
  --red-bg: #fbeaec;
  --gold: #e3a008;          /* logo gold */
  --gold-bg: #fdf3e0;

  --bg: #f4f4f5;
  --card: #ffffff;
  --line: #e2e3e6;
  --line-strong: #c9cbd0;
  --text: #16181c;
  --muted: #6b6f76;
  --green: #1f7a4d;
  --green-bg: #e6f2eb;
  --amber: #96690a;
  --amber-bg: var(--gold-bg);
  --blue-bg: #eeeff1;       /* neutral fill for timetable blocks */
  --radius: 6px;
  --shadow: 0 1px 2px rgba(22, 24, 28, 0.09);
  --sidebar-w: 246px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Helvetica Neue", Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
a { color: var(--navy-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Login ---------------------------------------------------- */

.login-wrap {
  min-height: 100%;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
}

.login-brand {
  position: relative;
  background: var(--navy);
  color: #fff;
  padding: 56px 60px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

/* the three-part rule from the logo — black reads as white on the dark panel */
.brand-flag {
  position: absolute; inset-block-start: 0; inset-inline: 0; height: 6px;
  background: linear-gradient(to right,
    #ffffff 0 33.33%, var(--red) 33.33% 66.66%, var(--gold) 66.66% 100%);
}

.giu-mark { height: 34px; width: auto; display: block; }
.giu-lockup { height: auto; width: 240px; max-width: 100%; display: block; }

.panel-logo { margin-bottom: 26px; }
.panel-logo .giu-lockup { width: 240px; }

.disclaimer {
  margin: 16px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--muted);
  border-top: 1px solid var(--line); padding-top: 12px;
}

.login-brand h1 { font-size: 30px; line-height: 1.25; }
.login-brand p { color: #b6b9bf; max-width: 44ch; margin: 0; }

.login-brand ul { margin: 8px 0 0; padding-inline-start: 18px; color: #b6b9bf; }
.login-brand li { margin-bottom: 4px; }

.login-panel {
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--card);
}

.login-card { width: 100%; max-width: 380px; }
.login-card h2 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; }

.demo-box {
  margin-top: 22px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #fafbfc;
  font-size: 12.5px;
  color: var(--muted);
}
.demo-box b { color: var(--text); }
.demo-box code {
  background: #eef1f5; padding: 1px 5px; border-radius: 3px;
  font-family: Consolas, monospace; color: var(--navy);
}

/* ---------- Forms ---------------------------------------------------- */

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--muted); margin-bottom: 5px;
  text-transform: uppercase; letter-spacing: .04em;
}

input[type="text"], input[type="password"], input[type="email"],
input[type="search"], input[type="number"], select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--navy-soft);
}
textarea { min-height: 92px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  font: inherit; font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--navy-dark); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; justify-content: center; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line-strong); }
.btn.ghost:hover { background: #eef1f5; }
.btn.danger { background: #fff; color: var(--red); border-color: #e3b7b4; }
.btn.danger:hover { background: var(--red-bg); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }

.form-error {
  background: var(--red-bg); border: 1px solid #e3b7b4; color: var(--red);
  padding: 8px 11px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px;
}

/* ---------- App shell ------------------------------------------------ */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--navy);
  color: #d2d4d8;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-top: 4px solid var(--red);
}

/* the logo sits on a white plate so the black wordmark stays legible */
.sidebar-head {
  background: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-head .giu-lockup { height: auto; width: 100%; max-width: 196px; }
.sidebar-sub {
  padding: 9px 18px; font-size: 11.5px; font-weight: 600; color: #b9bcc2;
  letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,.12);
}

.nav { flex: 1; overflow-y: auto; padding: 10px 0 20px; }
.nav-group {
  padding: 14px 18px 6px; font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: #8b8f97;
}
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px; color: #d2d4d8; font-size: 13.5px;
  border-inline-start: 3px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.nav a.active {
  background: rgba(255,255,255,.1); color: #fff;
  border-inline-start-color: var(--gold); font-weight: 600;
}
.nav .ico { width: 17px; text-align: center; opacity: .9; }
.nav .badge-dot {
  margin-inline-start: auto; background: var(--gold); color: #22180a;
  font-size: 10.5px; font-weight: 700; border-radius: 9px; padding: 0 6px;
}

.sidebar-foot { padding: 12px 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12px; }
.sidebar-foot a { color: #9a9ea6; }

/* ---------- Topbar --------------------------------------------------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 22px; height: 58px;
  display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .menu-btn { display: none; }

.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box input { padding-inline-start: 32px; }
.search-box .ico {
  position: absolute; inset-inline-start: 10px; top: 50%;
  transform: translateY(-50%); color: var(--muted); font-size: 13px;
}
.search-results {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 0; width: 100%;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 340px; overflow-y: auto; z-index: 30;
}
.search-results .item { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.search-results .item:last-child { border-bottom: none; }
.search-results .item:hover { background: #f5f7f9; }
.search-results .item small { color: var(--muted); display: block; font-size: 11.5px; }
.search-results .empty { padding: 14px; color: var(--muted); text-align: center; }

.topbar-right { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }

.bell { position: relative; }
.bell .count {
  position: absolute; top: -3px; inset-inline-end: -3px;
  background: var(--red); color: #fff; border-radius: 9px;
  font-size: 10px; font-weight: 700; padding: 0 5px;
}

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
}
.who { line-height: 1.25; }
.who strong { display: block; font-size: 13px; }
.who span { font-size: 11.5px; color: var(--muted); }

/* ---------- Content -------------------------------------------------- */

.content { padding: 22px; flex: 1; }
.page-head { margin-bottom: 18px; }
.page-head h2 { font-size: 21px; }
.page-head p { margin: 3px 0 0; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.card-head {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.card-head h3 { font-size: 14.5px; }
.card-head .right { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.card-body { padding: 16px; }
.card-body.tight { padding: 0; }

.grid { display: grid; gap: 18px; }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
}
.stat .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--muted); font-weight: 600;
}
.stat .value { font-size: 26px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat .note { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Tables --------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); padding: 9px 14px; background: #f7f9fb;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fbfc; }
td .code { font-family: Consolas, monospace; font-weight: 600; color: var(--navy); }
.num { text-align: end; font-variant-numeric: tabular-nums; }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.blue { background: var(--blue-bg); color: var(--navy-soft); }
.tag.gray { background: #eef1f5; color: var(--muted); }

.bar { height: 6px; background: #e9edf2; border-radius: 4px; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; background: var(--navy-soft); }
.bar.warn > i { background: var(--amber); }
.bar.bad > i { background: var(--red); }
.bar.good > i { background: var(--green); }

.empty-state { padding: 34px 16px; text-align: center; color: var(--muted); }

/* ---------- Lists ---------------------------------------------------- */

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  padding: 11px 16px; border-bottom: 1px solid var(--line);
  display: flex; gap: 12px; align-items: flex-start;
}
.list li:last-child { border-bottom: none; }
.list .when { color: var(--muted); font-size: 12px; white-space: nowrap; margin-inline-start: auto; }
.list .title { font-weight: 600; }
.list .desc { color: var(--muted); font-size: 12.5px; }

.timeline-dot {
  width: 9px; height: 9px; border-radius: 50%; background: var(--navy-soft);
  margin-top: 6px; flex: 0 0 9px;
}
.timeline-dot.amber { background: var(--amber); }
.timeline-dot.red { background: var(--red); }
.timeline-dot.green { background: var(--green); }

/* ---------- Timetable ------------------------------------------------ */

.timetable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.timetable th, .timetable td {
  border: 1px solid var(--line); padding: 5px; vertical-align: top;
}
.timetable thead th { background: #f7f9fb; text-align: center; }
.timetable .slot {
  width: 88px; background: #f7f9fb; text-align: center; font-size: 11.5px;
  color: var(--muted); font-weight: 600; white-space: nowrap;
}
.slot-block {
  background: var(--blue-bg); border-inline-start: 3px solid var(--navy);
  border-radius: 4px; padding: 6px 8px; font-size: 12px; min-height: 52px;
}
.slot-block b { display: block; color: var(--navy); }
.slot-block span { color: var(--muted); font-size: 11.5px; display: block; }
.slot-block.lab { background: var(--gold-bg); border-inline-start-color: var(--gold); }
.slot-block.section { background: var(--red-bg); border-inline-start-color: var(--red); }

/* ---------- Misc ----------------------------------------------------- */

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.toolbar select, .toolbar input { max-width: 260px; }

.kv { display: grid; grid-template-columns: 190px 1fr; gap: 0; }
.kv > div { padding: 9px 4px; border-bottom: 1px solid var(--line); }
.kv > div:nth-child(odd) { color: var(--muted); font-size: 12.5px; font-weight: 600; }

.notice {
  border: 1px solid var(--line-strong); border-inline-start: 3px solid var(--navy-soft);
  background: #f7f9fb; padding: 11px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
}
.notice.warn { border-inline-start-color: var(--amber); background: var(--amber-bg); border-color: #ecd9ae; }
.notice.bad { border-inline-start-color: var(--red); background: var(--red-bg); border-color: #e3b7b4; }
.notice.good { border-inline-start-color: var(--green); background: var(--green-bg); border-color: #b9dcc8; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(12, 33, 55, .45);
  display: grid; place-items: center; z-index: 60; padding: 20px;
}
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto; border: 1px solid var(--line-strong);
}
.modal .card-head { position: sticky; top: 0; background: #fff; }
.modal-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end;
}

.toast {
  position: fixed; inset-block-end: 22px; inset-inline-end: 22px; z-index: 80;
  background: var(--navy-dark); color: #fff; padding: 11px 16px;
  border-radius: var(--radius); font-size: 13px; max-width: 340px;
}
.toast.bad { background: var(--red); }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mb0 { margin-bottom: 0; }
.mt16 { margin-top: 16px; }
.right { text-align: end; }
.nowrap { white-space: nowrap; }

/* ---------- Responsive ----------------------------------------------- */

@media (max-width: 1040px) {
  .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.side { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-brand { padding: 34px 26px; }
  .sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar .menu-btn { display: inline-flex; }
  .grid.c2, .grid.c3, .grid.c4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { border-bottom: none; padding-bottom: 0; }
  .who { display: none; }
  .content { padding: 16px; }
}

@media print {
  .sidebar, .topbar, .btn, .toolbar { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #999; box-shadow: none; }
}
