/* 1. Ogólny kontener sekcji (bez ingerencji w typy ramek) */
.doc-section {
    margin-bottom: 20px;
    padding: 15px;
    font-size: 1rem;
    line-height: 1.5;
    color: #e6edf3;
}

/* 2. Niezależne komponenty (każdy ma własne style) */

/* INFO */
.doc-info { 
    position: relative;
    margin-bottom: 20px; 
    padding: 6px 18px 6px 50px; 
    border-radius: 8px; 
    border-left: 5px solid #58a6ff; 
    background: rgba(88, 166, 255, 0.05);
    color: #e6edf3;
    font-size: 1rem;
    line-height: 1.5;
}
.doc-info::before { 
    position: absolute;
    left: 18px; top: 6px;
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    content: "\f05a"; color: #58a6ff; font-size: 1.1rem;
}

/* WARNING */
.doc-warning { 
    position: relative;
    margin-bottom: 20px; 
    padding: 6px 18px 6px 50px; 
    border-radius: 8px; 
    border-left: 5px solid #d29922; 
    background: rgba(210, 153, 34, 0.05);
    color: #e6edf3;
    font-size: 1rem;
    line-height: 1.5;
}
.doc-warning::before { 
    position: absolute;
    left: 18px; top: 6px;
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    content: "\f071"; color: #d29922; font-size: 1.1rem;
}

/* SUCCESS */
.doc-success { 
    position: relative;
    margin-bottom: 20px; 
    padding: 6px 18px 6px 50px; 
    border-radius: 8px; 
    border-left: 5px solid #3fb950; 
    background: rgba(63, 185, 80, 0.05);
    color: #e6edf3;
    font-size: 1rem;
    line-height: 1.5;
}
.doc-success::before { 
    position: absolute;
    left: 18px; top: 6px;
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    content: "\f058"; color: #3fb950; font-size: 1.1rem;
}

/* DANGER */
.doc-danger { 
    position: relative;
    margin-bottom: 20px; 
    padding: 6px 18px 6px 50px; 
    border-radius: 8px; 
    border-left: 5px solid #f85149; 
    background: rgba(248, 81, 73, 0.05);
    color: #e6edf3;
    font-size: 1rem;
    line-height: 1.5;
}
.doc-danger::before { 
    position: absolute;
    left: 18px; top: 6px;
    font-family: "Font Awesome 6 Free"; font-weight: 900;
    content: "\f06a"; color: #f85149; font-size: 1.1rem;
}

/* 1. Tytuł sekcji (np. duży, pogrubiony) */
/* Główny kontener nagłówka (musi mieć flex, aby rozdzielić tekst od ikony) */
.doc-section-title {
    display: block; /* Zmieniamy z flex na block, aby kontener był naturalny */
    margin: 40px 0 25px 0;
    padding-left: 15px;
    border-left: 4px solid #58a6ff;
    position: relative;
}

/* Kontener trzymający tekst i ikonę blisko siebie */
.title-container {
    display: inline-flex; /* Ikona będzie tuż za tekstem */
    align-items: center;
    cursor: pointer;
}

.title-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: #e6edf3;
    letter-spacing: -0.5px;
    transition: color 0.2s ease;
}

