/* Importing Google Fonts - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

body {
  min-height: 100dvh;
  background: linear-gradient(#F1F3FF, #CBD4FF);
}

.topbar {
  background-color: #333;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 10px 20px;
  gap: 2px;
}

/* górna linia */
.topbar-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-main span {
  color: #f2f2f2;
  font-size: 17px;
}

/* login */
.topbar-login {
  font-weight: 500;
}

/* dzwonek */
.topbar-notify {
  display: none;
  align-items: center;
  cursor: pointer;
  opacity: 0.85;
}

.topbar-notify:hover {
  opacity: 1;
}

.topbar-notify .material-symbols-rounded {
  font-size: 30px;
}

.topbar-notify.has-notifications {
  display: flex;
}

/* sesja */
.topbar-session {
  font-size: 0.75rem;
  opacity: 0.7;
  color: #eef2ff;
  width: 160px;          /* <-- KLUCZ */
  font-variant-numeric: tabular-nums;
}

.topbar-session.warning {
  color: #e6a700;
}

.topbar-session.expired {
  color: #e63946;
  font-weight: 600;
}

/* === LOGIN === */
.login-container {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding-top: 80px;
}

.login-form {
  background-color: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  width: 300px;
  max-width: 90%;
}

.login-form input {
  margin-bottom: 1rem;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.login-form input:focus {
  border-color: #56ab2f;
  outline: none;
}

.login-form button {
  background-color: #56ab2f;
  color: white;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.login-form button:hover {
  background-color: #449a23;
}

.title {
  font-size: 2rem;
  color: #2e7d32;
  margin-bottom: 1rem;
}

/* === Sidebar === */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 270px;
  height: 100dvh;
  background: #151A2D;
  transition: all 0.4s ease;
}

.sidebar.collapsed {
  width: 85px;
}

.sidebar .sidebar-header {
  display: flex;
  position: relative;
  padding: 25px 20px;
  align-items: center;
  justify-content: space-between;
}

.sidebar-header .header-logo img {
  width: 48px;
  height: 48px;
  display: block;
  object-fit: contain;
  border-radius: 50%;
}

.sidebar-header .sidebar-toggler,
.sidebar-menu-button {
  position: absolute;
  right: 20px;
  height: 35px;
  width: 35px;
  color: #151A2D;
  border: none;
  cursor: pointer;
  display: flex;
  background: #EEF2FF;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: 0.4s ease;
}

.sidebar.collapsed .sidebar-header .sidebar-toggler {
  transform: translate(-4px, 65px);
}

.sidebar-header .sidebar-toggler span,
.sidebar-menu-button span {
  font-size: 1.75rem;
  transition: 0.4s ease;
}

.sidebar.collapsed .sidebar-header .sidebar-toggler span {
  transform: rotate(180deg);
}

.sidebar-header .sidebar-toggler:hover {
  background: #d9e1fd;
}

.sidebar-nav .nav-list {
  list-style: none;
  display: flex;
  gap: 4px;
  padding: 0 15px;
  flex-direction: column;
  transform: translateY(15px);
  transition: 0.4s ease;
}

.sidebar .sidebar-nav .primary-nav {
  overflow-y: auto;
  scrollbar-width: thin;
  padding-bottom: 20px;
  height: calc(100dvh - 227px);
  scrollbar-color: transparent transparent;
}

.sidebar .sidebar-nav .primary-nav:hover {
  scrollbar-color: #EEF2FF transparent;
}

.sidebar.collapsed .sidebar-nav .primary-nav {
  overflow: unset;
  transform: translateY(65px);
}

.sidebar-nav .nav-item .nav-link {
  color: #fff;
  display: flex;
  gap: 12px;
  white-space: nowrap;
  border-radius: 8px;
  padding: 11px 15px;
  align-items: center;
  text-decoration: none;
  border: 1px solid #151A2D;
  transition: 0.4s ease;
}

.sidebar-nav .nav-item:is(:hover, .open)>.nav-link:not(.dropdown-title) {
  color: #151A2D;
  background: #EEF2FF;
}

.sidebar .nav-link .nav-label {
  transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-link :where(.nav-label, .dropdown-icon) {
  opacity: 0;
  pointer-events: none;
}

.sidebar.collapsed .nav-link .dropdown-icon {
  transition: opacity 0.3s 0s ease;
}

.sidebar-nav .secondary-nav {
  position: absolute;
  bottom: 35px;
  width: 100%;
  background: #151A2D;
}

.sidebar-nav .nav-item {
  position: relative;
}

/* Dropdown Stylings */
.sidebar-nav .dropdown-container .dropdown-icon {
  margin: 0 -4px 0 auto;
  transition: transform 0.4s ease, opacity 0.3s 0.2s ease;
}

.sidebar-nav .dropdown-container.open .dropdown-icon {
  transform: rotate(180deg);
}

.sidebar-nav .dropdown-menu {
  height: 0;
  overflow-y: hidden;
  list-style: none;
  padding-left: 15px;
  transition: height 0.4s ease;
}

.sidebar.collapsed .dropdown-menu {
  position: absolute;
  top: -10px;
  left: 100%;
  opacity: 0;
  height: auto !important;
  padding-right: 10px;
  overflow-y: unset;
  pointer-events: none;
  border-radius: 0 10px 10px 0;
  background: #151A2D;
  transition: 0s;
}

.sidebar.collapsed .dropdown-menu:has(.dropdown-link) {
  padding: 7px 10px 7px 24px;
}

.sidebar.sidebar.collapsed .nav-item:hover>.dropdown-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(12px);
  transition: all 0.4s ease;
}

.sidebar.sidebar.collapsed .nav-item:hover>.dropdown-menu:has(.dropdown-link) {
  transform: translateY(10px);
}

.dropdown-menu .nav-item .nav-link {
  color: #F1F4FF;
  padding: 9px 15px;
}

.sidebar.collapsed .dropdown-menu .nav-link {
  padding: 7px 15px;
}

.dropdown-menu .nav-item .nav-link.dropdown-title {
  display: none;
  color: #fff;
  padding: 9px 15px;
}

.dropdown-menu:has(.dropdown-link) .nav-item .dropdown-title {
  font-weight: 500;
  padding: 7px 15px;
}

.sidebar.collapsed .dropdown-menu .nav-item .dropdown-title {
  display: block;
}

.sidebar-menu-button {
  display: none;
}

a.nav-link.dropdown-link {
    font-size: small;
}

#page-content {
  margin-left: 270px;
  padding: 20px; 
}

