/* ==========================================================
   Apartamenty Pilice – wspólny arkusz stylów
   Used by: index.html, index_en.html, index_de.html, trasy/index.html

   1. Colours & base
   2. Navigation + language selector
   3. Hero & search
   4. Layout & cards
   5. Carousel
   6. Buttons & frames
   7. FAQ
   8. Footer
   9. Instagram button
   10. Route planner (trasy/index.html only, scoped to .page-trasy)
   11. Responsive
   ========================================================== */


/* ---------- 1. Colours & base ---------- */
:root {
    --primary: #2C5F78;
    --secondary: #5B8DA3;
    --bg-color: #F4F7F9;
    --card-bg: #FFFFFF;
    --text-color: #334756;
    --muted: #6B7E8B;
    --frame-bg: #E8EEF2;
    --border-color: #D1DBE1;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --footer-alt: #1E4254;
    --shadow: 0 4px 15px rgba(0,0,0,0.05);

    /* Difficulty labels in the route planner */
    --easy: #2F7A4F;  --easy-bg: #E1F0E6;
    --mid:  #99650F;  --mid-bg:  #F7EBD2;
    --hard: #B23A36;  --hard-bg: #F6DEDC;

    /* Real value is measured by JavaScript on every page */
    --nav-height: 56px;
}

body {
    font-family: 'Montserrat', sans-serif;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
}

[hidden] { display: none !important; }

a:focus-visible,
button:focus-visible,
select:focus-visible {
    outline: 2px solid var(--secondary);
    outline-offset: 2px;
}


/* ---------- 2. Navigation + language selector ---------- */
.top-nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    z-index: 1000;
    padding: 10px 0;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
}
.top-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}
.top-nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 5px;
}
.top-nav a[aria-current="page"] {
    color: var(--primary);
    box-shadow: inset 0 -2px 0 var(--primary);
}

.mobile-menu:not(.open) {
    visibility: hidden;
    pointer-events: none;
}

.nav-lang-item {
    display: flex;
    align-items: center;
    gap: 5px;
}
.lang-flag {
    display: inline-flex;
    width: 21px;
    height: 14px;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.15); /* thin frame so the white of the PL flag is visible */
    flex-shrink: 0;
}
.lang-flag svg {
    width: 100%;
    height: 100%;
    display: block;
}
#language-selector {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    cursor: pointer;
    outline: none;
    padding: 0;
    appearance: none;
    -webkit-appearance: none;
}
#language-selector option {
    background-color: white;
    color: var(--text-color);
}
.nav-lang-item:hover #language-selector {
    color: var(--primary);
}


/* ---------- 3. Hero & search ---------- */
.hero {
    width: 100%;
    height: 40vh;
    margin-top: var(--nav-height);
    background: var(--primary) url('../img/hero1.jpg') center/cover no-repeat;
}

.search-container {
    text-align: center;
    padding: 18px 20px;
    background-color: var(--bg-color);
}
#searchInput {
    width: 100%;
    max-width: 600px;
    padding: 12px 20px;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    outline: none;
    font-size: 1rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    font-family: 'Montserrat', sans-serif;
    box-sizing: border-box;
}


/* ---------- 4. Layout & cards ---------- */
.container { max-width: 1100px; margin: 20px auto; padding: 0 20px; }

.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.card.big-card {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 30px;
    margin-bottom: 30px;
}
.card h2 {
    margin-top: 0;
    color: var(--primary);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.icon-list {
    list-style: none;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 15px 0;
}
.icon-list li { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; }
.icon-list i { color: var(--primary); width: 18px; }

/* Embedded PDF guide */
.pdf-container {
    width: 100%;
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
}
.pdf-container iframe { border: none; }


/* ---------- 5. Carousel ---------- */
.carousel {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;   /* fixed ratio so the layout doesn't jump */
    max-height: 450px;
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;    /* shown while the photo loads */
}
.carousel img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.8s ease-in-out;
    z-index: 1;
}
.carousel img.active {
    opacity: 1;
    z-index: 2;
}


