:root {
  --ump-blue: #0065A4;
  --ump-blue-dark: #004b7a;
  --ump-gray: #58595B;
  --white: #ffffff;
  --bg-page: #ffffff;
  --bg-section: #f5f5f5;
  --border: #d1d5db;
  --text-main: #111827;
  --text-muted: #6b7280;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.page-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

/* BANER UMP – DESKTOP */

.toph-wrapper {
  position: relative;
}

/* cały pasek z logo, tytułem i katedrą */
#toph {
  width: 100%;
  background: #26bffd;                /* kolor nagłówka UMP */
  /* border-bottom: 3px solid var(--ump-blue);  usuwamy grubą kreskę */
  box-shadow: 0 5px 8px rgba(0, 0, 0, 0.12);  /* delikatny cień w dół */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  position: relative;
}

/* lewa część: logo + tytuł uczelni */
.toph-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.toph-logo {
  width: 80px;
  height: auto;
  flex-shrink: 0;
}

/* napisy po lewej – serif jak na stronie UMP */
.toph-title {
  color: #ffffff;
  font-family: "Times New Roman", Georgia, serif;
  text-transform: uppercase;
  line-height: 1.2;
}

.toph-title .toph-line1 {
  font-size: 1.6rem;
  letter-spacing: 0.08em;
}

.toph-title .toph-line2,
.toph-title .toph-line3 {
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}

/* prawa strona: nazwa katedry */
.toph-right {
  color: #ffffff;
  font-family: "Times New Roman", Georgia, serif;
  text-align: right;
  font-size: 1.2rem;
  line-height: 1.25;
  text-transform: uppercase;
}

/* Zegar / data na środku banera – desktop tylko data */

#clockbox {
  position: absolute;
  top: 80%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: none;

  font-family: "Times New Roman", Georgia, serif;
  font-size: 1.35rem;
  line-height: 1.4;
  text-align: center;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
  white-space: nowrap;
  text-shadow: none;
  pointer-events: none;
}

/* TREŚĆ */

.content {
  padding: 1.5rem 1rem 1.5rem;
  background: var(--bg-page);
}

.content-header {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.75rem;
  text-align: center;
}

.content-header h1 {
  margin: 0 0 0.25rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--ump-blue-dark);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.content-header .subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* TOOLBAR TYGODNI */

.toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.6rem;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.toolbar-left {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.week-label {
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  color: var(--ump-gray);
  white-space: nowrap;
}

.week-select {
  position: relative;
}

/* nowy bąbel – wybierak tygodnia */

.week-picker {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.3rem 0.9rem;
  min-width: 11rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-main);
  font-size: inherit;
  cursor: pointer;
}

.week-picker-caret {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.week-picker-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow-y: auto;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  border: 1px solid var(--border);
}

.week-picker-option {
  width: 100%;
  padding: 0.35rem 0.75rem;
  text-align: left;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-main);
}

.week-picker-option:hover {
  background: #e0f2fe;
}

.week-picker-option.is-active {
  background: #bfdbfe;
  font-weight: 600;
}

.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
}

.nav-btn {
  border-radius: 999px;
  border: 1px solid var(--ump-blue);
  background: var(--ump-blue);
  color: var(--white);
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background 120ms ease-out, transform 120ms ease-out;
}

.nav-btn span {
  font-size: 1.1rem;
  line-height: 1;
}

.nav-btn:hover {
  background: var(--ump-blue-dark);
  transform: translateY(-1px);
}

.nav-btn:active {
  transform: translateY(0);
}

/* PLAN = IFRAME */

.plan-wrapper {
  margin-top: 0.5rem;
}

#plan {
  width: 100%;
  max-width: 880px;                 /* stała maksymalna szerokość planu */
  margin: 0 auto;                   /* wyśrodkowanie diva z planem */
  border-radius: 8px;
  background: #efefef;
  border: 1px solid var(--border);
  overflow: hidden;
  height: clamp(380px, 70vh, 780px); /* desktop / tablet */
  position: relative;                /* dla absolutnego iframe */
}

/* przycinamy górę (nagłówek arkusza) i dół („Opublikowano…”) */
#plan iframe {
  width: 100%;
  height: calc(100% + 60px);
  border: 0;
  position: absolute;
  top: -30px;
  left: 0;
}

#status,
#error {
  font-size: 0.8rem;
  margin: 0.4rem 0 0 0;
  text-align: center;
}

#status {
  color: var(--text-muted);
}

#error {
  color: #b91c1c;
  font-weight: 500;
}

/* STOPKA */

footer {
  border-top: 1px solid var(--border);
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: #f9fafb;
  text-align: center;
}

/* RESPONSYWNOŚĆ: MOBILE – ten sam nagłówek co desktop, ale ułożony mobilnie */

@media (max-width: 640px) {
  .content {
    padding: 1rem 0.6rem 1rem;
  }

  /* nagłówek jako flex-kolumna */
  #toph {
    width: 100%;
    background: #26bffd;
    box-shadow: 0 5px 8px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.75rem 0.5rem;
    position: relative;
  }

  .toph-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-align: center;
    margin-bottom: 0.15rem;
  }

  .toph-logo {
    width: 56px;      /* mniejsze logo na mobile */
  }

  .toph-title .toph-line1 {
    font-size: 1.15rem;
    letter-spacing: 0.08em;
  }

  .toph-title .toph-line2,
  .toph-title .toph-line3 {
    font-size: 0.85rem;
    letter-spacing: 0.06em;
  }

  /* nazwa katedry pod spodem, przyklejona do nagłówka */
  .toph-right {
    display: block;
    font-family: "Times New Roman", Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.15;
    text-align: center;
    text-transform: uppercase;
    margin-top: -0.1rem;   /* tu ją podciągamy w górę */
    margin-bottom: 0.1rem;
    color: #ffffff;
  }

  /* na mobile bez daty w pasku */
  #clockbox {
    display: none;
  }

  .content-header h1 {
    font-size: 1.2rem;
  }

  /* pasek narzędzi w kolumnie */
  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  /* wyśrodkowane „bąble” z datami */
  .toolbar-left {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
  }

  .toolbar-right {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
  }

  .nav-btn {
    flex: 1;
    justify-content: center;
  }

  #plan {
    height: 65vh;
  }

  /* zmniejszony i docięty arkusz na telefonie */
  #plan iframe {
    position: absolute;
    top: -23px;
    left: 0;
    transform: scale(0.8);
    transform-origin: top left;
    width: 130%;
    height: calc(100% + 220px);
    border: 0;
  }
}
