/* =====================================================================
   Sklep – szkielet (layout/base.html): nagłówek, dolna nawigacja, stopka,
   baner cookies, przycisk czatu, menu mobilne. Ładowany po pm-theme.css.
   Tylko wygląd: id/klasy używane przez JS zostają w HTML bez zmian.
   ===================================================================== */

body { background: var(--pm-bg-canvas); }
main { flex: 1 0 auto; display: flex; flex-direction: column; }

/* ---------- Nagłówek: szklany, przyklejony ---------- */
.navbar.pm-shop-header {
  height: auto; min-height: var(--pm-shop-header-h); padding: 0;
  position: sticky; top: 0; z-index: 1030;
  background: var(--pm-glass);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid rgba(232,230,227,.8);
}
.pm-shop-header > .container { max-width: 1440px; padding: 0 32px; gap: 24px; flex-wrap: nowrap; min-height: var(--pm-shop-header-h); }
.pm-shop-header .navbar-brand { padding: 0; margin: 0; flex: none; }
.pm-shop-header .navbar-brand img { width: 78px; height: auto; display: block; transition: transform .25s var(--pm-ease); }
.pm-shop-header .navbar-brand:hover img { transform: scale(1.04); }
.pm-shop-header .navbar-collapse { gap: 16px; min-width: 0; }

/* Menu główne jako pigułki na szarym pasku */
.pm-shop-header .navbar-nav.pm-shop-nav { flex-direction: row; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(241,240,238,.7); }
.pm-shop-header .pm-shop-nav .nav-link {
  position: relative; padding: 8px 14px; border-radius: 999px; white-space: nowrap;
  font: 500 14px/20px var(--pm-font); color: var(--pm-text-2); text-decoration: none;
  transition: background .2s var(--pm-ease), color .2s;
}
.pm-shop-header .pm-shop-nav .nav-link:hover { color: var(--pm-text); background: rgba(255,255,255,.8); }
.pm-shop-header .pm-shop-nav .nav-link.active {
  color: var(--pm-brand-600); font-weight: 600; background: #fff;
  box-shadow: 0 1px 2px rgba(28,25,23,.08), 0 2px 8px -2px rgba(28,25,23,.08);
}
/* Transmisja trwa: pulsująca czerwona kropka (klasa live-event z has_live_events) */
.pm-shop-header .pm-shop-nav .nav-link.live-event::before {
  content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--pm-brand-500); margin-right: 7px; vertical-align: 1px;
  box-shadow: 0 0 0 3px rgba(220,49,40,.18); animation: pm-pulse 1.6s infinite;
}

