/* --- 1. Struktura bazowa (Mobile First) --- */
html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    /* Domyślnie pozwalamy na przewijanie - bezpieczne dla telefonów */
    overflow-x: hidden;
    overflow-y: auto;
}

.layout-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: auto;
}

/* --- 2. Logika blokowania przewijania na PC (Desktop) --- */
@media (min-width: 992px) {
    /* Blokuj przewijanie TYLKO jeśli strona NIE jest oznaczona jako .scrollable */
    html:has(.layout-wrapper:not(.scrollable)), 
    body:has(.layout-wrapper:not(.scrollable)) {
        overflow: hidden;
    }

    .layout-wrapper:not(.scrollable) {
        height: 100vh;
        overflow: hidden;
    }

    .layout-wrapper:not(.scrollable) .main-content {
        overflow: hidden;
    }
}

/* --- 3. Wymuszenie przewijania dla stron typu Portfolio / Detale --- */
.layout-wrapper.scrollable {
    height: auto !important;
    overflow: visible !important;
}

.layout-wrapper.scrollable .main-content,
.layout-wrapper.scrollable .content-stage {
    height: auto !important;
    display: block !important;
    overflow: visible !important;
}

/* --- 4. Nawigacja i Stopka --- */
.navbar {
    flex-shrink: 0;
    min-height: 80px;
    z-index: 1050;
    background: #fff;
}

.footer {
    flex-shrink: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
}

@media (max-width: 991px) {
    .navbar { min-height: 60px; position: sticky; top: 0; }
    .footer { height: 60px; }
}

/* --- 5. Główna sekcja treści (Content Stage) --- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.content-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

/* Specyficzne dla strony "O firmie" (Decorated) */
.layout-wrapper.decorated-page .content-stage {
    background-size: cover;
    background-position: center;
    animation: decoratedBackgroundPan 28s ease-in-out infinite alternate;
}

/* POPRAWKA DLA TELEFONU: Zapobiega ucinaniu góry tekstu */
@media (max-width: 768px) {
    .layout-wrapper.decorated-page .content-stage {
        display: block; 
        padding-top: 3rem;
    }
}

/* --- 6. Elementy interfejsu (Ramki, Karty, Karuzela) --- */
.content-panel {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    padding: 2.5rem;
    width: 95%;
    max-width: 760px;
    margin: 0 auto;
}

.project-thumb {
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.project-thumb:hover { transform: scale(1.05); }

.carousel {
    flex: 1;
    height: calc(100vh - 150px);
}

@media (max-width: 991px) {
    .carousel { height: calc(100vh - 120px); }
}

.carousel-item img { height: 100%; object-fit: cover; }

/* --- 7. Blazor Error UI & Animacje --- */
#blazor-error-ui {
    background: #fff3cd;
    bottom: 0;
    display: none;
    position: fixed;
    width: 100%;
    z-index: 2000;
    padding: 0.6rem;
}

@keyframes decoratedBackgroundPan {
    0% { background-position: 50% 50%; }
    100% { background-position: 52% 48%; }
}

.scroll-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #007bff;
    color: #fff;
    border: none;
}
