/* =========================
   app.css (clean)
   ========================= */

:root{
  --bg: #0b0f19;
  --panel: #121a2a;
  --text: #e8eefc;
  --muted: rgba(232,238,252,.7);
  --border: rgba(232,238,252,.12);
  --accent: #0082fb;
  --danger: #ff6a6a;
  --ok: #09e983;

  /* spójne tokeny UI */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-lg: 16px;

  --gap: 16px;
  --pad: 16px;

  --shadow: 0 10px 30px rgba(0,0,0,.22);
  --glass: rgba(18,26,42,.72);
  --glass-strong: rgba(18,26,42,.92);

  --focus: rgba(106,166,255,.45);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }

/*
   - tło (gradient) przeniesione na html, żeby nie “urywało się” na długich stronach
   - dokładamy delikatny fade do jednolitego tła w dół
*/
html{
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 700px at 20% 10%, rgba(106,166,255,.18), transparent 60%),
    radial-gradient(900px 600px at 80% 30%, rgba(106,255,177,.10), transparent 55%),
    linear-gradient(to bottom, rgba(11,15,25,0) 0, var(--bg) 85vh);
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans";
  color: var(--text);
  background: transparent; /* tło bierze html */
  padding-bottom: env(safe-area-inset-bottom);

  /* sticky footer bez kombinowania w HTML */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}


/* żeby flex/grid nie rozpychały kontenera */
.appHeader, .timerPanel, .plannerPanel, .modalCard{
  min-width: 0;
  height: fit-content;
}

/* =========================
   Layout
   ========================= */

.appShell{
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(12px, 2.2vw, 18px);
  display: grid;
  gap: var(--gap);

  /* main ma wypełniać wysokość między headerem a stopką */
  width: 100%;
  /*flex: 1 0 auto;*/
}


/* =========================
   Header
   ========================= */
   
/* ukrycie wizualne, ale dostępne dla czytników */
.srOnly{
  position:absolute !important;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}

.brandLogoLink{ display:flex; align-items:center; }
.brandLogo{ display:block; height:32px; width:auto; }


.appHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  padding: 14px 16px;
  border: 1px solid var(--border);
  background: rgba(18,26,42,.75);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand{ min-width: 0; }

