/* ==========================================================================
   macOS / iOS Inspired Stylesheet for Timetable Detail View
   Apple Human Interface Guidelines — Vibrancy, SF Colors, Grouped UI
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --apple-blue:   #007AFF;
  --apple-green:  #34C759;
  --apple-teal:   #5AC8FA;
  --apple-indigo: #5856D6;
  --apple-purple: #AF52DE;

  --text-primary:   #1c1c1e;
  --text-secondary: #3a3a3c;
  --text-tertiary:  #6b7280;

  --surface-1:    rgba(255, 255, 255, 0.78);
  --surface-border: rgba(255, 255, 255, 0.80);
  --win-shadow: 0 2px 6px rgba(0,0,0,0.04), 0 10px 28px rgba(0,0,0,0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100vh; width: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
  background-color: #d1d5db;
  background-image:
    linear-gradient(180deg,
      rgba(255,255,255,0.28) 0%,
      rgba(242,242,247,0.48) 40%,
      rgba(229,229,234,0.55) 100%
    ),
    url("../zsm.jpg");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Header — iOS Navigation Bar
   ========================================================================== */

header {
  background: rgba(249, 249, 249, 0.80);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.10);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  padding: 14px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

h1#pierwsza {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  max-width: 1080px;
  padding: 0;
  color: var(--text-tertiary);
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  position: relative;
}

h1#pierwsza a { display: inline-block; text-decoration: none; }

.photo {
  width: 52px;
  height: 52px;
  border-radius: 13px;
  background-color: #ffffff;
  background-image: url("../logo.jpg");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.08);
  transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.3s ease;
  cursor: pointer;
  margin-bottom: 6px;
}

.photo:hover {
  transform: scale(1.07) rotate(-2deg);
  box-shadow: 0 8px 22px rgba(0,122,255,0.22), 0 0 0 2px rgba(0,122,255,0.42);
}

.plan {
  display: block;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  text-transform: uppercase;
  margin-top: 2px;
  margin-bottom: 2px;
  -webkit-text-fill-color: var(--text-primary);
}

/* ==========================================================================
   Class Title Banner (.tabtytul, .tytul)
   ========================================================================== */

.tabtytul {
  width: 94%;
  max-width: 1100px;
  margin: 24px auto 14px auto;
  border: none;
  background: transparent;
}

.tytul {
  background: rgba(255, 255, 255, 0.80);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  box-shadow: var(--win-shadow);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  padding: 14px 24px;
  height: 68px;
  position: relative;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tytul img { display: none; }

.tytulnapis {
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text-primary);
  -webkit-text-fill-color: var(--text-primary);
  display: inline-block;
}

/* Back Button — iOS style chevron */
#arrow-left {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.90)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23007AFF' stroke-width='2.5'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M10.5 19.5L3 12m0 0l7.5-7.5M3 12h18'/%3E%3C/svg%3E")
    center / 18px no-repeat;
  border: 0.5px solid rgba(0,0,0,0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: all 0.22s cubic-bezier(0.34,1.56,0.64,1);
  cursor: pointer;
  z-index: 10;
}

#arrow-left:hover {
  background-color: rgba(0, 122, 255, 0.10);
  border-color: rgba(0, 122, 255, 0.35);
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 3px 12px rgba(0,122,255,0.18);
}

/* ==========================================================================
   Timetable Container & Table — iOS Grouped Card
   ========================================================================== */

.container {
  width: 94%;
  max-width: 1100px;
  margin: 0 auto 40px auto;
  padding: 22px;
  background: var(--surface-1);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 0.5px solid var(--surface-border);
  border-radius: 22px;
  box-shadow: var(--win-shadow);
  display: block;
}

.table-responsive {
  width: 100%;
  overflow-x: hidden;
  border-radius: 14px;
}

/* Apple-style table: clean, grouped list */
.tabela {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 0.5px solid #d1d5db;
  background: rgba(255, 255, 255, 0.94);
  margin-bottom: 14px;
}

.tabela th {
  background: #f5f5f7;
  color: #3a3a3c;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 12px 10px;
  border-bottom: 1px solid #e5e5ea;
  border-right: 0.5px solid #e5e5ea;
  text-align: center;
}

.tabela td {
  padding: 9px 8px;
  border-bottom: 0.5px solid #e5e5ea;
  border-right: 0.5px solid #e5e5ea;
  font-size: 13px;
  text-align: center;
  vertical-align: middle;
  color: var(--text-primary);
  transition: background-color 0.18s ease;
}

td.nr {
  background: rgba(245, 245, 247, 0.8);
  color: #8e8e93;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 700;
  font-size: 14.5px;
  width: 42px;
}

