:root {
  --sg-green: #DFFF00;
  --sg-green-dark: #b8cc00a4;
  --sg-green-lightdark: #ddff00c4;
  --sg-green-glow: rgba(221, 255, 0, 0.267);

  --sg-gray: #a0a0a0;
  --sg-lightgray: #c6c6c6;

  --ease-premium: cubic-bezier(.16, 1, .3, 1);
}

.branches {
  padding: 0 16px;
  max-width: 1200px;
  margin: auto;
}

.branches h2 {
  margin-bottom: 0;
  text-align: center;
}

.branches-subtitle {
  text-align: center;
  color: var(--sg-lightgray);
}

.branch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

.branch-grid:last-child {
  margin-bottom: 0;
}

.branch-item {
  min-width: 0;
}

.branch-card,
.branch-card-preparation {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  padding: 18px;
  box-sizing: border-box;

  background: #0b0b0b;
  position: relative;
  overflow: hidden;
  isolation: isolate;

  border: 1px solid #1c1c1ccc;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;

  box-shadow:
    0 8px 24px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(255,255,255,0.03);

  transition: all 0.2s ease;
}

.branch-card-preparation {
  cursor: auto;
  opacity: 0.5;
  transition: all 0.2s ease;
}

@media (max-width: 1100px) {
  .branch-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 840px) {
  .branch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (max-width: 550px) {
  .branch-grid {
    grid-template-columns: 1fr;
  }
  .branch-card,
  .branch-card-preparation {
    aspect-ratio: 3 / 2;
  }
}

.branch-card::before,
.branch-card-preparation::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: -1;

  background:
    radial-gradient(70% 70% at 10% 15%, rgba(255,255,255,0.14), transparent 65%),
    radial-gradient(70% 70% at 90% 85%, rgba(255,255,255,0.11), transparent 65%),
    radial-gradient(120% 100% at 50% 55%, rgba(0,0,0,0), rgba(0,0,0,0.55) 75%);

  opacity: 1;
}

.branch-card::after {
  content: "";
  position: absolute;
  inset: -0.5%;
  border-radius: inherit;
  z-index: -1;

  background:
    radial-gradient(70% 70% at 15% 20%, rgba(223,255,0,0.13), transparent 70%),
    radial-gradient(70% 70% at 85% 80%, rgba(223,255,0,0.13), transparent 70%),
    radial-gradient(120% 100% at 50% 55%, rgba(223,255,0,0.1), transparent 75%);

  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.4s ease, box-shadow 0.4s ease, transform 0.4s ease;
  transition-delay: 0.09s;
  pointer-events: none;
}

.branch-card:hover {
  transform: translateY(-5px);

  box-shadow:
    0 14px 32px rgba(0,0,0,0.65),
    0 0 28px rgba(223,255,0,0.16),
    inset 0 1px 0 rgba(255,255,255,0.04);

    border: 1px solid var(--sg-green-glow);

    transition: transform 0.15s ease, box-shadow 0.1s ease, border 0.1s ease;
}

.branch-card:hover .branch-logo,
.branch-card-preparation:hover .branch-logo,
.branch-card-preparation:hover .branch-logo-plus {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

.branch-card:hover::after {
  opacity: 1;
  transform: scale(1);
  box-shadow:
    inset 0 0 15px rgb(0, 0, 0);
}

.branch-name {
  margin: 0 0 5px;
  font-size: 16px;
  color: rgb(255, 255, 255);
}

.branch-address {
  margin: 0;
  font-size: 14px;
  color: var(--sg-lightgray);
}

.branch-logo {
  display: block;
  max-width: 120px;
  height: auto;
  width: auto;
  margin: auto;
  
  transition: transform 0.5s ease;
}

.branch-logo-plus {
  display: block;
  max-width: 135px;
  height: auto;
  width: auto;
  margin: auto;
  
  transition: transform 0.5s ease;
}

.branch-actions {
  display: flex;
  justify-content: space-between;
}

.branch-card button {
  cursor: pointer;
}


/* ===================== */
/*      MODAL ANIM.      */
/* ===================== */

.branch-modal::backdrop {
  background: rgba(0, 0, 0, 0); 
  transition: background-color 260ms ease;
}

/* keď sa otvára alebo je otvorený */
.branch-modal.is-opening::backdrop,
.branch-modal.is-open::backdrop {
  background: rgba(0, 0, 0, 0.136); /* polopriesvitná čierna */
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px); /* Safari */
}

/* keď sa zatvára */
.branch-modal.is-closing::backdrop {
  background: rgba(0, 0, 0, 0);
}

/* Panel: default stav pri otvorenom dialogu je "neviditeľný" (aby nikdy nebliklo) */
.branch-modal[open] .branch-modal__inner {
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: transform 260ms ease, opacity 260ms ease;
  will-change: transform, opacity;
}

