/* --- 1. ZMIENNE SYSTEMOWE (Brand Book) --- */
:root {
    --bg-main: #0f0f13;
    --bg-card: #1a1a20;
    --text-main: #ffffff;
    --text-muted: #a1a1aa;
    --accent-primary: #724cb8;
    --accent-hover: #5e31a7;
    --glow: rgba(114, 76, 184, 0.15);
}

/* --- 2. BAZA --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Montserrat', sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- 3. NAWIGACJA --- */
header {
    background-color: var(--bg-card);
    box-shadow: 0 4px 24px var(--glow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
}

.brand-logo {
    display: inline-block;
    margin-bottom: 16px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 800;
    font-size: 20px;
}

.brand-logo span {
    color: var(--accent-primary);
}

.logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.nav-tabs {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs::-webkit-scrollbar {
    display: none;
}

.tab-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 16px;
    border-radius: 8px;
    white-space: nowrap;
    transition: all 0.2s ease-in-out;
    border: 1px solid transparent;
}

.tab-link:hover {
    color: var(--text-main);
    background-color: rgba(114, 76, 184, 0.05);
}

.tab-link.active {
    color: var(--text-main);
    background-color: var(--accent-hover);
    border-color: var(--accent-primary);
    box-shadow: 0 0 12px var(--glow);
}

/* --- 4. OBSZAR ROBOCZY (Main) --- */
main {
    flex-grow: 1;
    display: flex;
    align-items: flex-start; /* Zmienione, by main nie centrował w pionie na dużych ekranach */
    justify-content: center;
    padding: 24px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.system-status-card {
    background-color: var(--bg-card);
    width: 100%;
    max-width: 480px;
    padding: 40px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--glow);
    text-align: center;
    margin-top: 40px; /* Dodano margines od góry */
}

.brand-monogram {
    font-weight: 800;
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-bottom: 24px;
    display: block;
}

.system-status-card h1 {
    font-weight: 800;
    font-size: 28px;
    line-height: 1.2;
    margin-bottom: 16px;
}

.system-status-card h1 .highlight {
    color: var(--accent-primary);
}

.system-status-card p {
    font-weight: 400;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 32px;
}

.status-badge {
    display: inline-block;
    background-color: var(--bg-main);
    color: var(--text-main);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--text-muted);
}