/* Akcje po prawej: język, waluta, Zaloguj, Rejestracja, Koszyk */
.pm-shop-header .navbar-nav.pm-hdr-actions { flex-direction: row; align-items: center; gap: 4px; flex-wrap: nowrap; }
.pm-shop-header .pm-hdr-actions .nav-link {
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 10px; border-radius: 10px;
  font: 500 13px var(--pm-font); color: var(--pm-text); white-space: nowrap;
}
.pm-shop-header .pm-hdr-actions .nav-link:hover { background: rgba(241,240,238,.9); color: var(--pm-text); }
.pm-shop-header .pm-hdr-actions .nav-link i { color: var(--pm-text-2); }
.pm-shop-header .pm-hdr-actions .nav-link.pm-btn { height: 40px; padding: 0 16px; border-radius: 12px; font-weight: 600; }
.pm-shop-header .pm-hdr-actions .nav-link.pm-btn--ghost { color: var(--pm-text-2); }
.pm-shop-header .pm-hdr-actions .nav-link.pm-btn--secondary { background: var(--pm-bg-surface); border: 1px solid var(--pm-border-strong); color: var(--pm-text); }
.pm-shop-header .pm-hdr-actions .nav-link.pm-btn--secondary:hover { background: var(--pm-bg-hover); }
.pm-shop-header .pm-hdr-actions .nav-link.pm-btn--primary { margin-left: 8px; background: var(--pm-brand-500); color: #fff; box-shadow: 0 1px 2px rgba(185,38,31,.25), 0 6px 16px -6px rgba(220,49,40,.55); }
.pm-shop-header .pm-hdr-actions .nav-link.pm-btn--primary:hover { background: var(--pm-brand-600); transform: translateY(-1px); }
.pm-shop-header .pm-hdr-actions .nav-link.pm-btn--primary i { color: #fff; }
.pm-shop-header .pm-hdr-actions .dropdown-toggle::after { margin-left: 2px; vertical-align: 2px; border-top-width: .28em; border-left-width: .28em; border-right-width: .28em; }
.pm-shop-header .pm-hdr-actions .badge { font-size: 10px; }
.pm-shop-header .dropdown-item i { width: 20px; text-align: center; margin-right: 6px; }

/* Zalogowany: e-mail w menu użytkownika przycięty (pełny w atrybucie title) */
.pm-shop-header .pm-user-email { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* Licznik koszyka – updateCartCount() robi .show()/.hide() (inline display) */
#cart-count.pm-cart-count {
  display: none; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #fff; color: var(--pm-brand-600); font: 700 12px/20px var(--pm-font); text-align: center;
}
#cart-count.pm-cart-count[style*="inline"], #cart-count.pm-cart-count[style*="block"] { display: inline-block !important; }

/* ---------- Komunikaty flash ---------- */
.pm-flash .alert { margin-top: 20px; }

/* ---------- Stopka (ciemna) ---------- */
footer.pm-shop-footer { flex-shrink: 0; width: 100%; margin-top: 64px; padding: 56px 0 36px; background: var(--pm-dark); color: rgba(255,255,255,.7); }
.pm-shop-footer .container { max-width: var(--pm-container); }
.pm-ft-top { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.pm-ft-logo { width: 64px; height: auto; display: block; filter: invert(1) brightness(2); }
.pm-ft-links { display: flex; gap: 8px 28px; flex-wrap: wrap; }
.pm-ft-links a { font: 500 14px var(--pm-font); color: rgba(255,255,255,.75); text-decoration: none; transition: color .2s; }
.pm-ft-links a:hover { color: #fff; }
.pm-shop-footer hr { border: 0; height: 1px; background: rgba(255,255,255,.12); color: transparent; margin: 32px 0 18px; opacity: 1; }
.pm-ft-copy { margin: 0; font-size: 12px; line-height: 1.6; color: rgba(255,255,255,.5); }

/* ---------- Przycisk czatu: zaokrąglony kwadrat w kolorze marki ---------- */
body .chat-toggle {
  width: 56px; height: 56px; border-radius: 18px; background: var(--pm-brand-500);
  box-shadow: 0 12px 28px -8px rgba(220,49,40,.6); transition: transform .2s var(--pm-ease), background .2s;
}
body .chat-toggle:hover { transform: translateY(-2px); background: var(--pm-brand-600); box-shadow: 0 14px 30px -8px rgba(220,49,40,.6); }

/* ---------- Dolna nawigacja (mobile): pływający szklany pasek ---------- */
.bottom-nav { display: none; }
.mobile-cart-badge { display: none; }

/* ---------- Baner cookies: pływająca karta w lewym dolnym rogu ---------- */
.cookie-banner.pm-cookie {
  position: fixed; left: 24px; bottom: 24px; right: auto; z-index: 9999;
  width: min(560px, calc(100% - 48px)); padding: 20px;
  background: #fff; color: var(--pm-text); border: 1px solid var(--pm-border); border-radius: 22px;
  box-shadow: 0 24px 60px -20px rgba(28,25,23,.4);
  animation: pm-cookie-in .4s var(--pm-ease);
}
@keyframes pm-cookie-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-cookie .cookie-title { margin: 0 0 4px; font: 700 16px/24px var(--pm-font); color: var(--pm-text); }
.pm-cookie .cookie-title::before { content: "🍪"; margin-right: 8px; }
.pm-cookie .cookie-description { margin: 0 0 14px; font-size: 13px; line-height: 1.55; color: var(--pm-text-2); }
.pm-cookie .cookie-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
/* Kolejność wizualna: Ustawienia, Tylko niezbędne, Akceptuj wszystkie (HTML bez zmian) */
.pm-cookie #cookieSettings { order: 1; }
.pm-cookie #cookieAcceptNecessary { order: 2; }
.pm-cookie #cookieAcceptAll { order: 3; margin-left: auto; }
.pm-cookie .cookie-buttons .pm-btn { white-space: nowrap; }
.pm-cookie .cookie-footer { font-size: 12px; color: var(--pm-text-muted); }
.pm-cookie .cookie-footer a { color: var(--pm-brand-600); }

.cookie-modal { position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center; background: rgba(20,18,16,.45); animation: pm-fade .25s ease-out; }
@keyframes pm-fade { from { opacity: 0; } to { opacity: 1; } }
.cookie-modal-content { width: 92%; max-width: 600px; max-height: 85vh; overflow: auto; background: #fff; color: var(--pm-text); border-radius: var(--pm-radius-lg); box-shadow: var(--pm-shadow-pop); }
.cookie-modal-header { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--pm-border); }
.cookie-modal-header h3 { margin: 0; font: 700 18px/26px var(--pm-font); }
.cookie-modal-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: none; color: var(--pm-text-muted); font-size: 18px; cursor: pointer; }
.cookie-modal-close:hover { background: var(--pm-bg-hover); color: var(--pm-text); }
.cookie-modal-body { padding: 20px 24px; }
.cookie-category { margin-bottom: 12px; padding: 16px; background: var(--pm-bg-subtle); border-radius: var(--pm-radius-md); }
.cookie-category-header { display: flex; align-items: flex-start; gap: 16px; }
.cookie-category-info h4 { margin: 0 0 4px; font: 600 15px/22px var(--pm-font); }
.cookie-category-info p { margin: 0; font-size: 13px; line-height: 1.55; color: var(--pm-text-2); }
.cookie-switch { position: relative; display: inline-block; flex: none; width: 50px; height: 26px; }
.cookie-switch input { opacity: 0; width: 0; height: 0; }
.cookie-slider { position: absolute; inset: 0; cursor: pointer; background: var(--pm-border-strong); border-radius: 34px; transition: .3s; }
.cookie-slider::before { content: ""; position: absolute; left: 3px; bottom: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: .3s; }
.cookie-switch input:checked + .cookie-slider { background: var(--pm-brand-500); }
.cookie-switch input:checked + .cookie-slider::before { transform: translateX(24px); }
.cookie-switch input:disabled + .cookie-slider { opacity: .6; cursor: not-allowed; }
.cookie-modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--pm-border); }

/* ---------- Menu mobilne (modale z dolnej nawigacji) ---------- */
#mobileUserMenu .modal-header, #mobileGuestMenu .modal-header { background: var(--pm-bg-surface); color: var(--pm-text); border-bottom: 1px solid var(--pm-border); padding: 16px 20px; }
#mobileUserMenu .modal-title, #mobileGuestMenu .modal-title { font: 700 16px/24px var(--pm-font); }
#mobileUserMenu .modal-title i, #mobileGuestMenu .modal-title i { color: var(--pm-brand-500); }
#mobileUserMenu .list-group-item, #mobileGuestMenu .list-group-item { border: 0; border-bottom: 1px solid var(--pm-border); padding: 14px 20px; font-size: 14px; color: var(--pm-text); }
#mobileUserMenu .list-group-item:last-child, #mobileGuestMenu .list-group-item:last-child { border-bottom: 0; }
#mobileUserMenu .list-group-item i, #mobileGuestMenu .list-group-item i { width: 20px; text-align: center; color: var(--pm-text-2); }
#mobileUserMenu .list-group-item.text-danger, #mobileUserMenu .list-group-item.text-danger i { color: var(--pm-danger-fg) !important; }
#mobileUserMenu .btn-group .btn, #mobileGuestMenu .btn-group .btn { min-height: 0; height: 28px; padding: 0 8px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; }
#mobileUserMenu .btn-group .btn-primary, #mobileGuestMenu .btn-group .btn-primary { background: var(--pm-brand-500); border-color: var(--pm-brand-500); color: #fff; }
#mobileUserMenu .btn-group .btn-outline-secondary, #mobileGuestMenu .btn-group .btn-outline-secondary { background: #fff; color: var(--pm-text-2); border-color: var(--pm-border-strong); }
#mobileUserMenu .modal-dialog { margin: 0; width: 100%; max-width: 100%; position: fixed; bottom: 0; transform: none !important; }
#mobileUserMenu .modal-content { border-radius: 22px 22px 0 0; }
.modal-backdrop.show { opacity: .35; }

/* ================= Responsywność ================= */
@media (max-width: 1320px) {
  .pm-shop-header > .container { padding: 0 16px; gap: 12px; }
  .pm-shop-header .navbar-collapse { gap: 8px; }
  .pm-shop-header .pm-shop-nav .nav-link { padding: 8px 10px; font-size: 13px; }
  .pm-shop-header .pm-hdr-actions .nav-link { padding: 0 8px; }
  .pm-shop-header .pm-hdr-actions .nav-link.pm-btn { padding: 0 12px; }
}
/* Poniżej 1180 px menu, język, waluta i logowanie przejmuje dolna nawigacja (przycisk Menu / Profil) */
@media (max-width: 1180px) {
  :root { --pm-shop-header-h: 64px; }
  .pm-shop-header .navbar-collapse { display: none !important; }
  .pm-shop-header > .container { justify-content: center; }
  .pm-shop-header .navbar-brand img { width: 56px; }

  .bottom-nav {
    display: block; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 1000;
    background: rgba(255,255,255,.9); -webkit-backdrop-filter: blur(16px) saturate(1.5); backdrop-filter: blur(16px) saturate(1.5);
    border: 1px solid var(--pm-border); border-radius: 22px; padding: 6px;
    box-shadow: 0 12px 30px -10px rgba(28,25,23,.3);
  }
  .bottom-nav-list { display: flex; justify-content: space-between; gap: 2px; list-style: none; margin: 0; padding: 0; }
  .bottom-nav-item { flex: 1 1 0; min-width: 0; position: relative; text-align: center; transition: flex-grow .25s var(--pm-ease); }
  .bottom-nav-item:has(.bottom-nav-link.active) { flex-grow: 2.2; }
  .bottom-nav-link {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    height: 46px; padding: 4px 2px; border-radius: 16px; text-decoration: none;
    font: 600 10px/1.1 var(--pm-font); color: var(--pm-text-muted); transition: background .2s, color .2s;
  }
  .bottom-nav-link i { font-size: 18px; }
  .bottom-nav-link:hover { color: var(--pm-text); }
  .bottom-nav-link.active { color: var(--pm-brand-600); background: var(--pm-brand-50); }
  /* Podpis widoczny tylko przy aktywnej pozycji; pozostałe zostają dla czytników ekranu */
  .bottom-nav-link > span:not(.mobile-cart-badge) { white-space: nowrap; }
  .bottom-nav-link:not(.active) > span:not(.mobile-cart-badge) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bottom-nav-link.live-event::before {
    content: ""; position: absolute; top: 6px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%;
    background: var(--pm-brand-500); box-shadow: 0 0 0 2px #fff; animation: pm-pulse 1.6s infinite;
  }
  .mobile-cart-badge {
    position: absolute; top: 2px; left: calc(50% + 4px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
    background: var(--pm-brand-500); color: #fff; font: 700 10px/16px var(--pm-font); text-align: center;
  }
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  footer.pm-shop-footer { margin-top: 48px; padding: 40px 0 28px; }
  .pm-ft-top { flex-direction: column; align-items: flex-start; }
  .pm-ft-links { gap: 8px 20px; }

  /* Cookies nad dolną nawigacją */
  .cookie-banner.pm-cookie { left: 10px; right: 10px; width: auto; bottom: calc(80px + env(safe-area-inset-bottom)); padding: 16px; }
}
@media (max-width: 480px) {
  .pm-cookie .cookie-buttons .pm-btn { flex: 1 1 auto; }
  .pm-cookie #cookieSettings { flex: 0 0 auto; }
  .pm-cookie #cookieAcceptAll { flex-basis: 100%; margin-left: 0; order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  .pm-shop-header .pm-shop-nav .nav-link.live-event::before, .bottom-nav-link.live-event::before { animation: none; }
  .cookie-banner.pm-cookie, .cookie-modal { animation: none; }
}
@media print {
  .navbar, footer, .btn, .alert, .chat-widget, .bottom-nav { display: none !important; }
}
