/* ===============================
   Stylish Controls for Toyama Bear Map
   File: bearmap20251004.css (overwritten with stylish theme)
   Last updated: 2025-10-06 (JST)
   =============================== */

/* --- Base layout --- */
html, body {
  height: 100%;
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Noto Sans JP, "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
}

#map { position: absolute; inset: 0; }

/* --- Popup & Lightbox keep existing look (unchanged) --- */
.thumb-box { display: flex; flex-direction: column; gap: 8px; }
.thumb-box img { max-width: 200px; height: auto; display: block; border-radius: 6px; }
.thumb-title { font-weight: 700; font-size: 14px; }
.thumb-actions { display: flex; gap: 8px; }
.btn { appearance: none; border: none; border-radius: 6px; padding: 8px 12px; font-size: 13px; cursor: pointer; background: #2563eb; color: #fff; }
.btn:focus { outline: 2px solid #93c5fd; outline-offset: 2px; }

#lightbox { position: fixed; inset: 0; display: none; }
#lightbox[aria-hidden="false"] { display: block; }
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.55); }
.lightbox-panel { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: #111; color: #fff; border-radius: 14px; width: min(960px, 92vw); max-height: 88vh; overflow: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.lightbox-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.12); }
.lightbox-title { font-size: 16px; font-weight: 700; margin: 0; }
.lightbox-close { background: transparent; color: #fff; border: none; font-size: 22px; cursor: pointer; width: 44px; height: 44px; line-height: 44px; text-align: center; border-radius: 8px; }
.lightbox-close:focus { outline: 2px solid #93c5fd; outline-offset: 2px; }
.lightbox-body { padding: 12px 16px 18px; }
.lightbox-img-wrap { display: flex; justify-content: center; }
.lightbox-img { max-width: 100%; max-height: 68vh; height: auto; border-radius: 10px; display: block; }
.lightbox-caption { margin: 12px auto 0; font-size: 14px; line-height: 1.6; opacity: 0.95; }

@media (max-width: 480px) {
  .thumb-box img { max-width: 160px; }
  .lightbox-panel { width: 94vw; }
  .lightbox-caption { font-size: 13px; }
}

/* ===============================
   FILTER PANEL (top-left): modern glassy style
   =============================== */
.control {
  position: absolute; top: 12px; left: 12px; z-index: 3;
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(226,232,240,.9);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 12px 30px rgba(15,23,42,.12);
  display: grid;
  grid-auto-flow: row;
  gap: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
}
.control .row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  align-items: center;
}
.control label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  color: #0f172a;
  display: grid;
  gap: 4px;
}

/* Selects */
.control select {
  appearance: none;
  padding: 8px 32px 8px 12px;
  font-size: 13px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  background:
    linear-gradient(180deg, #ffffff, #f8fafc) padding-box,
    linear-gradient(180deg, rgba(255,255,255,.9), rgba(15,23,42,.06)) border-box;
  color: #0f172a;
  font-weight: 500;
  outline: none;
  box-shadow:
    0 1px 2px rgba(16,24,40,.08),
    inset 0 1px 0 rgba(255,255,255,.6);
  transition: box-shadow .2s ease, border-color .2s ease, background .25s ease;
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5.5 7.5l4.5 4.5 4.5-4.5' stroke='%23566' stroke-width='1.6' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px 16px;
}
.control select:hover {
  box-shadow: 0 8px 22px rgba(2,6,23,.10);
  background: linear-gradient(180deg, #ffffff, #f1f5f9);
}
.control select:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* Buttons */
.control button {
  appearance: none;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 9999px; /* pill */
  border: 1px solid #cbd5e1;
  background: linear-gradient(180deg, #ffffff, #f6f8fb);
  color: #0f172a;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow:
    0 1px 2px rgba(16, 24, 40, .08),
    inset 0 1px 0 rgba(255, 255, 255, .65);
  transition: transform .06s ease, box-shadow .2s ease, background .25s ease, border-color .25s ease, filter .2s ease;
}
.control button:hover { background: #f1f5f9; box-shadow: 0 10px 24px rgba(2, 6, 23, .10); }
.control button:active { transform: translateY(1px); }
.control button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.control button:disabled { opacity: .55; cursor: default; }

/* Primary (Apply) */
#apply {
  border-color: #1e3a8a;
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color: #fff;
  box-shadow:
    0 6px 16px rgba(37,99,235,.35),
    inset 0 1px 0 rgba(255,255,255,.35);
}
#apply:hover { filter: brightness(1.06); }
#apply:active { transform: translateY(1px); }

/* Secondary (Reset) */
#reset {
  background: transparent;
  color: #334155;
  border-color: #cbd5e1;
}
#reset:hover { background: #f8fafc; }

/* ===============================
   ANGLE / PITCH / BEARING (top-right)
   =============================== */
.angle-ctrl {
  position: absolute;
  right: 12px;
  top: 110px;
  z-index: 3;
  background: rgba(255,255,255,0.66);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 14px 32px rgba(15, 23, 42, .14);
  display: grid;
  grid-template-columns: repeat(2, 44px);
  gap: 8px;
  backdrop-filter: blur(8px);
}
.angle-ctrl button {
  width: 44px; height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(203, 213, 225, .9);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  cursor: pointer;
  font-size: 18px; line-height: 1;
  display: grid; place-items: center;
  box-shadow:
    0 1px 2px rgba(16,24,40,.08),
    inset 0 1px 0 rgba(255,255,255,.6);
  transition: transform .06s ease, box-shadow .2s ease, background .25s ease, border-color .25s ease;
}
.angle-ctrl button:hover { background: #f1f5f9; box-shadow: 0 10px 26px rgba(2,6,23,.12); }
.angle-ctrl button:active { transform: translateY(1px); }
.angle-ctrl button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }
.angle-ctrl .wide { grid-column: 1 / -1; width: 100%; border-radius: 12px; font-weight: 700; letter-spacing: .02em; }
.angle-ctrl button span { transform: translateY(-1px); }

/* --- Mapbox default control polish (optional) --- */
.mapboxgl-ctrl-top-right .mapboxgl-ctrl {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15,23,42,.12);
}
.mapboxgl-ctrl button { border-radius: 0; }

/* --- Zoom slider --- */
#zoomSlider{
  position:absolute; right:12px; bottom:12px; z-index:3;
  background:rgba(255,255,255,.75); border:1px solid #e5e7eb; border-radius:10px;
  padding:6px 8px; box-shadow:0 6px 14px rgba(0,0,0,.08); backdrop-filter: blur(6px);
}
#zoomRange { width:160px; }

/* --- Responsive --- */
@media (max-width: 640px) {
  .control { gap: 6px; padding: 8px; }
  .control .row { grid-auto-flow: row; grid-auto-columns: 1fr; }
  .control label { font-size: 11px; }
  .control select { font-size: 12px; }
  .control button { font-size: 12px; padding: 8px 14px; }
  .angle-ctrl { right: 10px; top: auto; bottom: 12px; grid-template-columns: repeat(4, 44px); }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .control button, .angle-ctrl button, .control select { transition: none; }
}


/* ===== Enhanced stylish angle controls (top-right) ===== */

/* Card upgrade: subtle gradient border + glass */
.angle-ctrl{
  position:absolute; right:12px; top:110px; z-index:3;
  padding: 10px;
  display:grid; grid-template-columns: repeat(2, 46px); gap:10px;
  background: linear-gradient(180deg, rgba(255,255,255,.75), rgba(248,250,252,.65));
  border-radius: 16px;
  border: 1px solid transparent;
  box-shadow: 0 18px 38px rgba(15,23,42,.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  isolation: isolate;
}
.angle-ctrl::before{
  content:"";
  position:absolute; inset:0; border-radius:16px; z-index:-1;
  padding:1px; /* gradient border */
  background: linear-gradient(135deg, rgba(99,102,241,.55), rgba(59,130,246,.55), rgba(14,165,233,.55));
  -webkit-mask: 
    linear-gradient(#000 0 0) content-box, 
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}

/* Buttons: icon pills with depth */
.angle-ctrl button{
  width:46px; height:46px;
  border-radius: 14px;
  border: 1px solid rgba(203,213,225,.85);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  display:grid; place-items:center;
  cursor:pointer;
  box-shadow:
    0 1px 2px rgba(16,24,40,.08),
    inset 0 1px 0 rgba(255,255,255,.65);
  transition: transform .06s ease, box-shadow .25s ease, filter .25s ease, background .25s ease, border-color .25s ease;
  position: relative;
  overflow: hidden;
}
.angle-ctrl button:hover{
  filter: brightness(1.02);
  box-shadow: 0 14px 28px rgba(2,6,23,.14);
}
.angle-ctrl button:active{ transform: translateY(1px); }
.angle-ctrl button:focus-visible { outline: 3px solid #93c5fd; outline-offset: 2px; }

/* Subtle interactive sheen */
.angle-ctrl button::after{
  content:"";
  position:absolute; inset:-120% -120% auto -120%;
  height:60%; transform: rotate(25deg);
  background: linear-gradient(90deg, rgba(255,255,255,.0), rgba(255,255,255,.35), rgba(255,255,255,.0));
  transition: transform .6s ease;
  pointer-events: none;
}
.angle-ctrl button:hover::after{ transform: translateY(160%) rotate(25deg); }

/* Icon sprites via CSS masks (no HTML change needed) */
.angle-ctrl button::before{
  content:"";
  width:22px; height:22px;
  display:block;
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;
  -webkit-mask-position:center; mask-position:center;
  -webkit-mask-size:contain; mask-size:contain;
  background: #0f172a;
}

/* 1) Rotate Left (↺) */
.angle-ctrl button:nth-child(1)::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 6a6 6 0 1 1-4.24 10.24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M8 6H4v4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 6a6 6 0 1 1-4.24 10.24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M8 6H4v4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* 2) Rotate Right (↻) */
.angle-ctrl button:nth-child(2)::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 6a6 6 0 1 0 4.24 10.24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M16 6h4v4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 6a6 6 0 1 0 4.24 10.24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M16 6h4v4' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* 3) Pitch Down (▽) */
.angle-ctrl button:nth-child(3)::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* 4) Pitch Up (△) */
.angle-ctrl button:nth-child(4)::before{
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 15l-6-6-6 6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M18 15l-6-6-6 6' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Reset (wide button) with refresh icon */
.angle-ctrl .wide{
  grid-column:1 / -1;
  width:100%; height:46px;
  border-radius: 14px;
  border: 1px solid rgba(203,213,225,.85);
  background: linear-gradient(180deg, #2563eb, #1d4ed8);
  color:#fff;
  font-weight: 700; letter-spacing:.02em;
  box-shadow:
    0 8px 18px rgba(37,99,235,.35),
    inset 0 1px 0 rgba(255,255,255,.35);
}
.angle-ctrl .wide:hover{ filter: brightness(1.06); box-shadow: 0 16px 30px rgba(2,6,23,.16); }
.angle-ctrl .wide:active{ transform: translateY(1px); }
.angle-ctrl .wide::before{
  content:"";
  width:22px; height:22px; display:inline-block; vertical-align:-5px; margin-right:6px;
  -webkit-mask-repeat:no-repeat; mask-repeat:no-repeat;
  -webkit-mask-position:center; mask-position:center;
  -webkit-mask-size:contain; mask-size:contain;
  background:#fff;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 12a8 8 0 1 1-2.34-5.66' fill='none' stroke='%23fff' stroke-width='2'/%3E%3Cpath d='M20 4v6h-6' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 12a8 8 0 1 1-2.34-5.66' fill='none' stroke='%23fff' stroke-width='2'/%3E%3Cpath d='M20 4v6h-6' fill='none' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E");
}

/* Dark mode support if page uses dark background later */
@media (prefers-color-scheme: dark){
  .angle-ctrl{
    background: linear-gradient(180deg, rgba(15,23,42,.7), rgba(2,6,23,.6));
    box-shadow: 0 18px 38px rgba(0,0,0,.4);
  }
  .angle-ctrl button{
    background: linear-gradient(180deg, #111827, #0b1220);
    border-color: rgba(148,163,184,.35);
  }
  .angle-ctrl button::before{ background:#e5e7eb; }
}

/* === Fix double icons: hide legacy arrow glyphs inside small buttons === */
.angle-ctrl button { font-size: 0; color: transparent; text-shadow: none; }
/* Keep label text visible for the wide reset button */
.angle-ctrl .wide { font-size: 13px; color: #fff; }

/* === Mobile: slim & subtle right-side control === */
@media (max-width: 768px) {
  /* パネル全体をスリム化＆右下へ移動 */
  .angle-ctrl {
    right: 6px;
    top: auto;
    bottom: 60px;
    padding: 4px;
    gap: 4px;
    grid-template-columns: repeat(2, 36px);
    background: rgba(255, 255, 255, 0.25);       /* 透け感UP */
    border: 1px solid rgba(255, 255, 255, 0.20); /* 枠を控えめに */
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);     /* 影も控えめに */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  /* 各ボタンも一回り小さく・軽く */
  .angle-ctrl button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.40);
    border: 1px solid rgba(255, 255, 255, 0.30);
    box-shadow: none;
  }
  .angle-ctrl button:hover {
    background: rgba(255, 255, 255, 0.55);
    box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  }

  /* リセット（wide）はアクセントを少しだけ残す */
  .angle-ctrl .wide {
    grid-column: 1 / -1;
    height: 36px;
    font-size: 12px;               /* ラベルを少し小さく */
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.75);
    border: none;
    box-shadow: 0 6px 12px rgba(37,99,235,0.25);
  }
}