.brandTitle{
  display: block;
  margin: 0;
  font-weight: 900;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brandSubtitle{
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.headerActions{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* =========================
   Panels
   ========================= */

.timerPanel,
.plannerPanel{
  border: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: var(--pad);
  box-shadow: var(--shadow);
  margin-bottom: 15px;
}

.accountPanel{
	margin-bottom: 10px;
}
.historyPanel{
	
}

/* =========================
   Controls: buttons, inputs
   ========================= */

.btn,
.input,
.select{
  min-height: 42px; /* ergonomia dotyk/mysz */
}

.input, .select{
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.25);
  color: var(--text);
  outline: none;
}

.btn{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.05);
  color: var(--text);
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
  user-select: none;
}

.btn:active{ transform: translateY(1px); }
.btn:hover{ background: rgba(255,255,255,.08); }

.btnSmall{
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  min-height: 36px;
}

.btnPrimary{
  background: rgba(106,166,255,.22);
  border-color: rgba(106,166,255,.35);
}

.btnGhost{
  background: transparent;
}

.btnDanger{
  border: 1px solid rgba(255,80,80,.35);
  background: rgba(255,80,80,.08);
}
.btnDanger:hover{ background: rgba(255,80,80,.14); }

/* czytelny focus bez “śmietnika” */
.btn:focus-visible,
.input:focus-visible,
.select:focus-visible{
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* =========================
   Timer
   ========================= */

.timerTop{
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.segmentBadge{
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .6px;
}

.segmentMeta{
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.segmentTitle{ font-weight: 800; }
.segmentNext{ font-size: 12px; color: var(--muted); }

.timerDisplay{
  font-variant-numeric: tabular-nums;
  font-size: clamp(56px, 8vw, 104px);
  font-weight: 950;
  letter-spacing: 1px;
  line-height: 1;

  padding: 20px 10px;
  text-align: center;

  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: rgba(0,0,0,.20);
}

.timerControls{
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.adjustGroup{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.timerHint{
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.timerHint a {
	color: var(--text);
}

/* =========================
   Planner
   ========================= */

.panelTitle{
  margin: 0 0 10px 0;
  font-size: 18px;
}

.plannerHeader{
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/*
   - 3 równe kafle
   - zajmują 100% szerokości rodzica
*/
.defaults{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
}

.defaultItem{
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,.16);
}

.defaultLabel{
  font-size: 13px;
  color: var(--muted);
  min-width: 0;
  flex: 1 1 auto;
}

.stepper{
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.stepValue{
  font-weight: 900;
  width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.unit{
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.plannerActions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.scheduleList{
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.segmentRow{
  display: flex;
  align-items: center;
  gap: 10px;

  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,.16);
}

.segmentType{
  font-weight: 900;
  width: 90px;
}

.segmentRow[data-type="work"] .segmentType{ color: var(--accent); }
.segmentRow[data-type="break"] .segmentType{ color: var(--ok); }

.segmentMinutes{
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  width: 64px;
}

.segmentRowActions{
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =========================
   Presets
   ========================= */

.presetRow{
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);

  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.presetSave, .presetLoad{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* =========================
   Footer
   ========================= */

.appFooter{
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 8px 0 2px;
}

/* =========================
   Modal
   ========================= */

.modalBackdrop{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}

.modalCard{
  width: min(520px, 100%);
  border: 1px solid var(--border);
  background: var(--glass-strong);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.modalHeader{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.modalTitle{
  font-weight: 950;
  letter-spacing: .2px;
}

.modalBody{
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fieldLabel{
  font-size: 12px;
  color: var(--muted);
}

.modalActions{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* =========================
   History
   ========================= */

.historyFilters{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin: 10px 0 14px;
}

.historyQuick{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.historyDateInputs{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.historyType{
  margin-left: auto;
  min-width: 180px;
}

.historySummary{
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}

.summaryCard{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,.03);
}

.summaryLabel{ font-size: 12px; color: var(--muted); }
.summaryValue{ font-size: 22px; font-weight: 950; margin-top: 6px; }

.historyList{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.dayGroup{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(255,255,255,.02);
}

.dayHeader{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
}

.dayTitle{ font-weight: 950; }

.dayStats{
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.entryRow{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

.dayEntries.isCollapsed {
  display: none;
}

/* opcjonalnie: przycisk wygląda jak link/etykieta */
.dayToggle {
  background: transparent;
  color: var(--ok);
  border: 0;
  padding: 0;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}

.entryType{ font-weight: 900; }
.entryMeta{ font-size: 12px; color: var(--muted); }

.historyPager{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.historyExtras{
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0 6px;
}

.checkboxRow{
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.historyButtons{
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}



/* =========================
   Info (SEO content)
   ========================= */

.infoPanel{
  margin-top: 12px;
}

.infoLead{
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.infoGrid{
  display: grid;
  gap: 10px;
  margin-top: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.infoCard{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: rgba(0,0,0,.16);
}

.infoCardTitle{
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 950;
  letter-spacing: .2px;
}

.infoCardText{
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.infoSubTitle{
  margin: 14px 0 8px;
  font-size: 15px;
  font-weight: 950;
}

.infoList{
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
  color: rgba(232,238,252,.88);
  line-height: 1.6;
}

.infoNote{
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed rgba(232,238,252,.18);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255,255,255,.03);
}

/* =========================
   Sticky footer (global)
   ========================= */

.siteFooter{
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.siteFooterInner{
  max-width: 1100px;
  margin: 0 auto;
}

.footerLink{
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid rgba(232,238,252,.25);
}

.footerLink:hover{
  border-bottom-color: rgba(232,238,252,.55);
}

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

/* tablet */
@media (max-width: 900px){
  .appHeader{ flex-wrap: wrap; }
  .headerActions{ justify-content: flex-start; }

  /* defaults 2 kolumny + ostatni na pełną szerokość */
  .defaults{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .defaults .defaultItem:last-child{
    grid-column: 1 / -1;
  }

  .segmentRow{ flex-wrap: wrap; }
  .segmentRowActions{
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
}

/* historia summary w jednej kolumnie */
@media (max-width: 820px){
  .historySummary{ grid-template-columns: 1fr; }
}

/* mniejsze ekrany */
@media (max-width: 720px){
  .brandTitle{
    white-space: normal;
    max-width: 100%;
  }

  .appHeader{
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }

  .headerActions{
    width: 100%;
    justify-content: flex-start;
    gap: 8px;
  }

  .presetRow{
    flex-direction: column;
    align-items: stretch;
  }
  .presetSave, .presetLoad{
    width: 100%;
    align-items: stretch;
  }
  .presetSave .input,
  .presetLoad .select{
    width: 100%;
  }

  .historyFilters{ align-items: stretch; }
  .historyDateInputs{ width: 100%; }
  .historyType{
    margin-left: 0;
    width: 100%;
    min-width: 0;
  }
  .historyType .input{ width: 100%; }
}

/* telefony */
@media (max-width: 520px){
  .timerPanel, .plannerPanel{ padding: 14px; }

  /* header actions w grid 2 kolumny */
  .headerActions{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
    justify-content: initial;
  }
  .headerActions .btn,
  .headerActions a.btn{
    width: 100%;
    text-align: center;
  }

  /* defaults 1 kolumna */
  .defaults{
    grid-template-columns: 1fr;
  }
  .defaults .defaultItem:last-child{
    grid-column: auto;
  }

  /* timer controls jako grid */
  .timerControls{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    justify-content: initial;
  }
  .timerControls > .btn{
    width: 100%;
    text-align: center;
  }

  .adjustGroup{
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .adjustGroup .btn{
    width: 100%;
    text-align: center;
  }

  /* planner actions jako grid */
  .plannerActions{
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  #btnAddWork{ grid-column: 1 / -1; }
  .plannerActions .btn{
    width: 100%;
    text-align: center;
  }

  /* segmentRow jako “karta” */
  .segmentRow{
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px 10px;
  }
  .segmentType{ width: auto; }
  .segmentMinutes{ width: auto; text-align: right; }

  .segmentRowActions{
    grid-column: 1 / -1;
    width: 100%;
  }

  /* modal przyciski w kolumnie */
  .modalActions{
    flex-direction: column;
  }
  .modalActions .btn{
    width: 100%;
  }
}

/* AdSense */
/* slot jest niewidoczny, dopóki nie ma fill lub komunikatu adblock */
.adsenseSlot { text-align: center; margin: 12px auto; }

.adsenseSlot.adblockNotice {
  display: block !important;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(255, 255, 255, 0.18);
}

.adblockTitle { font-weight: 700; margin-bottom: 6px; }
.adblockText { opacity: .9; line-height: 1.35; }