.link-icon {
    margin-left: 10px; /* Mały odstęp od tekstu */
    font-size: 1rem;
    color: #58a6ff;
    opacity: 0;
    transform: translateX(-10px); /* Ikona lekko "wypływa" */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.link-icon.fa-check {
    color: #4cd964 !important; /* Zielony kolor przy sukcesie */
    opacity: 1 !important;     /* Ikona musi być widoczna */
}

/* Interakcje */
.doc-section-title:hover .title-text {
    color: #ffffff;
}

.doc-section-title:hover .link-icon {
    opacity: 1;
    transform: translateX(0);
}

.link-icon:hover {
    color: #ffffff;            /* Ikona zmienia kolor na biały */
    transform: scale(1.1);      /* Ikona minimalnie się powiększa */
    transition: all 0.2s ease;  /* Szybsza reakcja przy najechaniu na samą ikonę */
}

/* Dekoracyjna linia */
.doc-section-title::after {
    content: "";
    display: block;
    width: 60px;
    height: 3px;
    background: #58a6ff;
    margin-top: 8px;
    border-radius: 2px;
}

/* 2. Tekst z wyróżnieniem (Niebieski) */
.doc-highlight-blue {
    color: #58a6ff;
    background: rgba(88, 166, 255, 0.1);
    padding: 3px;
    border-radius: 5px;
    font-weight: 500;
}

/* Stylizacja dla bullet-list */
/* Kontener sekcji listy */
.doc-section.doc-bullet-list {
    margin: 1.5rem 0;
}

/* Podstawowa lista */
.doc-section.doc-bullet-list ul {
    list-style: none !important;
    padding-left: 10px !important;
    margin: 0 !important;
}

/* Każdy element listy */
.doc-section.doc-bullet-list li {
    position: relative !important;
    padding: 6px 0 6px 28px !important; /* Więcej miejsca na lewo dla ikony */
    margin-bottom: 2px !important;
    color: #c9d1d9 !important;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

/* Efekt po najechaniu myszką - dodaje interaktywności */
.doc-section.doc-bullet-list li:hover {
    color: #e6edf3 !important;
    padding-left: 32px !important; /* Subtelny ruch tekstu w prawo */
}

/* Kropka (bullet) z efektem "glow" (poświaty) */
.doc-section.doc-bullet-list li::before {
    content: "•" !important;
    position: absolute !important;
    left: 8px !important;
    color: #58a6ff !important;
    font-size: 1.2rem;
    line-height: 1;
    text-shadow: 0 0 8px rgba(88, 166, 255, 0.5); /* Smaczek: lekka poświata */
    transition: transform 0.2s ease;
}

/* Animacja kropki przy hover */
.doc-section.doc-bullet-list li:hover::before {
    transform: scale(1.3); /* Powiększenie kropki po najechaniu */
}

/* Zagnieżdżenia (podpunkty) - nieco inny kolor kropki dla hierarchii */
.doc-section.doc-bullet-list ul ul li::before {
    content: "◦" !important; /* Inny symbol dla podpunktów */
    color: #388bfd !important; /* Ciemniejszy odcień niebieskiego */
    text-shadow: none;
}

/* 4. Box z przyciskiem Kopiuj */
.doc-copy-box {
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden; /* Obcina zaokrąglenia dla nagłówka */
    margin: 20px 0;
    transition: border 0.2s ease;
}

.doc-copy-box:hover {
    border-color: #484f58;
}

/* Nagłówek kodu */
.code-header {
    background: #161b22;
    padding: 8px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #30363d;
}

.lang-label {
    font-size: 0.75rem;
    color: #8b949e;
    font-weight: bold;
    text-transform: uppercase;
}

/* Ikona kopiowania */
.copy-icon {
    color: #8b949e;
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.copy-icon:hover {
    color: #58a6ff;
}

/* Ciało kodu */
.code-body {
    padding: 15px;
    overflow-x: auto;
}

.code-body pre {
    margin: 0;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #c9d1d9;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-body pre[class*="language-"] {
    background: transparent !important;
    margin: 0;
    padding: 0;
}

.doc-link {
    color: #58a6ff;
    text-decoration: none;
    font-weight: 600;
    position: relative; /* Wymagane dla animacji podkreślenia */
    padding-bottom: 2px;
    transition: color 0.3s ease;
}

/* Podkreślenie, które wyjeżdża ze środka */
.doc-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%; /* Startuje ze środka */
    background-color: #58a6ff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.doc-link:hover {
    color: #ffffff;
}

.doc-link:hover::after {
    width: 100%; /* Rozszerza się na całość */
    left: 0;     /* Przesuwa się na początek */
}

.doc-spoiler-box {
    background: #161b22;
    border: 1px solid #30363d;
    border-left: 4px solid #58a6ff;
    border-radius: 6px;
    padding: 14px 18px;
    margin-bottom: 16px;
    color: #c9d1d9;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}

.doc-spoiler-box:hover {
    border-color: #58a6ff;
    box-shadow: 0 6px 16px rgba(88, 166, 255, 0.1);
}

.doc-spoiler-summary {
    cursor: pointer;
    font-weight: 600;
    color: #f0f6fc;
    outline: none;
    user-select: none;
    list-style: none;
    display: flex;
    align-items: center;
    position: relative;
}

.doc-spoiler-summary::-webkit-details-marker {
    display: none;
}

/* Nowoczesna ikona rozwijania z animacją obrotu i płynną zmianą koloru */
.doc-spoiler-summary::before {
    content: '▶';
    font-size: 0.75rem;
    color: #58a6ff;
    margin-right: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
}

.doc-spoiler-box[open] .doc-spoiler-summary::before {
    transform: rotate(90deg);
    color: #3fb950;
}

.doc-spoiler-content {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #30363d;
    font-size: 0.95rem;
    line-height: 1.6;
    animation: fadeInSpoiler 0.3s ease-in-out;
}

@keyframes fadeInSpoiler {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.doc-youtube-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    width: 100%;
}

/* Gdy w jednym bloku jest wiele filmów, układamy je w siatkę obok siebie lub pod spodem */
.doc-youtube-container.doc-youtube-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    justify-content: center;
}

.doc-youtube-wrapper {
    position: relative;
    width: 60%; /* Dla pojedynczego filmu */
    margin: 0 auto;
    max-width: 650px;
    padding-bottom: 33.75%; /* Proporcje 16:9 dla pomniejszonego filmu */
    height: 0;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Gdy filmów jest wiele w siatce, każdy zajmuje pełną szerokość swojego kafelka */
.doc-youtube-grid .doc-youtube-wrapper {
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%; /* Pełne proporcje 16:9 w siatce */
    margin: 0;
}

.doc-youtube-wrapper:hover {
    border-color: #58a6ff;
    box-shadow: 0 12px 32px rgba(88, 166, 255, 0.15);
}

.doc-youtube-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Kontener obrazków w dokumentacji */
.doc-image-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    width: 100%;
}

.doc-image-container.doc-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    justify-content: center;
}

/* Pojedynczy wrapper dla galerii (siatki) ze stałą, równą wysokością */
.doc-image-wrapper {
    position: relative;
    width: 100%;
    height: 220px;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* Gdy w bloku jest tylko jedno zdjęcie, wraca do większego, elastycznego formatu */
.doc-image-container:not(.doc-image-grid) .doc-image-wrapper {
    width: 70%;
    max-width: 750px;
    height: auto;
    margin: 0 auto;
    padding-bottom: 45%; /* Zachowuje proporcje 16:9 dla pojedynczego elementu */
}

.doc-image-grid .doc-image-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.doc-image-wrapper:hover {
    border-color: #58a6ff;
    box-shadow: 0 12px 32px rgba(88, 166, 255, 0.15);
}

/* Wypełnienie obrazka w siatce (równe kafelki bez zniekształceń) */
.doc-image-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    transition: transform 0.3s ease;
}

/* Dla pojedynczego zdjęcia obrazek dopasowuje się normalnie */
.doc-image-container:not(.doc-image-grid) .doc-image-wrapper img {
    position: absolute;
    height: 100%;
    object-fit: contain;
}

.doc-image-wrapper img:hover {
    transform: scale(1.03);
}

/* --- LIGHTBOX (PODGLĄD NA ŚRODKU) --- */
.doc-lightbox-overlay {
    display: none;
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    animation: fadeInLightbox 0.2s ease;
}

@keyframes fadeInLightbox {
    from { opacity: 0; }
    to { opacity: 1; }
}

.doc-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.doc-lightbox-content img {
    max-width: 85vw;
    max-height: 85vh;
    border-radius: 6px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    object-fit: contain;
}

/* Przycisk zamknięcia (krzyżyk) */
.doc-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: #f0f6fc;
    font-size: 2.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.doc-lightbox-close:hover {
    color: #58a6ff;
}

/* Strzałki nawigacyjne (lewo/prawo) */
.doc-lightbox-prev,
.doc-lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(22, 27, 34, 0.7);
    border: 1px solid #30363d;
    color: #f0f6fc;
    font-size: 1.5rem;
    padding: 10px 15px;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}