/* ---------- 6. Buttons & frames ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 10px 18px;
    border: 2px solid var(--primary);
    border-radius: 6px;
    text-decoration: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    transition: 0.3s;
    margin-top: 10px;
    cursor: pointer;
}
.btn-outline { background: transparent; color: var(--primary); }
.btn-outline-light { background: transparent; color: white; border-color: white; }
.btn-start { align-self: flex-start; }      /* keeps a single button from stretching across a card */
.btn-row { display: flex; gap: 10px; margin-top: 15px; }

.frame {
    background-color: var(--frame-bg);
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: 4px;
    margin: 15px 0;
    font-size: 0.9rem;
}


/* ---------- 7. FAQ ---------- */
.card h2.faq-title { margin-bottom: 20px; }

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}
details.faq-item {
    background: var(--frame-bg);
    border: none;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
    transition: background 0.3s ease;
}
details.faq-item:hover {
    background: var(--border-color);
}
details.faq-item summary {
    padding: 18px 20px;
    list-style: none;
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.95rem;
}
details.faq-item summary::-webkit-details-marker {
    display: none;
}
details.faq-item p {
    padding: 0 20px 20px 20px;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1.5;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}


/* ---------- 8. Footer ---------- */
.footer-main {
    background: var(--primary);
    color: white;
    padding: 40px 20px;
    margin-top: 50px;
}
.footer-container {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    justify-content: space-around;
    text-align: center;
}
.footer-section {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.footer-section p {
    margin: 0;
    font-weight: 400;
    font-size: 0.95rem;
}
.footer-secondary {
    background: var(--footer-alt);
    color: white;
    padding: 25px 20px;
    padding-bottom: calc(25px + env(safe-area-inset-bottom, 0px));
    text-align: center;
}
.footer-links-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}


/* ---------- 9. Instagram button ---------- */
.ig-floating-container {
    position: fixed;
    bottom: calc(25px + env(safe-area-inset-bottom, 0px));
    right: 25px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    /* The box is as big as the (hidden) popup + button. Let taps pass
       through it, so only the round button itself is clickable. */
    pointer-events: none;
}
.ig-popup {
    background-color: var(--primary);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    max-width: 220px;
    text-align: center;
    font-weight: 600;
    pointer-events: none;
}
.ig-popup::after {           /* small arrow pointing at the button */
    content: '';
    position: absolute;
    bottom: 52px;
    right: 15px;
    border-width: 8px;
    border-style: solid;
    border-color: var(--primary) transparent transparent transparent;
}
.ig-floating-container:hover .ig-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(-5px);
}
.ig-btn {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
    width: 55px;
    height: 55px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
    text-decoration: none;
    transition: transform 0.3s ease;
    pointer-events: auto;
}
.ig-btn:hover {
    transform: scale(1.1);
}


/* ---------- 10. Route planner (trasy/index.html) ---------- */
.page-trasy *,
.page-trasy *::before,
.page-trasy *::after { box-sizing: border-box; }
.page-trasy img { max-width: 100%; }
.page-trasy .card { margin-bottom: 20px; }

/* Intro */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 25px; align-items: end; }
.intro-place { display: flex; align-items: center; gap: 8px; color: var(--secondary); font-weight: 600; font-size: 0.9rem; margin: 0; }
.intro h1 { color: var(--primary); font-size: clamp(1.5rem, 3.4vw, 2.1rem); line-height: 1.2; margin: 6px 0 12px; }
.intro h1 em { font-style: normal; font-weight: 400; }
.lede { max-width: 62ch; margin: 0; }
.mapall { margin-top: 15px; align-self: flex-start; }
.counts { display: flex; gap: 12px; }
.count { background: var(--frame-bg); border-radius: 8px; padding: 12px 16px; display: grid; min-width: 120px; }
.count strong { color: var(--primary); font-size: 2rem; line-height: 1.1; font-variant-numeric: tabular-nums; }
.count span { font-size: 0.8rem; color: var(--muted); }

