
:root { --primary:#822630; --primary-dark:#6a1b21; --accent:#42bbfa; --bg:#f1f1f1; --text:#333; --white:#ffffff; --border:#d8d8d8; }
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font-family:"Segoe UI",Roboto,Arial,sans-serif;background:var(--bg);color:var(--text)}

/* Header */
.header{position:relative;background:linear-gradient(90deg,var(--primary),#9a2e39);color:#fff;padding:18px 0;border-bottom:6px solid var(--accent)}
.header-inner{max-width:1280px;margin:0 auto;display:grid;grid-template-columns:auto 1fr auto;align-items:center;column-gap:14px;padding:0 16px}
.logo{height:72px;width:auto;object-fit:contain;display:block}
.header-titlewrap{display:flex;flex-direction:column;gap:2px;align-items:center;text-align:center}
.title{margin:0;font-size:1.5rem;letter-spacing:0.3px;font-weight:700;text-align:center}
.header-subtitle{font-size:1.2rem;font-weight:700;color:#ffffff;letter-spacing:0.3px;text-align:center}
.header-actions{display:flex;align-items:center;gap:8px}
.home-btn{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:8px;background:var(--accent);color:#fff;text-decoration:none;box-shadow:0 3px 8px rgba(0,0,0,.15);font-weight:600}
.home-btn:hover{background:#1aa9f7}
.home-btn svg{width:18px;height:18px;fill:#fff;display:block}

/* Container */
.container{max-width:1280px;margin:24px auto;background:var(--white);border:1px solid var(--border);border-radius:10px;box-shadow:0 6px 16px rgba(0,0,0,.06);padding:20px}
.form-section h2{margin-top:0;color:var(--primary);font-size:1.25rem}
.hint{font-size:.95rem;color:#555;margin-top:4px}

/* Grid */
.two-col-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px;align-items:start}
.col-title{margin:0 0 10px;font-size:1.05rem;color:var(--primary);font-weight:700}
.col .field{margin-bottom:10px}
label{display:block;font-weight:700;margin-bottom:6px;color:var(--primary)}
input[type=text],input[type=number],select{width:100%;padding:10px 12px;border:1px solid var(--border);border-radius:8px;font-size:1rem;color:#333;background:#fff}
input::placeholder{color:#888}

/* Buttons */
.actions{margin-top:10px;display:flex;gap:10px;flex-wrap:wrap}
button,.btn{background:var(--primary);color:#fff;border:none;border-radius:8px;padding:10px 16px;font-size:1rem;cursor:pointer;text-decoration:none;display:inline-flex;align-items:center;gap:8px;font-weight:600;box-shadow:0 3px 8px rgba(0,0,0,.12)}
button:hover,.btn:hover{background:var(--primary-dark)}
.btn-outline{background:transparent;color:var(--primary);border:2px solid var(--primary)}

/* Results */
.results-header{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px}
.results-box{border:1px solid var(--border);border-radius:8px;padding:10px;max-height:520px;overflow-y:auto}
.table{width:100%;border-collapse:collapse}
.table th,.table td{border-bottom:1px solid var(--border);padding:10px;text-align:left;font-size:.96rem}
.table th{background:#f7eff0;color:#6a1b21;position:sticky;top:0;z-index:1}
.no-results{padding:12px;color:#555;font-style:italic}
.small{font-size:.9rem;color:#666}
.site-footer{text-align:center;font-size:12px;color:#555;margin:24px auto 0;padding:12px 0 0}

/* --- RWD / Mobile tweaks --- */
@media(max-width:900px){
  .two-col-grid{grid-template-columns:1fr}
}
@media(max-width:700px){
  .header-inner{grid-template-columns:1fr;row-gap:10px;justify-items:center}
  .logo{height:56px}
  .title{font-size:1.2rem}
  .header-subtitle{font-size:1rem}
  .container{margin:12px auto;padding:14px}
  .results-box{max-height:none}
  .table th,.table td{padding:8px;font-size:.95rem}
}
@media(max-width:520px){
  .home-btn{padding:8px 10px}
  .actions{gap:8px}
  .actions .btn,.actions button{padding:9px 12px;font-size:.95rem}
  /* Tabela – przewijanie w poziomie na bardzo małych ekranach */
  .results-box{overflow-x:auto}
  .table{min-width:640px}
}

/* ===========================================
   RESPONSYWNOŚĆ – TELEFONY, SMARTFONY, TABLETY
   =========================================== */

/* 900px – układ jednokolumnowy */
@media (max-width: 900px) {
  .two-col-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .container {
    padding: 16px;
  }
}

/* 700px – kompresja nagłówka, mniejsze odstępy */
@media (max-width: 700px) {
  .header-inner {
    grid-template-columns: 1fr;
    row-gap: 10px;
    justify-items: center;
    text-align: center;
  }
  .logo {
    height: 56px;
  }
  .title {
    font-size: 1.25rem;
  }
  .header-subtitle {
    font-size: 1rem;
  }
  .container {
    margin: 12px auto;
    padding: 14px;
  }

  input[type=text],
  input[type=number],
  select {
    font-size: 1rem;
    padding: 12px;
  }

  button,
  .btn, .btn-outline {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 1.05rem;
  }

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

/* 520px – telefony kompaktowe (SE, mini) */
@media (max-width: 520px) {

  /* Header */
  .title {
    font-size: 1.1rem;
    line-height: 1.2;
  }

  /* Formularz */
  label {
    font-size: 0.95rem;
  }
  input, select {
    font-size: 1rem;
    padding: 10px;
  }

  /* Przycisk "Strona główna ZSE" */
  .home-btn {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  /* Wyniki – przewijanie */
  .results-box {
    overflow-x: auto;
  }

  .table {
    min-width: 700px;   /* wymusza scroll w poziomie, bez łamania kolumn */
  }

  .table th, .table td {
    padding: 8px;
    font-size: .92rem;
  }

  /* Stopka */
  .site-footer {
    font-size: 11px;
  }
}

/* 400px – najmniejsze ekrany */
@media (max-width: 400px) {
  .logo {
    height: 48px;
  }
  .title {
    font-size: 1rem;
  }
  input, select {
    font-size: 0.95rem;
  }
}
/* ===========================================
   RWD + ANIMACJE + BACK-TO-TOP + OVERLAY
   =========================================== */

/* Płynne przewijanie w całym dokumencie (z poszanowaniem preferencji) */
html { scroll-behavior: smooth; }

/* Sticky header + animacja „shrink” po przewinięciu */
.header {
  position: sticky; top: 0; z-index: 1000;
  transition: padding .25s ease, box-shadow .25s ease, background .25s ease;
}
.header.shrink {
  padding: 10px 0;
  box-shadow: 0 6px 16px rgba(0,0,0,.08);
}
.header.shrink .logo { height: 48px; }
.header.shrink .title { font-size: 1.1rem; }

/* Subtelne przejścia na interaktywnych elementach */
button, .btn, .btn-outline, .home-btn, input, select {
  transition: background-color .2s ease, color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .08s ease;
}
button:active, .btn:active, .home-btn:active { transform: translateY(1px); }

/* Fade-in kontenerów (używamy klasy .fade-in) */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn .25s ease-out both; }

/* Overlay „Ładowanie…” (pokazywany przed auto-submit) */
#loadingOverlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center;
  z-index: 2000;
}
#loadingOverlay.show { display: flex; }
.loading-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(130,38,48,.2);
  border-top-color: var(--primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* FAB: Powrót do góry */
#backToTop {
  position: fixed; right: 16px; bottom: 16px; z-index: 1500;
  width: 44px; height: 44px; border: none; border-radius: 50%;
  background: var(--accent); color: #fff; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 10px 20px rgba(0,0,0,.18), 0 3px 6px rgba(0,0,0,.12);
}
#backToTop svg { width: 20px; height: 20px; fill: #fff; }
#backToTop.show { display: flex; }
#backToTop:hover { background: #1aa9f7; }
#backToTop:active { transform: translateY(1px); }

/* RWD – korekty pod telefony */
@media (max-width: 900px) {
  .two-col-grid { grid-template-columns: 1fr; gap: 12px; }
  .container { padding: 16px; }
}
@media (max-width: 700px) {
  .header-inner { grid-template-columns: 1fr; row-gap: 10px; justify-items: center; text-align: center; }
  .logo { height: 56px; }
  .title { font-size: 1.2rem; }
  .header-subtitle { font-size: 1rem; }
  .container { margin: 12px auto; padding: 14px; }
  button, .btn, .btn-outline { width: 100%; justify-content: center; padding: 12px; font-size: 1.05rem; }
  .actions { flex-direction: column; gap: 10px; }
}
@media (max-width: 520px) {
  .home-btn { padding: 8px 10px; font-size: 0.9rem; }
  .results-box { overflow-x: auto; }
  .table { min-width: 700px; }
  .table th, .table td { padding: 8px; font-size: .92rem; }
  .site-footer { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

