/*
==================================================
SEKCJA 1: Media Queries (Desktop/Mobile Visibility)
==================================================
*/

@media (min-width: 769px) {
  /* Ukrywamy menu mobilne na desktopie */
  .mobile-menu {
    display: none !important;
  }
}

@media (max-width: 768px) {
  /* Ukrywamy menu desktopowe */
  .desktop-menu {
    display: none !important;
  }

    .mobile-menu-toggle {
      display: flex;
      align-items: center;
      gap: 10px;            /* odstęp między hamburgerem a logo */
      border: none;
      background: none;
      cursor: pointer;
      width: auto;          /* nie zajmuje całej szerokości */
      box-sizing: border-box;
      color: #017eba;
      font-size: 42px;
      padding: 10px 15px;
      cursor: pointer;
      line-height: 1;
  }

  .parafiamenu-wrapper .logo {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;       /* wypełnia przycisk */
        width: 70%;
        padding: 0;
        border: 1px solid #ddd;
        box-sizing: border-box;
        overflow: hidden;   /* obcina obrazek, jeśli jest za duży */
        background-color: #fff;
    }

    .parafiamenu-wrapper .logo img {
        max-height: 100%;   /* dopasowanie do kontenera */
        width: auto;
        display: block;
        object-fit: contain;
    }
  /* Konfiguracja mobile-menu: */
  .mobile-menu {
    display: flex !important;
    height: 100%;
    width: auto;
    flex-grow: 1;
    border: 1px solid #ddd;
    background-color: #fff;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
}

/*
==================================================
SEKCJA 2: Mobile Menu Overlay (Off-Canvas)
==================================================
*/

/* Tło na całą stronę (Overlay) */
.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: .3s ease;
    z-index: 9999;
    display: flex;
    justify-content: flex-start;
}

/* Po otwarciu */
.mobile-menu-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

/* Panel z lewej */
.mobile-menu-panel {
    width: 70%;
    max-width: 350px;
    height: 100%;
    background: rgba(255, 255, 255, 0.97);
    display: flex;
    flex-direction: column;
    transform: translateX(-100%);
    transition: transform .3s ease;
}

.mobile-menu-overlay.open .mobile-menu-panel {
    transform: translateX(0);
}

/* LOGO w Panelu Mobilnym */
.logo-container {
    width: 100%;
    padding: 5px 0;
    text-align: center;
}

.logo-container img {
    width: 90%;
    height: auto;
    object-fit: contain;
}

/* KONTENER NA MENU + X */
.menu-content {
    position: relative;
    flex: 1;
    /* UWAGA: Padding dla kontenera menu jest 20px. Musimy go uwzględnić w .mobile-link */
    padding: 20px;
}

/* X w prawym górnym rogu menu (przycisk zamykania) */
.mobile-menu-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #017eba;
    font-size: 28px;
}

/*
==================================================
SEKCJA 3: Lista i Submenu (Mobile Navigation)
==================================================
*/

/* 1. RESET LIST: Usuwa kropki i kwadraty! */
.mobile-menu-list,
.mobile-menu-list li,
.mobile-submenu,
.mobile-submenu li {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Lista linków */
.mobile-menu-list {
    margin-top: 40px !important;
}

/* 2. STYLIZACJA LINKU: Identyczna wysokość i obramowanie na całej szerokości */
.mobile-link {
    font-family: inherit;
    color: inherit;
    font-weight: inherit;
    text-decoration: none;
    font-size: 0.95rem;
    display: block;
    padding-top: 15px;
    padding-bottom: 15px;
    padding-left: 0;
    padding-right: 0;
    transition: background-color 0.2s ease;
}

/* 3. EFEKT HOVER */
.mobile-link:hover {
    background-color: #f7f7f7; /* Lekko rozjaśniony szary */
}

/* Dostosowanie wiersza i wcięcia */
.mobile-item-row {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    padding: 0; 
    border-top: 1px solid #eee;  
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    background-color: transparent; /* brak tła na start */
}

.mobile-item-row:hover {
    background-color: #f2f2f2;   /* ciemniejsze tło */
    border-color: #ddd;           /* ciemniejszy border */
}

/* Dostosowanie linku: Link musi być ustawiony na flex: 1, aby zająć resztę miejsca obok chevronu */
.mobile-item-row a.mobile-link {
    flex: 1;
    display: block;
    text-decoration: none;
    color: inherit;
    padding: 15px 0; /* tylko pionowe pady, poziome wcięcia robimy przez submenu */
    background: transparent; /* usuń wszelkie tło */
    border: none;            /* usuń wszelkie border */
}

/* Submenu (animacja i widoczność) */
.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.mobile-submenu.open {
    max-height: 500px;
}

.chevron-toggle {
    display: inline-flex;
    transition: transform .25s ease;
}

.chevron.placeholder {
    display: inline-block;
}

.chevron-toggle.open {
    transform: rotate(90deg);
}

/* Drobne poprawki: Usuwamy border-top z pierwszego elementu, jeśli jest niepotrzebny */
.mobile-menu-list > li:first-child .mobile-item-row {
    border-top: none;
}

/* WCINANIE SUBMENU: zamiast zmieniać padding linka, dodajemy padding do wiersza */
.mobile-item.level-2 .mobile-item-row a.mobile-link { padding-left: 35px; }
.mobile-item.level-3 .mobile-item-row a.mobile-link { padding-left: 70px !important; }
.mobile-item.level-4 .mobile-item-row a.mobile-link { padding-left: 80px; }
.mobile-item.level-2.has-children .mobile-item-row a.mobile-link { padding-left: 25px; }
/*.mobile-item.level-2.has-children .mobile-item-row a.mobile-link .level-3 { padding-left: 25px; }*/