/* Filters */
.filters { display: grid; gap: 12px; }
.frow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.flabel { font-size: 0.85rem; color: var(--primary); font-weight: 700; min-width: 110px; }
.chip {
    appearance: none;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font: 600 0.85rem/1 'Montserrat', sans-serif;
    padding: 9px 14px;
    border-radius: 25px;
    cursor: pointer;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.reset {
    background: none;
    border: 0;
    color: var(--secondary);
    font: 600 0.85rem 'Montserrat', sans-serif;
    cursor: pointer;
    padding: 6px 2px;
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Results + plan layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.resultbar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.resultbar h2 { color: var(--primary); font-size: 1.3rem; margin: 0; }
.resultbar p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); background: var(--card-bg); border-radius: 12px; border: 1px dashed var(--border-color); }

/* Route card */
.route {
    background: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}
.photo { position: relative; aspect-ratio: 3/2; overflow: hidden; background: var(--frame-bg); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.tag {
    position: absolute;
    left: 10px;
    top: 10px;
    background: rgba(30, 66, 84, 0.85);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 25px;
}
.route .body { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; flex: 1; }
.route h3 { color: var(--primary); font-size: 1.1rem; line-height: 1.3; margin: 0; }
.stats { display: flex; gap: 6px 8px; flex-wrap: wrap; align-items: center; font-variant-numeric: tabular-nums; }
.diff { font-size: 0.75rem; font-weight: 700; padding: 3px 8px; border-radius: 4px; }
.d1 { background: var(--easy-bg); color: var(--easy); }
.d2 { background: var(--mid-bg); color: var(--mid); }
.d3 { background: var(--hard-bg); color: var(--hard); }
.stat { font-size: 0.85rem; color: var(--muted); }
.stat b { color: var(--text-color); font-weight: 700; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 0.8rem; margin: 0; padding: 0; list-style: none; }
.facts li { padding-left: 18px; position: relative; }
.facts small { color: var(--muted); }
.yes::before, .no::before { font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; left: 0; top: 0; }
.yes::before { content: "\f00c"; color: var(--easy); }
.no::before  { content: "\f00d"; color: var(--hard); }
.no { color: var(--muted); }
.why { margin: 0; font-size: 0.9rem; }
details.more summary { cursor: pointer; color: var(--primary); font-weight: 700; font-size: 0.85rem; }
details.more[open] summary { margin-bottom: 8px; }
details.more .why + .why { margin-top: 8px; }
.tip { margin: 12px 0 0; }
.tip b { display: block; font-size: 0.8rem; color: var(--primary); margin-bottom: 2px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; padding-top: 4px; }
.actions .btn { flex: 1; min-width: 120px; padding: 10px 12px; margin-top: 0; }
.btn.added { background: var(--frame-bg); color: var(--primary); border-color: var(--frame-bg); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border-color); cursor: default; }

