/* ============================================================================
   PizzaMap — styl mapy świata + panel „od zaplecza"
   Wymaga flagship.css i Leaflet.
   ============================================================================ */

.map-page { min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; }
.map-shell { display: grid; grid-template-columns: 380px 1fr; height: min(82vh, 900px); min-height: 580px; }

/* ----- panel boczny ----- */
.map-aside { display: flex; flex-direction: column; min-height: 0; background: var(--cream); border-right: 1.5px solid var(--line); }
.map-aside .top { padding: var(--s4) var(--s4) var(--s3); border-bottom: 1.5px solid var(--line); }
.map-aside h1 { font-size: 26px; } .map-aside h1 b { color: var(--red); }
.map-aside .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.aside-search { margin-top: var(--s3); display:flex; align-items:center; gap: var(--s1); background: var(--cream-2); border:1.5px solid var(--line-2); border-radius: var(--r-pill); padding: 6px 6px 6px 16px; }
.aside-search:focus-within { border-color: var(--red); }
.aside-search svg { color: var(--muted); flex:none; }
.aside-search input { flex:1; border:none; background:none; font-family: var(--body); font-size: 15px; padding: 9px 2px; min-width:0; }
.aside-search input:focus { outline:none; }
.aside-stats { display:flex; gap: var(--s3); margin-top: var(--s3); font-size: 13px; color: var(--muted); }
.aside-stats b { color: var(--ink); font-family: var(--display); font-size: 18px; }

