/* --- Reset/struktura bazowa --- */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}
body {
  font-family: sans-serif;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-sizing: border-box;
}

:root {
  --color-primary: #df0000;   /* główny czerwony */
  --color-accent:  #b90000;   /* ciemniejszy czerwony (hover) */
  --color-border:  #ccc;      /* linie, ramki */
  --color-bg-panel: white;    /* tło paneli */
}


/* --- Header / Footer --- */
header {
  height: 50px;
  background-color: var(--color-primary);
  color: white;
  display: grid;
  grid-template-columns: auto 1fr auto; /* lewo | środek | prawo */
  align-items: center;
  padding: 0 20px;
  font-size: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.header-left   { justify-self: start; }
.header-center { justify-self: center; text-align: center; }
.header-right  { justify-self: end; }

.header-left {
  display: flex;
  align-items: center;
  gap: 10px; /* odstęp między przyciskiem a tekstem SdBA */
}


footer {
  height: 40px;
  background-color: var(--color-bg-panel);
  text-align: center;
  font-size: 14px;
  line-height: 40px;
  border-top: 1px solid #ccc;
}

/* --- STARY LAYOUT (main.html) ---
   Zostawiamy go, bo:
   - strona logowania albo inne widoki poza shellem mogą dalej korzystać z main.html
   - nie wpływa to negatywnie na shell
*/

.main {
  flex: 1;
  display: flex;         /* 3-kolumnowy layout */
  overflow: hidden;
}

/* Lewy panel (menu) w starym layoucie */
.sidebar {
  width: 200px;
  background-color: var(--color-bg-panel);
  padding: 10px;
  border-right: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}
.menu-top {
  display: flex;
  flex-direction: column;
}
.menu-bottom {
  border-top: 1px solid #ccc;
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

/* Linki w menu starego layoutu */
.sidebar a {
  display: block;
  margin: 6px 0;
  text-decoration: none;
  color: #333;
  cursor: pointer;
}
.sidebar a:hover {
  color: #0074D9;
  text-decoration: none;
}
.sidebar a.active-link {
  font-weight: bold;
  color: var(--color-primary);
}

/* Sekcje menu (stary layout) */
.sidebar details { margin-top: 10px; }
.sidebar summary {
  cursor: pointer;
  font-weight: normal;
  margin: 6px 0;
  padding: 4px;
  background-color: transparent;
  border-radius: 3px;
  list-style: none;
}
.sidebar details[open] summary {
  background-color: #d0d0d0;
}
.sidebar details a {
  margin: 4px 0 4px 24px;
  font-size: 1em;
  display: block;
  color: #444;
}
.sidebar details a:hover {
  color: #0074D9;
  text-decoration: underline;
}

/* Panel środkowy (stary layout) */
.content {
  flex: 1 1 auto;
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
  min-width: 0; /* ważne, żeby treść się nie rozpychała kosztem prawego panelu */
}

/* Prawy panel (telefon) w starym layoucie */
.rightbar {
  width: 340px;
  min-width: 280px;
  max-width: 40vw;
  border-left: 1px solid #ccc;
  padding: 10px;
  background: #fafafa;
  overflow-y: auto;
  box-sizing: border-box;
  transition: width .2s ease,
              min-width .2s ease,
              padding .2s ease,
              opacity .2s ease;
}

.rightbar--hidden {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  border-left: none;
  pointer-events: none;         /* brak interakcji gdy schowany */
}

/* Na bardzo małych ekranach domyślnie schowaj prawy panel (stary layout) */
@media (max-width: 900px) {
  .rightbar {
    width: 0;
    min-width: 0;
    padding: 0;
    opacity: 0;
    border-left: none;
    pointer-events: none;
  }
}

/* === Przycisk hamburger (Pokaż/Ukryj telefon) === */
#togglePhoneBtn {
  width: 40px;
  height: 32px;
  border: none;
  background-color: var(--color-primary);  /* czerwony jak belka górna */
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.2s ease;
}

#togglePhoneBtn:hover {
  background-color: #b90000;   /* ciemniejszy przy hoverze */
}

/* Trzy białe poziome kreski */
#togglePhoneBtn .hamburger {
  position: relative;
  display: block;
  width: 20px;
  height: 2px;
  background-color: white;
}

#togglePhoneBtn .hamburger::before,
#togglePhoneBtn .hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background-color: white;
}

#togglePhoneBtn .hamburger::before {
  top: -6px;
}

#togglePhoneBtn .hamburger::after {
  top: 6px;
}




/* Użyteczne klasy/utility */
.sticky-header {
  /* position: static; */
  
  position: sticky;
  top: 0;
  background-color: white;
  z-index: 100;
  
}