.doc-lightbox-prev { left: -60px; }
.doc-lightbox-next { right: -60px; }

.doc-lightbox-prev:hover,
.doc-lightbox-next:hover {
    background: #30363d;
    border-color: #58a6ff;
    color: #58a6ff;
}

/* Licznik zdjęć u dołu (np. 1 / 3) */
.doc-lightbox-counter {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    color: #8b949e;
    font-size: 0.9rem;
    font-weight: 500;
}

.doc-steps-container {
    display: flex;
    flex-direction: column;
    margin: 24px 0;
    width: 100%;
}

.doc-step-item {
    display: flex;
    position: relative;
    /* Zapewnia odpowiedni odstęp między krokami i miejsce na linię */
    padding-bottom: 32px; 
}

.doc-step-item:last-child {
    padding-bottom: 0;
}

/* Ukrywanie linii w ostatnim kroku */
.doc-step-item:last-child .doc-step-line {
    display: none;
}

.doc-step-number-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Sztywna szerokość kolumny numerka, żeby kółka były idealnie w jednej linii pionowej */
    width: 36px; 
    margin-right: 16px;
    flex-shrink: 0;
}

/* Kółko z numerkiem kroku */
.doc-step-badge {
    width: 30px;
    height: 30px;
    background: #161b22;
    border: 1px solid #30363d;
    color: #f0f6fc;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
    z-index: 2;
    /* Odcięcie tła wokół kółka, żeby linia pod spodem nie prześwitвала */
    box-shadow: 0 0 0 4px #0d1117; 
}

/* Idealnie wyśrodkowana pionowa linia łącząca */
.doc-step-line {
    position: absolute;
    top: 30px; /* Zaczyna się równo pod kółkiem */
    bottom: 0;
    left: 17px; /* Dokładnie na środku kolumny (36px / 2 - grubość linii) */
    width: 2px;
    background: #30363d;
    z-index: 1;
}

.doc-step-content-col {
    flex-grow: 1;
    padding-top: 3px;
}

.doc-step-title {
    font-size: 1.15rem;
    font-weight: 600;
    color: #f0f6fc;
    margin-bottom: 8px;
    line-height: 1.4;
}

.doc-step-body {
    color: #8b949e;
    font-size: 0.95rem;
    line-height: 1.6;
}

.doc-step-body ul {
    margin: 8px 0 8px 20px;
    padding: 0;
}

.doc-step-body li {
    margin-bottom: 4px;
}