td.g {
  background: rgba(245, 245, 247, 0.55);
  color: #636366;
  font-family: 'Inter', 'SF Mono', monospace, sans-serif;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  padding: 7px 12px;
}

td.l {
  background: rgba(255, 255, 255, 0.88);
  color: var(--text-primary);
}

td.l:hover {
  background: rgba(242, 242, 247, 0.95);
}

.p {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 13px;
  display: inline-block;
}

/* Nauczyciel — Apple Blue pill */
a.n, span.n {
  color: var(--apple-blue) !important;
  font-weight: 600;
  font-size: 11px;
  background: rgba(0, 122, 255, 0.10);
  border: 0.5px solid rgba(0, 122, 255, 0.22);
  padding: 2px 7px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  margin: 1px;
}

/* Sala — Apple Green pill */
a.s, span.s {
  color: #1a8a35 !important;
  font-weight: 600;
  font-size: 11px;
  background: rgba(52, 199, 89, 0.10);
  border: 0.5px solid rgba(52, 199, 89, 0.25);
  padding: 2px 7px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  margin: 1px;
}

/* Grupa — Apple Indigo pill */
a.k, span.k {
  color: var(--apple-indigo) !important;
  font-weight: 600;
  font-size: 11px;
  background: rgba(88, 86, 214, 0.10);
  border: 0.5px solid rgba(88, 86, 214, 0.22);
  padding: 2px 7px;
  border-radius: 6px;
  text-decoration: none;
  display: inline-block;
  margin: 1px;
}

/* ==========================================================================
   Print Button
   ========================================================================== */

a[href*="window.print"] {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  border-radius: 10px;
  background: rgba(0, 122, 255, 0.10);
  color: var(--apple-blue) !important;
  border: 0.5px solid rgba(0, 122, 255, 0.28);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.18s ease;
  cursor: pointer;
}

a[href*="window.print"]:hover {
  background: rgba(0, 122, 255, 0.18);
  border-color: rgba(0, 122, 255, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,122,255,0.18);
}

td .op, .op td {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: #8e8e93;
  font-weight: 500;
  text-transform: none;
  line-height: 1.4;
}

.op a {
  color: var(--apple-blue) !important;
  text-decoration: underline;
}

.op td img {
  width: 34px;
  height: 34px;
  opacity: 0.88;
  transition: opacity 0.18s ease;
}

.op td img:hover { opacity: 1; }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* --- Mobile: skalowanie tabeli do ekranu --- */
@media (max-width: 639px) {
  .container {
    width: 100%;
    padding: 10px 6px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .table-responsive {
    overflow-x: hidden;
  }

  .tabela {
    width: 100%;
    table-layout: fixed;
  }

  .tabela th,
  .tabela td {
    font-size: 9px;
    padding: 4px 2px;
    word-break: break-word;
    overflow-wrap: break-word;
  }

  td.nr, th:first-child {
    width: 18px;
    min-width: 18px;
    max-width: 18px;
    font-size: 9px;
    padding: 4px 1px;
  }

  td.g {
    font-size: 8px;
    padding: 4px 3px;
    white-space: normal;
    min-width: 52px;
  }

  .p {
    font-size: 9px;
  }

  a.n, span.n,
  a.s, span.s,
  a.k, span.k {
    font-size: 8px;
    padding: 1px 3px;
  }

  .tabtytul {
    width: 100%;
    margin: 12px auto 8px auto;
  }

  .tytulnapis {
    font-size: 20px;
  }

  .tytul {
    height: auto;
    padding: 10px 50px;
  }
}

@media (min-width: 640px) {
  header { padding: 16px 32px; }

  h1#pierwsza {
    flex-direction: row;
    gap: 18px;
  }

  .photo {
    width: 56px;
    height: 56px;
    margin-bottom: 0;
  }

  .plan { font-size: 28px; }
}

/* ==========================================================================
   Print
   ========================================================================== */

@media print {
  body { background: #ffffff !important; color: #000 !important; }
  header, #arrow-left, a[href*="window.print"] { display: none !important; }
  .container, .tabtytul, .tytul {
    background: #ffffff !important;
    box-shadow: none !important;
    border: none !important;
    max-width: 100% !important;
    width: 100% !important;
    padding: 0 !important;
  }
  .tytulnapis { color: #000 !important; -webkit-text-fill-color: #000 !important; }
  .tabela { border: 1px solid #000 !important; }
  .tabela th, .tabela td {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
  }
  .p { color: #000 !important; }
  a.n, a.s, a.k, span.n, span.s, span.k {
    color: #333 !important;
    background: none !important;
    border: none !important;
  }
}