/* otvorené / otváranie */
.branch-modal.is-opening .branch-modal__inner,
.branch-modal.is-open .branch-modal__inner {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* zatváranie */
.branch-modal.is-closing .branch-modal__inner {
  opacity: 0;
  transform: translateY(16px) scale(0.985);
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  .branch-modal[open] .branch-modal__inner,
  .branch-modal::backdrop {
    transition: none !important;
  }
}

html.sg-modal-open {
  overflow: hidden;
  scrollbar-gutter: stable; 
  padding-right: 0;         
}


/* ===================== */
/*         MODAL         */
/* ===================== */

.branch-modal {
  width: min(1200px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  padding: 0;
  color: inherit;
  background: transparent;
}

.branch-modal__inner {
  position: relative;
  padding: 1.5rem;
  max-height: calc(90vh - 32px);
  background: #191919; 
  border-radius: 18px;  
  overflow: auto;  
  scrollbar-gutter: stable;  
  border: 1px solid #ffffff15;   
  font-size: 14px; 
}

.branch-modal__inner img {
  vertical-align: middle;
}

.branch-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  border: 0;
  background: transparent;
  color: rgb(133, 133, 133);
  font-size: 24px;
  cursor: pointer;
  z-index: 999;
  transition: all 0.1s ease;
}

.branch-modal__close:hover {
  color: rgb(255, 255, 255);
}

.branch-modal__header {
  display: block;
  text-align: left;
  z-index: inherit;
  padding-top: 0;
  position: static;
}

.branch-modal__header__wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding-bottom: 35px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: #191919;
  position: sticky;
}

.branch-modal__title {
  font-size: 22px;
  margin: 0;
  color: rgb(255, 255, 255);
  padding-right: 3%;
}

.branch-modal__actions {
  display: flex;
  gap: 10px;
  margin-right: 50px;
}

.branch-modal__actions .is-disabled {
  pointer-events: none;
  opacity: 0.5;
}

@media (max-width: 790px) {
  .branch-modal__header__wrap {
    flex-direction: column;
  }
  .branch-modal__title {
    padding-right: 0;
    margin-bottom: 20px;
  }
  .branch-modal__actions {
    margin-right: 0;
  }
}

.branch-modal__topinfo {
  color: var(--sg-lightgray);
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.branch-modal__topinfo p {
  margin: 0;
  min-width: 0;
  padding: 14px 18px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  justify-content: center;
  transition: all 0.2s ease;
}

.branch-modal__topinfo p {
  border-left: 1px solid rgba(255,255,255,0.08);
  border-right: 1px solid rgba(255,255,255,0.08);
}

.branch-modal__topinfo p:hover {
  background: rgba(255,255,255,0.04);
  color: rgb(255, 255, 255);
  transform: translateY(-4px);

  transition: all 0.1s ease;
}

.branch-modal__topinfo p:hover img {
  transform: scale(1.3);
}

.branch-modal__topinfo p img {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  transition: all 0.2s ease-in-out;

}

@media (max-width: 900px) {
  .branch-modal__topinfo {
    grid-template-columns: 1fr;
  }
}

.branch-modal__status {
  margin-top: 14px;
  opacity: 0.85;
}

.branch-modal__layout {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 35px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.branch-modal__content {
  flex: 1 1 45%;
  min-width: 0;
}

.branch-modal__content h4 {
  color: rgb(255, 255, 255);
  margin-bottom: 25px;
  font-size: 18px;
}

.branch-modal__content .branch-howto .branch-howto-title {
  color: rgb(255, 255, 255);
  margin-bottom: 0;
  margin-top: 25px;
}

.branch-modal__content .branch-howto .branch-howto-text {
  margin-top: 5px;
  line-height: 1.3;
}

.branch-nav-btn {
  margin-top: 15px;
  cursor: pointer;
  background-color: transparent;
  outline: 0;
}

.branch-map {
  flex: 1.2 1 55%;
  min-width: 360px;
}

.branch-map__canvas {
  width: 100%;
  height: 320px;
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  background: #0b0d10; /* fallback */
}

@media (max-width: 900px) {
  .branch-modal__layout {
    flex-direction: column;
    padding-top: 10px;
  }

  .branch-modal__content,
  .branch-map {
    width: 100%;
    min-width: 0;
  }
}

.branch-photos{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 35px;
}

.branch-photo{
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
}

@media (max-width: 900px){
  .branch-photos{
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px){
  .branch-photos{
    grid-template-columns: 1fr;
  }
}



/* ===================== */
/*      MAP MARKER       */
/* ===================== */

.sg-map-marker {
  position: relative;
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  transform: scale(0.85);
  animation: sgMarkerIntro 0.3s ease-in-out forwards;
  animation-delay: 1s;
}

@keyframes sgMarkerIntro {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  50% {
    opacity: 1;
    transform: scale(1.4);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.sg-map-marker__img {
  position: relative;
  z-index: 2;
  width: 45px;
  height: 45px;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 0 6px rgba(223,255,0,0.35));
}

.sg-map-marker__pulse {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: rgba(223,255,0,0.25);
  transform: translate(-50%, -50%);
  animation: sgMarkerPulse 2.2s ease-out infinite;
  z-index: 1;
}

@keyframes sgMarkerPulse {
  0% {
    transform: translate(-50%, -50%) scale(0.7);
    opacity: 0.7;
  }
  70% {
    transform: translate(-50%, -50%) scale(2.2);
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}