/* --- 5. STOPKA --- */
footer {
    background-color: var(--bg-card);
    border-top: 1px solid rgba(161, 161, 170, 0.1);
    padding: 12px;
    text-align: center;
    
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer-content p {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

.footer-details {
    color: #666;
}

/* --- 6. MEDIA QUERIES (Desktop Nav) --- */
@media (min-width: 768px) {
    .nav-container {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 20px 32px;
    }
    .brand-logo {
        margin-bottom: 0;
    }
}

/* --- 7. MODUŁ: KALKULATORY --- */
.module-container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.module-header {
    margin-bottom: 24px;
}

.module-header h2 {
    font-weight: 800;
    font-size: 24px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.formula-text {
    font-family: monospace;
    color: var(--accent-primary);
    font-size: 13px;
    opacity: 0.8;
}

/* GŁÓWNA SIATKA KALKULATORÓW (PANCERNA) */
.calc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: stretch; /* Gwarantuje identyczną wysokość lewego i prawego panelu */
}

@media (min-width: 992px) {
    .calc-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.calc-panel {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column; /* Pozwala zawartości wewnątrz układać się gładko */
}

.calc-panel h3 {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: 1px;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.input-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-group label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 600;
}

/* Ukrycie strzałek w polach number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

.jjf-input {
    background-color: var(--bg-main);
    border: 1px solid rgba(161, 161, 170, 0.1);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 8px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 800;
    transition: all 0.2s ease;
    width: 100%;
}

.jjf-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px var(--glow);
}

.panel-divider {
    border: 0;
    height: 1px;
    background: rgba(161, 161, 170, 0.1);
    margin: 24px 0;
}

/* --- 8. WYNIKI I PIGUŁKI --- */
/* Wyniki cząstkowe i Pigułki (Naprawa łamania wierszy na mobile) */
.mini-result-chip {
    display: flex;
    flex-wrap: nowrap; /* KLUCZOWE: Bezwzględny zakaz zrzucania do nowej linii */
    justify-content: space-between; /* Rozsuwa tekst i wynik na przeciwległe ściany */
    align-items: center;
    gap: 8px; /* Nieco mniejszy odstęp */
    background-color: var(--bg-main);
    padding: 12px 10px; /* Cieńszy padding boczny, żeby odzyskać przestrzeń na telefonie */
    border-radius: 8px;
    font-size: 12px; /* Lekka redukcja rozmiaru na mobile, by ułamek zawsze się mieścił */
    border: 1px solid rgba(161, 161, 170, 0.1);
    white-space: nowrap; /* Zapobiega łamaniu samego tekstu wewnątrz */
}

/* Na większych ekranach przywracamy luźniejszy układ */
@media (min-width: 480px) {
    .mini-result-chip {
        padding: 12px 16px;
        font-size: 13px;
        justify-content: flex-start; /* Na PC mogą leżeć blisko siebie */
        gap: 16px;
    }
}

.highlight-chip {
    color: var(--text-main);
    background-color: var(--accent-primary);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 800;
}

.summary-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.chip {
    background-color: var(--bg-main);
    border: 1px solid rgba(161, 161, 170, 0.2);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.chip span {
    color: var(--text-main);
    font-weight: 800;
}

.chip.highlight {
    border-color: var(--accent-primary);
    box-shadow: 0 0 8px var(--glow);
}

/* --- 9. TABELA RMAX --- */
.table-container {
    overflow-x: auto;
}

.jjf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.jjf-table th {
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 8px;
    border-bottom: 1px solid rgba(161, 161, 170, 0.2);
}

.jjf-table td {
    padding: 12px 8px;
    border-bottom: 1px solid rgba(161, 161, 170, 0.05);
    font-weight: 600;
}

.jjf-table tr.active-row td {
    color: var(--text-muted);
    font-style: italic;
}

.jjf-table tr.progression-row td {
    background-color: rgba(114, 76, 184, 0.1);
    color: var(--text-main);
}

.jjf-table tr.progression-row td:first-child {
    border-left: 3px solid var(--accent-primary);
}

.jjf-table tr.progression-row td:last-child {
    color: var(--accent-primary);
    font-weight: 800;
}

/* --- 10. ELEMENTY UX I FUNNEL (TDEE) --- */
/* --- NAPRAWA TOOLTIPA --- */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: rgba(161, 161, 170, 0.15);
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 800;
    cursor: pointer;
    margin-left: 8px;
    position: relative; /* Baza dla dymku */
    vertical-align: middle;
}

/* Subtelny dymek w pamięci (Naprawa Mobile) */
.tooltip-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-card); 
    color: var(--text-muted); 
    padding: 8px 12px; 
    border-radius: 4px; 
    font-size: 11px;
    font-weight: 500; 
    
    /* --- FIX MOBILE --- */
    white-space: normal; /* Pozwala na łamanie wierszy */
    width: max-content;
    max-width: 220px; /* Nie pozwoli dymkowi wyjść poza ekran telefonu */
    text-align: center;
    /* ------------------ */

    border: 1px solid rgba(161, 161, 170, 0.1); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); 
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    letter-spacing: 0.2px;
    text-transform: none;
}
/* Aktywacja dymku po najechaniu */
.tooltip-icon:hover::after {
    opacity: 1;
    visibility: visible;
}

.warning-text {
    display: none;
    font-size: 11px;
    color: #d4a373;
    margin-top: 12px;
    padding: 8px 12px;
    background-color: rgba(212, 163, 115, 0.05);
    border-left: 2px solid #d4a373;
    border-radius: 4px;
    font-family: monospace;
}
.warning-text.active { display: block; }

.jjf-btn {
    background-color: var(--bg-main);
    color: var(--text-main);
    border: 1px solid var(--accent-primary);
    padding: 14px 24px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    margin-top: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.jjf-btn:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 0 16px var(--glow);
}

.jjf-btn.success {
    background-color: #2e7d32;
    border-color: #4caf50;
    box-shadow: none;
}

/* Teoria TDEE */
.theory-content {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-muted);
}

.theory-list {
    list-style: none;
    margin: 15px 0;
    padding-left: 0;
}

.theory-list li {
    margin-bottom: 12px;
    line-height: 1.5;
}