/* "Mój plan" panel */
aside.plan {
    position: sticky;
    top: calc(var(--nav-height) + 16px);
    display: grid;
    gap: 14px;
    max-height: calc(100vh - var(--nav-height) - 32px);
    overflow: auto;
    margin-bottom: 0;
}
.plan h2 { margin: 0; }
.plan .sub { color: var(--muted); font-size: 0.8rem; margin: 2px 0 0; }
.stay { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 0.9rem; font-weight: 600; }
.page-trasy select {
    font: 600 0.85rem 'Montserrat', sans-serif;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
}
.page-trasy #language-selector { padding: 0; border: none; background: transparent; }
.day { border-top: 1px solid var(--border-color); padding-top: 10px; display: grid; gap: 8px; }
.dayhead { display: flex; justify-content: space-between; align-items: baseline; }
.dayhead h4 { margin: 0; font-size: 0.85rem; color: var(--primary); }
.dayhead span { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pitem { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; font-size: 0.85rem; }
.pitem .nm { overflow-wrap: anywhere; font-weight: 600; }
.pitem .nm small { display: block; color: var(--muted); font-size: 0.75rem; font-weight: 400; }
.page-trasy .pitem select { padding: 4px 6px; font-size: 0.8rem; }
.x { background: none; border: 0; color: var(--muted); font-size: 1.1rem; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.x:hover { color: var(--hard); }
.dayempty, .planempty { font-size: 0.85rem; color: var(--muted); margin: 0; }
.total {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    background: var(--frame-bg);
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.total span { white-space: nowrap; }
.total b { color: var(--primary); text-align: right; }
.planactions { display: flex; gap: 8px; flex-wrap: wrap; }
.planactions .btn { flex: 1; margin-top: 0; }
.status { font-size: 0.8rem; color: var(--easy); font-weight: 600; min-height: 1.2em; margin: 0; }
textarea#copyfallback {
    width: 100%;
    min-height: 120px;
    font: 0.8rem/1.4 'Montserrat', sans-serif;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-color);
    padding: 8px;
}
.note { color: var(--muted); font-size: 0.8rem; margin: 30px 0 0; max-width: 90ch; }

/* Floating "Mój plan" button – phones only (see section 11) */
.fab { display: none; }


/* ---------- 11. Responsive ---------- */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    aside.plan { position: static; max-height: none; }
    .fab {
        display: flex;
        position: fixed;
        left: 16px;
        right: 96px;              /* leaves room for the Instagram button */
        bottom: calc(25px + env(safe-area-inset-bottom, 0px));
        height: 55px;
        align-items: center;
        justify-content: center;
        gap: 8px;
        background: var(--primary);
        color: #fff;
        border: 0;
        border-radius: 28px;
        font: 700 0.95rem 'Montserrat', sans-serif;
        box-shadow: 0 4px 10px rgba(0,0,0,0.25);
        z-index: 9998;
        cursor: pointer;
    }
    .page-trasy .footer-secondary { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 850px) {
    .card.big-card { grid-template-columns: 1fr; }
    .hero { height: 30vh; }
    .icon-list { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .carousel {
        aspect-ratio: 4 / 3;
        max-height: 300px;
    }
}

@media (max-width: 700px) {
    .intro { grid-template-columns: 1fr; }
    .counts .count { flex: 1; }
}

/* "Coming soon" strip at the bottom of the nav bar.
   To remove it: delete the <div class="construction-banner"> line from each page. */
.construction-banner {
    background: #F2C94C;
    color: #3A2F00;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 5px 12px;
    margin: 10px 0 -10px;   /* flush with the bottom edge of the nav bar */
}
@media (max-width: 600px) {
    .construction-banner { margin: 8px 0 -8px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
    .top-nav ul { gap: 10px; }
    .top-nav a { font-size: 0.75rem; }
    .container { padding: 0 15px; }
}

@media (max-width: 600px) {
    .top-nav { padding-top: calc(8px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; }
    .top-nav ul { gap: 12px 16px; padding: 0 10px; }
    .top-nav a { font-size: 0.72rem; }
    .hero { height: 22vh; min-height: 140px; }
    .search-container { padding: 16px 15px; }
    #searchInput { padding: 11px 16px; font-size: 0.95rem; }
    .flabel { min-width: 100%; }

    .footer-section {
        min-width: 100%;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 20px;
    }
    .footer-section:last-child { border-bottom: none; }
    /* room at the very bottom so "Oceń nas" / "Blog" aren't under the Instagram button */
    .footer-secondary { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
    .footer-section .btn {
        width: 100%;
        box-sizing: border-box;
    }
}

@media (prefers-reduced-motion: reduce) {
    .btn, .ig-btn, .ig-popup, .carousel img { transition: none; }
}