table.dataTable {
  border: 1px solid #b5dcb5;
  background-color: #fff;
}
.yes {
  color: green;
  font-weight: bold;
}
.no {
  color: red;
  font-weight: bold;
}

td.details-control::before {
  font-family: 'Material Symbols Rounded';
  content: 'expand_more';
  font-size: 24px;
  display: block;
  text-align: center;
  cursor: pointer;
  transition: transform 0.4s ease;
  transform-origin: center;
  transform: rotate(0deg);      /* zakmnięty = strzałka w dół */
}

tr.shown td.details-control::before {
  transform: rotate(180deg);    /* otwarty = strzałka w górę */
}

/* Kolorowanie wierszy tabeli usersTable */
#usersTable tr.male-row {
  background-color: #e0f0ff;   /* jasnoniebieski */
}

#usersTable tr.female-row {
  background-color: #ffe7f0;   /* jasnoróżowy */
}

.grid-stack-item-content {
	border-radius: 10px;
}

/* === FORMULARZ DODAWANIA UŻYTKOWNIKA === */
.add-user-container {
  display: flex;
  justify-content: center;
  padding-top: 60px;
}

.add-user-form {
  background-color: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: 400px;
  max-width: 95%;
}

.add-user-form label {
  font-weight: 500;
  color: #2e7d32;
  margin-bottom: 0.25rem;
}

.add-user-form input,
.add-user-form select {
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.add-user-form input:focus,
.add-user-form select:focus {
  border-color: #56ab2f;
  outline: none;
}

.add-user-form button {
  background-color: #56ab2f;
  color: white;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.add-user-form button:hover {
  background-color: #449a23;
}

#passwordStrength {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  margin-bottom: 8px;
  overflow: hidden;
  position: relative;
}

#strengthBar {
  height: 100%;
  width: 0%;
  transition: width 0.3s ease;
}

#strengthText {
  font-size: 0.85rem;
  display: block;
  margin-top: 4px;
  color: #444;
}

/* Pasek narzędziowy */
.widget-editable {
  position: relative;
  overflow: hidden;
}
.widget-toolbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 32px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  background: rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.25s;
  padding: 0 6px;
  z-index: 10;
}
.widget-editable:hover .widget-toolbar {
  opacity: 1;
}

/* Przyciski */
.widget-btn {
  color: #fff;
  font-size: 18px;
  margin-left: 10px;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
}
.widget-btn:hover {
  color: #ffd700;
}

.allotment-details table {
    border: 2px solid #2c7a2c; /* zielona ramka wokół tabeli */
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 20px;
}

.allotment-details th, .allotment-details td {
    border: 1px solid #2c7a2c; /* ramka między komórkami */
    padding: 8px 12px;
    text-align: left;
}

.allotment-details th {
    background-color: #e2f0e2; /* lekki zielony nagłówek */
}

.allotment-details tr:not(:first-child) {
    height: 30px; /* odstęp między wierszami */
}