.theory-list li::before {
    content: ">>";
    color: var(--accent-primary);
    font-weight: 800;
    margin-right: 8px;
}

.theory-list li span {
    color: var(--text-main);
    font-weight: 800;
    margin-right: 5px;
}

.highlight-text {
    color: var(--text-main);
    border-left: 2px solid var(--accent-primary);
    padding-left: 12px;
    font-style: italic;
    margin: 20px 0;
}

/* CTA Box */
.cta-box {
    background: rgba(114, 76, 184, 0.05);
    border: 1px solid var(--accent-primary);
    padding: 24px;
    border-radius: 12px;
    margin-top: auto; /* Popycha CTA na dół prawego panelu, jeśli jest miejsce */
}

.cta-info {
    font-size: 13px;
    color: var(--text-main);
    font-weight: 500;
    line-height: 1.5;
}

/* --- 11. MODAL SYSTEM --- */
.jjf-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 15, 19, 0.85);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--bg-card);
    margin: 10% auto;
    padding: 24px;
    border: 1px solid var(--accent-primary);
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px var(--glow);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(161, 161, 170, 0.1);
    padding-bottom: 12px;
}

.close-modal {
    color: var(--text-muted);
    font-size: 28px;
    font-weight: 800;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-main);
}

.pal-detail {
    margin-bottom: 12px;
}

.pal-detail span {
    color: var(--accent-primary);
    font-weight: 800;
    font-size: 13px;
    display: block;
}

.pal-detail p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
/* Subtelny dymek w pamięci (Naprawa Mobile) */
.tooltip-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 150%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-card); 
    color: var(--text-muted); 
    padding: 8px 12px; 
    border-radius: 4px; 
    font-size: 11px;
    font-weight: 500; 
    
    /* --- FIX MOBILE --- */
    white-space: normal; /* Pozwala na łamanie wierszy */
    width: max-content;
    max-width: 220px; /* Nie pozwoli dymkowi wyjść poza ekran telefonu */
    text-align: center;
    /* ------------------ */

    border: 1px solid rgba(161, 161, 170, 0.1); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); 
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
    letter-spacing: 0.2px;
    text-transform: none;
}
/* --- 12. STYLIZACJA SUWAKÓW (RMAX) --- */
.jjf-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px; /* Minimalnie grubszy, by łatwiej łapać palcem na telefonie */
    background: transparent;
    outline: none;
    margin: 15px 0;
    accent-color: var(--accent-primary); /* Wymuszenie fioletu w nowszych przeglądarkach */
}

/* Ślad suwaka (Chrome, Safari, Edge, iOS) */
.jjf-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(114, 76, 184, 0.3); /* Zgaszony fiolet jako tło */
    border-radius: 3px;
}

/* Kółko suwaka (Chrome, Safari, Edge, iOS) */
.jjf-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary); /* Główny fiolet */
    cursor: pointer;
    border: 2px solid var(--text-main); /* Biała obwódka dla kontrastu */
    box-shadow: 0 0 10px var(--glow);
    margin-top: -7px; /* Środkowanie kółka względem linii */
}

/* Ślad suwaka (Firefox) */
.jjf-slider::-moz-range-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(114, 76, 184, 0.3);
    border-radius: 3px;
}

/* Kółko suwaka (Firefox) */
.jjf-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    border: 2px solid var(--text-main);
    box-shadow: 0 0 10px var(--glow);
}

/* --- 13. SOCIAL MEDIA --- */
.ig-link {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ig-link:hover {
    color: var(--accent-primary); /* Używamy Twojego fioletu zamiast kolorów IG */
    background-color: rgba(114, 76, 184, 0.05);
}

.ig-link svg {
    flex-shrink: 0;
}

/* Stopka */
.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ig-footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.ig-footer-link:hover {
    color: var(--accent-primary);
    transform: scale(1.05);
}

/* Styl dla wiersza z wpisaną serią (Baza) */
.jjf-table tr.active-row td {
    color: var(--text-muted);
    font-style: italic;
    background-color: rgba(161, 161, 170, 0.08); /* Delikatnie szare tło */
}

/* Szary pasek z boku dla wiersza bazowego */
.jjf-table tr.active-row td:first-child {
    border-left: 3px solid var(--text-muted); 
}