/* ==========================================================================
   Warstwa integracyjna nowego designu (index.php).
   Style dla mechanizmow przeniesionych ze starej strony, ktore nie mialy
   odpowiednika w dostarczonym designie: pulsowanie karty "serwer testowy"
   (parametr ?testvps) oraz modal z prezentem (kurs n8n za 1 grosz).
   Uzywa wylacznie tokenow z style.css - zero wlasnych kolorow brandowych.
   ========================================================================== */

/* Cennik: wyroznienie ograniczen planu (np. brak Dockera). */
.ptable .sub-alert { color: #ff5f57; font-weight: 600; }

/* Terminal w hero tylko na desktopie. */
@media (max-width: 940px) {
  .hero-grid .reveal:has([data-terminal]) { display: none; }
}

/* NextCloud: ograniczenie oferty - ma byc dobrze widoczne pod cennikiem. */
.nc-limit {
  max-width: 780px;
  margin: 18px auto 0;
  padding: 14px 20px;
  text-align: center;
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text-strong);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.nc-limit code {
  color: var(--orange-bright);
}

/* FROG: bez zielonego wyróznienia (ma nie konkurwac z platnymi planami). */
.ptable .pl-price.free { color: inherit; }
.ptable tr.free-row td {
  border-top: 1px solid var(--border);
  background: transparent;
}
.ptable tr.free-row:hover td { background: var(--surface-2); }
.ptable tr.free-row .pl-name { color: inherit; }
.tbadge.free {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
}

/* Filary ("Dlaczego Mikrus") reaguja na hover tak samo jak kafle "Mozliwosci":
   podswietlenie tla zamiast unoszenia sie kafla. */
.pillar { transition: border-color .2s, background .2s; }
.pillar:hover { border-color: var(--border-2); background: var(--surface-2); transform: none; }

/* Badge PRO na zielono - pomaranczowy zlewal sie z akcentami cennika. */
.tbadge.pro {
  background: linear-gradient(180deg, #2ee08c, var(--green));
  color: #04140c;
  box-shadow: 0 4px 12px -4px rgba(33, 208, 122, 0.75);
}
@media (max-width: 720px) {
  .ptable tr.free-row {
    border-color: var(--border);
    background: var(--surface);
  }

  /* Na telefonie najpierw 2.1 (najczesciej wybierany), potem 1.0. Desktop bez zmian. */
  .cat-panel[data-panel="vps"] .ptable tbody {
    display: flex;
    flex-direction: column;
  }
  .cat-panel[data-panel="vps"] .ptable tbody tr.plan-m21 { order: -2; }
  .cat-panel[data-panel="vps"] .ptable tbody tr.plan-m10 { order: -1; }
}

/* ---------- Regulamin: wyroznienia jak na obecnej stronie ----------
   Numeracja i naglowki punktow glownych w kolorze brandowym, a w punktach
   zagniezdzonych wyroznione fragmenty ("Lista uslug zakazanych" itp.).
   Odpowiednik privacy-policy.css ze starej skorki. */
.doc-content--regulamin > ol > li {
  color: var(--text-strong);
  font-weight: 700;
  margin-top: 36px;
}
.doc-content--regulamin > ol > li:first-child {
  margin-top: 9px;
}
.doc-content--regulamin > ol > li::marker {
  color: var(--orange-bright);
  font-weight: 700;
}
.doc-content--regulamin > ol > li > ol > li {
  color: var(--text);
  font-weight: 400;
}
.doc-content--regulamin > ol > li > ol > li::marker {
  color: currentColor;
  font-weight: 400;
}
.doc-content--regulamin > ol > li > ol > li b,
.doc-content--regulamin > ol > li > ol > li strong {
  color: var(--orange-bright);
  font-weight: 700;
}

/* ---------- Pulsowanie sekcji testowej (?testvps) ---------- */
.risk.is-pulsing { position: relative; isolation: isolate; }
.risk.is-pulsing::before,
.risk.is-pulsing::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 2px solid var(--orange);
  box-shadow: 0 0 24px 4px rgba(238, 114, 37, 0.45), 0 0 48px 8px rgba(238, 114, 37, 0.25);
  z-index: -1;
  pointer-events: none;
  will-change: transform, opacity;
  animation: ng-trial-pulse 2.2s cubic-bezier(0.22, 0.61, 0.36, 1) infinite;
}
.risk.is-pulsing::after { animation-delay: 1.1s; }

@keyframes ng-trial-pulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.06); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .risk.is-pulsing::before,
  .risk.is-pulsing::after { animation: none; display: none; }
}

/* ---------- Modal z prezentem do serwera testowego ---------- */
.ng-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.ng-modal[hidden] { display: none; }
.ng-modal.open { opacity: 1; pointer-events: auto; }

.ng-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 9, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.ng-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 30px 26px;
  text-align: center;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 24px 64px -18px rgba(0, 0, 0, 0.75);
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.ng-modal.open .ng-modal__dialog { transform: translateY(0) scale(1); }

.ng-modal__close {
  position: absolute;
  top: 6px;
  right: 12px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, transform 0.15s ease;
}
.ng-modal__close:hover { color: var(--text); transform: scale(1.1); }