.table-rates {
    border: 2px solid #2c7a2c; /* zielona ramka wokół tabeli */
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 20px;
}

.table-rates th, .table-rates td {
    border: 1px solid #2c7a2c; /* ramka między komórkami */
    padding: 8px 12px;
    text-align: left;
}

.table-rates th {
    background-color: #e2f0e2; /* lekki zielony nagłówek */
}

.table-rates tr:not(:first-child) {
    height: 30px; /* odstęp między wierszami */
}

.button-class {
  background-color: #56ab2f;
  color: white;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s;
}

.button-class:hover {
  background-color: #449a23;
}

span.material-symbols-rounded.icon-off {
    color: #999;
    margin-left: 10px;
    font-size: medium;
}

span.material-symbols-rounded.icon-ok {
    color: #56ab2f;
    margin-left: 10px;
    font-size: medium;
}

.textarea-user-info {
    width: stretch;
    height: 100px;
    padding: 5px;
}

/* === MODAL: Dodawanie odczytu wodomierza === */
.dynamic-edit-modal form {
  display: flex;
  flex-direction: column;
  gap: 1rem; /* odstępy między polami */
  padding: 0.5rem;
}

.dynamic-edit-modal label {
  font-weight: 500;
  color: #2e7d32;
  margin-bottom: 0.25rem;
  display: block;
}

.dynamic-edit-modal input,
.dynamic-edit-modal select {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  transition: border-color 0.2s;
}

.dynamic-edit-modal input:focus,
.dynamic-edit-modal select:focus {
  border-color: #56ab2f;
  outline: none;
}

/* Styl przycisków w oknie dialogowym */
.ui-dialog-buttonpane {
  padding: 1rem !important;
}

.ui-dialog-buttonpane button {
  background-color: #56ab2f !important;
  color: white !important;
  padding: 0.6rem 1.2rem !important;
  border: none !important;
  border-radius: 8px !important;
  font-weight: bold !important;
  cursor: pointer;
  transition: background 0.3s, transform 0.1s;
  font-family: "Poppins", sans-serif !important;
  font-size: 1rem !important;
}

.ui-dialog-buttonpane button:hover {
  background-color: #449a23 !important;
  transform: scale(1.02);
}

.ui-dialog-titlebar {
  background: linear-gradient(90deg, #4caf50, #66bb6a) !important;
  color: white !important;
  font-weight: 600;
  border: none !important;
}

.ui-dialog {
  border-radius: 12px !important;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.15) !important;
}

/* === GLOBAL ALERT MODAL === */
#globalAlertModal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999; /* ponad wszystko */
  backdrop-filter: blur(2px);
}

#globalAlertModal .alert-content {
  background: #fff;
  border-radius: 12px;
  padding: 1.5rem 2rem;
  width: min(90%, 400px);
  box-shadow: 0 0 20px rgba(0,0,0,0.35);
  text-align: center;
  font-family: "Poppins", sans-serif;
  position: relative;
  animation: popIn 0.25s ease-out;
}

#globalAlertModal .alert-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

#globalAlertModal .alert-message {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 1.5rem;
}

#globalAlertModal button {
  background: #56ab2f;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.25s;
}

#globalAlertModal button:hover {
  background: #449a23;
}

/* Typy alertów */
#globalAlertModal.info .alert-icon { color: #2e7d32; }
#globalAlertModal.warning .alert-icon { color: #ff9800; }
#globalAlertModal.error .alert-icon { color: #e53935; }

/* Animacja wejścia */
@keyframes popIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

#tab-readings tr.refreshing {
  animation: flashRow 0.6s ease-in-out;
}
@keyframes flashRow {
  0% { background-color: #d9ffd9; }
  100% { background-color: transparent; }
}

span.row-edit-btn,
span.row-pwr-edit-btn
 {
    padding: 10px;
    font-family: 'Material Symbols Rounded';
    color: #666;
	cursor: pointer;
}

span.row-noedit-btn {
    padding: 10px;
    font-family: 'Material Symbols Rounded';
    color: #ccc;
	cursor: not-allowed;
}

/* Responsive media query code for small screens */
@media (max-width: 768px) {
  .sidebar-menu-button {
    position: fixed;
    left: 10px;
    top: 9px;
    height: 40px;
    width: 42px;
    display: flex;
    color: #F1F4FF;
    background: #151A2D;
  }

  .sidebar.collapsed {
    width: 270px;
    left: -270px;
  }

  .sidebar.collapsed .sidebar-header .sidebar-toggler {
    transform: none;
  }

  .sidebar.collapsed .sidebar-nav .primary-nav {
    transform: translateY(15px);
  }
  
  #page-content {
  margin-left: 0px;
  padding: 20px; 
}
}