/* =========================
   BASE STYLES
========================= */
body {
    font-size: 2rem; /* 2x powiększenie czcionki */
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #f8fafc; /* <- tutaj zmienisz tło całej strony */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
}

main {
    display: flex;
    flex: 1;
    gap: 1rem;
    padding: 1rem;
    flex-grow: 1;
}

/* =========================
   HEADER
========================= */
.main-header {
    background-color: white; /* <- tło nagłówka */
    border-bottom: 1px solid #e5e7eb;
    padding: 1.0rem 2rem;
    text-align: center;
}

.header-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.header-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0.25rem 0 0 0;
}

/* =========================
   LEFT PANEL / FORM
========================= */
.left-panel {
    flex: 1 1 15%;
    /* min-width: 1000px; */
    background-color: #fff;
    padding: 0.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.add-button {
    display: block;
    width: 100%;
    font-size: 1.15rem;
    text-align: center;
    font-weight: bold;
    padding: 8px 12px;
    margin-top: 8px;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.group-row {
    display: flex;
    font-size: 22px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.group-column {
    display: flex;
    flex-direction: column;   /* wiersze układają się pionowo */
    gap: 10px;                /* odstęp między wierszami */
    width: 100%;
}

.group-column label {
    display: flex;            /* tekst + input w jednej linii */
    justify-content: flex-end; /* tekst po lewej, input po prawej w labelu */
    align-items: center;      /* wyrównanie pionowe */
    gap: 8px;                 /* odstęp między label-text a inputem */
    width: 100%;              /* wypełnia szerokość kontenera */
    box-sizing: border-box;
}

.group-column input {
    width: auto;              /* używa szerokości z klasy form-input-a / b */
    flex-shrink: 0;           /* nie kurczy się */
}

#groups-container {
    width: 100%;          /* dopasowanie do panelu */
    max-height: calc((1em + 9px) * 9); /* wysokość 9 grup, dostosuj jeśli gap jest inny */
    overflow-y: auto;     /* pojawia się pasek przewijania, gdy więcej niż 9 grup */
    border: 1px solid #ccc; /* opcjonalnie */
    padding: 8px;
    box-sizing: border-box;
}

.form-input {
    /* font-size: 20px; */
    padding: 4px 6px;
    box-sizing: border-box;
    width: auto; /* domyślna szerokość */
}

.form-input-a { width: 60px !important; }
.form-input-b { width: 140px !important; font-size: 18px;}

#dist-select {
    width: 150px;
    box-sizing: border-box;
    display: block;     /* żeby width działało w flexboxie */
    font-size: 1rem; /* jeśli chcesz większy tekst, np. 125% */
    padding: 6px 8px;   /* dopasowanie paddingu do inputów */
}

.single-row {
    display: flex;
    font-size: 18px;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.single-row label {
    flex: 0 0 100px;
    text-align: right;
}

.single-row input {
    flex: 1 1 auto;
    padding: 4px 6px;
    box-sizing: border-box;
}

.submit-button {
    margin-top: 10px;
    width: 100%;
    background-color: #154ca4;
    color: #fff;
    border: none;
    padding: 0.75rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.15rem;
    transition: background-color 0.2s;
}

.submit-button:hover {
    background-color: #2563eb;
}

#btn-save {
    background-color: #10612e; /* ciemna zieleń */
    color: #fff; /* biały tekst */
}

#btn-save:hover:not(:disabled) {
    background-color: #13803a; /* jaśniejsza zieleń przy najechaniu */
}

#btn-save:disabled {
    background-color: #7fbf91; /* stonowana zieleń gdy nieaktywny */
    cursor: not-allowed;
}

/* tooltip */
.tooltip {
  position: relative;      /* konieczne dla absolutnego pozycjonowania chmurki */
  cursor: help;
  color: #010f3d;
  font-size: 1.3rem;
  font-weight: bold;
  display: inline-flex;    /* label + input w jednej linii */
  align-items: center;
  gap: 8px;

  overflow: visible;       /* ważne, żeby tooltip nie był ucinany */
}

/* chmurka z opisem */
.tooltiptext {
  visibility: hidden;
  max-width: 33vw;
  min-width: 150px;
  white-space: normal;      /* umożliwia łamanie tekstu */
  background-color: #374151;
  color: #fff;
  text-align: center;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  position: absolute;
  z-index: 1000;            /* nad innymi elementami */
  bottom: 125%;             /* nad elementem */
  left: 0;
  opacity: 0;
  transition: opacity 0.2s;
  box-sizing: border-box;
}

/* pokaz tooltip przy hover tylko na label-text */
.tooltip .label-text:hover + .tooltiptext {
  visibility: visible;
  opacity: 1;
}

/* kontener */
#groups-container, .group-row, .left-panel {
  overflow: visible; /* tooltip nie ucina się */
}

/* label + input w linii */
.group-column label {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* =========================
   ICONS / TOOLTIP
========================= */
.icon, i[data-feather] {
    width: 16px;
    height: 16px;
    cursor: help; /* pokazuje tooltip */
    color: #6b7280;
    flex-shrink: 0;
}

/* =========================
   CENTER PANEL / CHART
========================= */
.center-panel {
    flex: 2 1 72%; /* zajmuje resztę miejsca */
    min-width: 900px; 
    overflow: auto; 
    background-color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid #e5e7eb;
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    max-width: 100%;
    max-height: 100%;
}

/* =========================
   RIGHT PANEL / STATS
========================= */
.right-panel {
    flex: 0 0 10%;
    background-color: #fff;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nt-error {
  display: none;
  color: #c00;
  font-size: 22px;
  margin-top: 6px;
}

.section-title {
    font-size: 1.7rem;
    font-weight: 700;
    color: #07162b;
    margin: 0 0 1rem 0;
}

.stats-type {
    font-size: 1.1rem;
    font-weight: 650;
    color: #16407a;
    margin: 0 0 0 0;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: #f9fafb;
    border-radius: 0.25rem;
}

.stat-label {
    font-size: 1rem;
    color: #374151;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

/* Kontener label + select w jednej linii */
.window-select-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    width: 100%;            /* kontener zajmuje całą szerokość */
}

/* Label */
.window-select-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    flex-shrink: 0;         /* nie kurczy się */
}

/* Select */
.window-select {
    height: 1.8em;          /* 2× wysokość domyślnej czcionki (em = rozmiar fontu) */
    font-size: 1rem;
    padding: 0 6px;
    border: 1px solid #ccc;
    border-radius: 0.25rem;
    background-color: #fff;
    color: #111;
    box-sizing: border-box;
    cursor: pointer;

    flex: 1 1 auto;         /* zajmuje całą dostępną szerokość kontenera */
}

.window-select:hover,
.window-select:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}
/* =========================
   FOOTER
========================= */
.page-footer {
    background-color: white;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 2rem;
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: auto;
}