.place-list { flex:1; overflow-y: auto; padding: var(--s2); display:flex; flex-direction:column; gap: var(--s1); }
.place-item { display:grid; grid-template-columns: 46px 1fr auto; gap: var(--s2); align-items:center; padding: var(--s2); border:1.5px solid transparent; border-radius: var(--r-md); cursor:pointer; transition: background .2s, border-color .2s; text-align:left; background:none; width:100%; font-family: var(--body); }
.place-item:hover, .place-item.active { background: var(--cream-2); border-color: var(--line); }
.place-item .logo { width:46px; height:46px; border-radius: 50%; background: var(--cream-3); border:1.5px solid var(--line); display:grid; place-items:center; font-family: var(--display); font-weight:700; color: var(--red); overflow:hidden; flex:none; }
.place-item .logo img { width:100%; height:100%; object-fit: cover; }
.place-item .name { font-family: var(--display); font-weight:700; font-size: 16px; line-height:1.15; }
.place-item .meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.place-item .badge { background: var(--red); color:#fff; font-family: var(--display); font-weight:800; font-size: 14px; min-width: 38px; height: 38px; border-radius: 50%; display:grid; place-items:center; }
.place-item .badge.u { background: var(--green); }
.place-item .you { font-size: 10px; letter-spacing:.1em; text-transform:uppercase; color: var(--green-deep); font-weight:700; }

.aside-foot { padding: var(--s3) var(--s4); border-top: 1.5px solid var(--line); }

/* ----- mapa ----- */
.map-main { position: relative; min-height: 0; }
#map { position:absolute; inset:0; background: var(--cream-3); }
.leaflet-container { font-family: var(--body); background: #aadaff; }

/* znacznik */
.pmk { width: 40px; height: 40px; position: relative; }
.pmk .pin { width: 40px; height:40px; border-radius: 50%; background: var(--red); box-shadow: 0 4px 10px rgba(36,26,20,.45); display:grid; place-items:center; border: 2px solid #fff; overflow:hidden; }
.pmk.user .pin { background: var(--green); }
.pmk .pin > * { transform: none; }
.pmk .ini { color:#fff; font-family: var(--display); font-weight:800; font-size: 14px; }
.pmk .logo { width: 30px; height:30px; border-radius:50%; overflow:hidden; background:#fff; }
.pmk .logo img { width:100%; height:100%; object-fit:cover; }
.pmk .rankbadge { position:absolute; top:-6px; right:-6px; min-width:18px; height:18px; padding:0 4px; border-radius:9px; background: var(--amber); color: var(--ink); font-family: var(--display); font-weight:800; font-size:11px; display:grid; place-items:center; border:1.5px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); }

/* popup */
.leaflet-popup-content-wrapper { border-radius: var(--r-md); box-shadow: var(--sh-2); }
.leaflet-popup-content { margin: 0; }
.pp { width: 250px; font-family: var(--body); }
.pp .img { height: 110px; background: var(--cream-3); position:relative; overflow:hidden; }
.pp .img img { width:100%; height:100%; object-fit:cover; }
.pp .img .ph2 { position:absolute; inset:0; display:grid; place-items:center; font-family: var(--display); font-weight:800; font-size: 34px; color: var(--red); background: repeating-linear-gradient(-45deg, var(--cream-3) 0 10px, #ecdcc4 10px 11px); }
.pp .img .ppflag { position:absolute; right:8px; bottom:8px; font-size:22px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }
.pp .b { padding: 12px 16px 14px; }
.pp .pprank { display:inline-block; font-size:10.5px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:#fff; background: var(--amber-deep); padding:3px 9px; border-radius:100px; margin-bottom:7px; }
.pp .pprank.user { background: var(--green); }
.pp .nm { font-family: var(--display); font-weight:700; font-size: 19px; line-height:1.1; }
.pp .ppmaster { font-size:12px; font-weight:600; color: var(--amber-deep); margin-top:3px; }
.pp .ad { color: var(--muted); font-size: 13px; margin-top: 5px; line-height:1.4; }
.pp .ppscores { display:flex; gap:8px; align-items:stretch; margin-top: 10px; }
.pp .ppscores .sc { display:flex; flex-direction:column; align-items:center; background: var(--cream-3); border-radius: var(--r-sm); padding:5px 10px; font-family: var(--display); font-weight:800; font-size:17px; color: var(--red); line-height:1.1; }
.pp .ppscores .sc.ta { color: var(--ink-2); }
.pp .ppscores .sc small { font-family: var(--body); font-weight:600; font-size:8.5px; letter-spacing:.05em; text-transform:uppercase; color: var(--muted); margin-top:2px; }
.pp .ppscores .ppprice { display:flex; align-items:center; font-weight:700; color: var(--green-deep); font-size:14px; }
.pp .rowx { display:flex; align-items:center; justify-content:space-between; margin-top: 12px; gap:8px; }
.pp .ppmaps { font-size:12.5px; font-weight:600; color: var(--red); white-space:nowrap; }
.pp .ppmaps:hover { color: var(--orange); }
.pp .sc-legacy { background: var(--red); color:#fff; font-family: var(--display); font-weight:800; padding: 4px 12px; border-radius: var(--r-pill); font-size: 15px; }
.pp .del { background:none; border:1.5px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 10px; font-size: 12.5px; color: var(--muted); font-weight:600; }
.pp .del:hover { border-color: var(--red); color: var(--red); }

/* przycisk dodawania */
.add-fab { position: absolute; right: var(--s4); bottom: var(--s4); z-index: 500; }

/* tryb wskazywania lokalizacji */
.map-main.picking #map { cursor: crosshair; }
.pick-hint { position:absolute; top: var(--s3); left:50%; transform: translateX(-50%); z-index: 500; background: var(--ink); color:#fff; padding: 10px 18px; border-radius: var(--r-pill); font-size: 14px; font-weight:600; box-shadow: var(--sh-2); display:none; align-items:center; gap:8px; }
.map-main.picking .pick-hint { display:inline-flex; }

/* ----- drawer / formularz ----- */
.drawer-back { position: fixed; inset:0; background: rgba(36,26,20,.45); z-index: 600; opacity:0; pointer-events:none; transition: opacity .3s; }
.drawer-back.open { opacity:1; pointer-events:auto; }
.drawer { position: fixed; top:0; right:0; bottom:0; width: min(440px, 92vw); background: var(--cream); z-index: 610; box-shadow: var(--sh-3); transform: translateX(100%); transition: transform .35s var(--ease); display:flex; flex-direction:column; }
.drawer.open { transform:none; }
.drawer .d-head { padding: var(--s4); border-bottom: 1.5px solid var(--ink); display:flex; align-items:flex-start; justify-content:space-between; }
.drawer .d-head h2 { font-size: 24px; } .drawer .d-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.drawer .d-close { width:40px; height:40px; border:1.5px solid var(--line-2); border-radius: var(--r-sm); background: var(--cream-2); display:grid; place-items:center; flex:none; }
.drawer .d-body { padding: var(--s4); overflow-y:auto; flex:1; display:flex; flex-direction:column; gap: var(--s3); }
.field-g { display:flex; flex-direction:column; gap: 6px; }
.field-g label { font-size: 12px; letter-spacing:.1em; text-transform:uppercase; color: var(--muted); font-weight:600; }
.field-g input, .field-g select { border:1.5px solid var(--line-2); background: var(--cream-2); border-radius: var(--r-sm); padding: 12px 14px; font-family: var(--body); font-size: 15px; color: var(--ink); }
.field-g input:focus, .field-g select:focus { outline:none; border-color: var(--red); }
.field-row { display:grid; grid-template-columns: 1fr 1fr; gap: var(--s2); }
.logo-drop { display:flex; align-items:center; gap: var(--s2); }
.logo-drop .prev { width: 56px; height:56px; border-radius:50%; border:1.5px dashed var(--line-2); background: var(--cream-2); display:grid; place-items:center; overflow:hidden; flex:none; color: var(--muted); }
.logo-drop .prev img { width:100%; height:100%; object-fit:cover; }
.logo-drop .btn-file { border:1.5px solid var(--line-2); background: var(--cream-2); border-radius: var(--r-sm); padding: 10px 14px; font-size: 14px; font-weight:600; cursor:pointer; }
.logo-drop .btn-file:hover { border-color: var(--red); color: var(--red); }
.loc-field { display:flex; align-items:center; gap: var(--s2); }
.loc-field .val { flex:1; font-size: 13.5px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.loc-field .val.set { color: var(--green-deep); }
.d-foot { padding: var(--s4); border-top: 1.5px solid var(--line); display:flex; gap: var(--s2); }
.d-foot .btn { flex:1; }
.form-err { color: var(--red); font-size: 13.5px; display:none; }
.form-err.show { display:block; }

/* responsywność */
@media (max-width: 860px){
  .map-shell { grid-template-columns: 1fr; grid-template-rows: 1fr; }
  .map-aside { position: absolute; z-index: 450; left:0; top:0; bottom:0; width: min(330px, 86vw); transform: translateX(-100%); transition: transform .3s var(--ease); box-shadow: var(--sh-2); }
  .map-aside.open { transform:none; }
  .aside-toggle { position:absolute; left: var(--s3); top: var(--s3); z-index: 460; }
}
@media (min-width: 861px){ .aside-toggle { display:none; } }