.ng-modal__title { margin: 0 0 10px; font-size: 22px; line-height: 1.3; }
.ng-modal__title b { color: var(--orange-bright); }
.ng-modal__lead { margin: 0 0 22px; color: var(--muted); font-size: 15px; }

.ng-modal__actions { display: grid; gap: 10px; }
@media (min-width: 640px) {
  .ng-modal__actions { grid-auto-flow: column; justify-content: center; gap: 12px; }
  .ng-modal__actions .btn { min-width: 200px; }
}

body.ng-modal-open { overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  .ng-modal,
  .ng-modal__dialog { transition: none; }
}

/* ---------- "Ktory model wybrac": tabela na desktopie, karty na telefonie ---------- */
.mfit-mark {
  display: inline-flex;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}
.mfit-mark svg { width: 15px; height: 15px; }
.mfit-mark--ok { background: var(--green-soft); color: var(--green); }
.mfit-mark--mid { background: var(--orange-soft); color: var(--orange-bright); }
.mfit-mark--no { background: rgba(255, 95, 87, 0.12); color: #ff5f57; }

.mfit-scroll-hint {
  display: none;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
  margin-top: 10px;
}
.mfit-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 22px;
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
}
.mfit-legend li { display: inline-flex; align-items: center; gap: 8px; }
.mfit-legend .mfit-mark { width: 24px; height: 24px; }
.mfit-legend .mfit-mark svg { width: 13px; height: 13px; }

/* ----- Desktop / tablet: klasyczna tabela ----- */
@media (min-width: 761px) {
  .mfit-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: var(--shadow-card);
  }
  .mfit {
    width: 100%;
    min-width: 680px;
    border-collapse: collapse;
  }
  .mfit thead th {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-strong);
    text-align: center;
    padding: 16px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
  }
  .mfit thead th:first-child,
  .mfit tbody th {
    text-align: left;
    font-family: var(--font-sans);
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0;
  }
  .mfit tbody th {
    font-size: 15px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    white-space: nowrap;
  }
  .mfit tbody td {
    text-align: center;
    padding: 14px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
  }
  .mfit tbody tr:last-child th,
  .mfit tbody tr:last-child td { border-bottom: none; }
  .mfit tbody tr:hover th,
  .mfit tbody tr:hover td { background: rgba(255,255,255,0.02); }
  /* pierwsza kolumna zostaje widoczna przy przewijaniu w bok */
  .mfit thead th:first-child,
  .mfit tbody th {
    position: sticky;
    left: 0;
    z-index: 1;
    box-shadow: 8px 0 12px -12px rgba(0,0,0,0.7);
  }
  .mfit thead th:first-child { z-index: 2; }
}
@media (min-width: 761px) and (max-width: 940px) {
  .mfit-scroll-hint { display: block; }
}

/* ----- Telefon: kazde zastosowanie to karta z kafelkami modeli (zero scrolla w bok) ----- */
@media (max-width: 760px) {
  .mfit-wrap { display: block; overflow: visible; border: none; background: none; box-shadow: none; }
  .mfit { display: block; width: 100%; min-width: 0; border-collapse: collapse; }
  .mfit thead { display: none; }
  .mfit tbody { display: block; }

  .mfit tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 16px 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .mfit tbody tr:last-child { margin-bottom: 0; }

  .mfit tbody th {
    grid-column: 1 / -1;
    display: block;
    position: static;
    box-shadow: none;
    margin-bottom: 4px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--border);
    background: none;
    text-align: left;
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-strong);
  }

  .mfit tbody td.mfit-c {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
  }
  .mfit tbody td.mfit-c::before { content: attr(data-model); }
  /* w kafelku kolor niesie samo tlo, wiec znaczek bez wlasnej obwodki */
  .mfit tbody td.mfit-c .mfit-mark { width: 18px; height: 18px; background: none; }
  .mfit tbody td.mfit-c .mfit-mark svg { width: 13px; height: 13px; }

  .mfit tbody td.mfit-c--ok { border-color: var(--green-line); background: var(--green-soft); color: var(--green); }
  .mfit tbody td.mfit-c--mid { border-color: var(--orange-line); background: var(--orange-soft); color: var(--orange-bright); }
  .mfit tbody td.mfit-c--no { border-color: rgba(255,95,87,0.30); background: rgba(255,95,87,0.10); color: #ff5f57; }

  .mfit-legend { gap: 8px 16px; font-size: 13px; }
}
@media (max-width: 380px) {
  .mfit tbody tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Przyciski w tresci dokumentow
   `.doc-content a` (0,1,1) bije `.btn-primary` (0,1,0), wiec przycisk wewnatrz
   dokumentu dostawal pomaranczowy tekst i podkreslenie zamiast wariantu .btn.
   ========================================================================== */
.doc-content a.btn { text-decoration: none; }
.doc-content a.btn-primary { color: #fff; }
.doc-content a.btn-ghost { color: var(--text); }
.doc-content a.btn-green { color: #04140c; }
.doc-content a.btn-primary:hover { color: #fff; }
.doc-content a.btn-ghost:hover { color: var(--text); }
.doc-content a.btn-green:hover { color: #04140c; }