/* Tabele */
.table-container { max-height: 1000px; overflow-y: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 2px;
}

th, td {
  border: 1px solid #ccc;
  padding: 8px 12px;
  text-align: left;
}

th { background-color: #f5f5f5; }
tr:nth-child(even) { background-color: #fafafa; }
thead th {
  
  position: sticky;
  top: 0;
  z-index: 50;
  
  background-color: #f2f2f2;
}

/* Nagłówki raportów / filtry */
.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 10px;
  background-color: white;
  /* z-index: 100; */
  border-bottom: 1px solid #ccc;
}
.header-bar h2 { margin: 0; }

.date-filter-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.date-filter-form input[type="date"] {
  padding: 4px;
  font-size: 0.9rem;
}
.date-filter-form button {
  padding: 6px 12px;
  font-size: 0.9rem;
  background-color: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.date-filter-form button:hover {
  background-color: #b90000;
}

/* Sort w nagłówkach tabel */
th a {
  color: black;
  text-decoration: none;
}
th a.active-sort {
  color: var(--color-primary);
  font-weight: bold;
}


/* === SHELL LAYOUT (nowy układ po zalogowaniu) === */

/* odpowiednik .main, ale dla shella */
.main-shell {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* lewy panel w shellu: odpowiednik .sidebar */
.shell-sidebar {
  width: 200px;
  background-color: var(--color-bg-panel);
  padding: 10px;
  border-right: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  transition: width .2s ease,
              min-width .2s ease,
              padding .2s ease,
              opacity .2s ease;
}

.shell-sidebar--hidden {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  border-right: none;
  pointer-events: none;
}


.shell-sidebar .menu-top {
  display: flex;
  flex-direction: column;
}
.shell-sidebar .menu-bottom {
  border-top: 1px solid #ccc;
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
}

/* linki/menu w shell-sidebar */
.shell-sidebar a {
  display: block;
  margin: 6px 0;
  text-decoration: none;
  color: #333;
  cursor: pointer;
}
.shell-sidebar a:hover {
  color: #0074D9;
  text-decoration: none;
}
.shell-sidebar a.active-link {
  font-weight: bold;
  color: var(--color-primary);
}

/* sekcje menu w shell-sidebar */
.shell-sidebar details {
  margin-top: 10px;
}
.shell-sidebar summary {
  cursor: pointer;
  font-weight: normal;
  margin: 6px 0;
  padding: 4px;
  background-color: transparent;
  border-radius: 3px;
  list-style: none;
}
.shell-sidebar details[open] summary {
  background-color: #d0d0d0;
  /* background-color: transparent !important; */
}
.shell-sidebar details a {
  margin: 4px 0 4px 24px;
  font-size: 1em;
  display: block;
  color: #444;
}
.shell-sidebar details a:hover {
  color: #0074D9;
  text-decoration: underline;
}

/* środkowa kolumna shella */
.shell-center {
  flex: 1 1 auto;
  border-right: 1px solid #ccc;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
}

/* iframe z treścią podstron */
#content-frame {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: 0;
}

/* prawa kolumna (telefon) w shellu */
.shell-rightbar {
  width: 340px;
  min-width: 280px;
  max-width: 40vw;
  border-left: 1px solid #ccc;
  padding: 10px;
  background-color: var(--color-bg-panel);
  overflow-y: auto;
  box-sizing: border-box;
  transition: width .2s ease,
              min-width .2s ease,
              padding .2s ease,
              opacity .2s ease;
}

/* ukrycie telefonu przyciskiem 📱 Telefon */
.shell-rightbar.shell-rightbar--hidden {
  width: 0;
  min-width: 0;
  padding: 0;
  opacity: 0;
  border-left: none;
  pointer-events: none;
}

/* Responsywność: na wąskich ekranach telefon domyślnie schowany */
@media (max-width: 900px) {
  .shell-rightbar {
    width: 0;
    min-width: 0;
    padding: 0;
    opacity: 0;
    border-left: none;
    pointer-events: none;
  }
}


/* === Lewy hamburger (Pokaż/Ukryj menu) === */
#toggleMenuBtn {
  width: 40px;
  height: 32px;
  border: none;
  background-color: var(--color-primary);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 0.2s ease;
}

#toggleMenuBtn:hover {
  background-color: #b90000;
}

/* Trzy białe poziome kreski */
#toggleMenuBtn .hamburger {
  position: relative;
  display: block;
  width: 20px;
  height: 2px;
  background-color: white;
}

#toggleMenuBtn .hamburger::before,
#toggleMenuBtn .hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background-color: white;
}

#toggleMenuBtn .hamburger::before {
  top: -6px;
}

#toggleMenuBtn .hamburger::after {
  top: 6px;
}

