/*
  Gympita UI polish layer.
  This file is intentionally additive: it improves motion, depth and feedback
  without changing gym data, SEO text, tracking attributes or page structure.
*/

:root {
  --ui-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ui-ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --ui-mint: #17BCAE;
  --ui-mint-dark: #109C91;
  --ui-mint-soft: #EAF9F6;
  --ui-blue: #1269D7;
  --ui-blue-dark: #0B57B8;
  --ui-blue-soft: #EEF7FF;
  --ui-navy: #103A6D;
  --ui-text: #183657;
  --ui-muted: #667C91;
  --ui-line: #D5E6F3;
  --ui-line-soft: #EDF5FA;
  --ui-shadow-soft: 0 14px 34px rgba(16, 58, 109, 0.09);
  --ui-shadow-card: 0 18px 50px rgba(16, 58, 109, 0.12);
  --ui-shadow-pop: 0 16px 36px rgba(18, 105, 215, 0.18);
}

.ui-polish-ready .hero-copy > *,
.ui-polish-ready.home-search-page .hero-feature-strip,
.ui-polish-ready.home-search-page .popular-area-section,
.ui-polish-ready.home-search-page .map-section,
.ui-polish-ready.area-redesign-page .hero .map-shell,
.ui-polish-ready.area-redesign-page .stats-band,
.ui-polish-ready.area-redesign-page .easy-finder {
  animation: ui-rise-in 0.7s var(--ui-ease-out) both;
}

.ui-polish-ready .hero-copy > *:nth-child(2) { animation-delay: 0.06s; }
.ui-polish-ready .hero-copy > *:nth-child(3) { animation-delay: 0.12s; }
.ui-polish-ready .hero-copy > *:nth-child(4) { animation-delay: 0.18s; }
.ui-polish-ready .hero-copy > *:nth-child(5) { animation-delay: 0.24s; }
.ui-polish-ready .hero-copy > *:nth-child(6) { animation-delay: 0.3s; }
.ui-polish-ready .hero-copy > *:nth-child(7) { animation-delay: 0.36s; }
.ui-polish-ready.home-search-page .hero-feature-strip { animation-delay: 0.42s; }
.ui-polish-ready.area-redesign-page .hero .map-shell { animation-delay: 0.16s; }
.ui-polish-ready.area-redesign-page .stats-band { animation-delay: 0.24s; }
.ui-polish-ready.area-redesign-page .easy-finder { animation-delay: 0.32s; }

.ui-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity 0.62s var(--ui-ease-out),
    transform 0.62s var(--ui-ease-out);
}

.ui-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.home-search-page .hero-search,
.area-redesign-page .easy-finder,
.area-redesign-page .priority-sort-panel,
.area-redesign-page .advanced-search-panel,
.area-redesign-page .list-state-card,
.area-redesign-page .compare-panel,
.home-search-page .compare-guide-card,
.home-search-page .map-copy {
  border-color: rgba(213, 230, 243, 0.9);
  box-shadow: var(--ui-shadow-soft);
}

.home-search-page .hero-search {
  position: relative;
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.96));
  transition:
    border-color 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s var(--ui-ease-out);
}

.home-search-page .hero-search:focus-within {
  border-color: rgba(18, 105, 215, 0.38);
  box-shadow: var(--ui-shadow-card);
  transform: translateY(-2px);
}

.home-search-page .hero-search button,
.home-search-page .button-primary,
.area-redesign-page .hero-action-primary,
.area-redesign-page .map-location-gate button,
.area-redesign-page .priority-sort-reset:not(:disabled) {
  transition:
    transform 0.18s var(--ui-ease-out),
    box-shadow 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease;
}

.home-search-page .hero-search button:hover,
.home-search-page .button-primary:hover,
.area-redesign-page .hero-action-primary:hover,
.area-redesign-page .map-location-gate button:hover {
  transform: translateY(-2px);
  box-shadow: var(--ui-shadow-pop);
}

.hero-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.hero-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 13px;
  color: var(--ui-blue-dark);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(213, 230, 243, 0.95);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  line-height: 1.2;
  box-shadow: 0 8px 20px rgba(16, 58, 109, 0.06);
  transition:
    transform 0.18s var(--ui-ease-out),
    border-color 0.18s ease,
    background-color 0.18s ease,
    color 0.18s ease;
}

.hero-quick-action:hover,
.hero-quick-action:focus-visible {
  color: #fff;
  background: var(--ui-blue);
  border-color: var(--ui-blue);
  transform: translateY(-2px);
}

.popular-area-card,
.area-card,
.condition-card,
.nearby-card,
.compare-guide-card,
.home-search-page .map-copy,
.area-redesign-page .gym-card,
.area-redesign-page .compare-slot {
  transition:
    transform 0.2s var(--ui-ease-out),
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    background-color 0.2s ease;
}

@media (hover: hover) {
  .popular-area-card:hover,
  .area-card:hover,
  .condition-card:hover,
  .nearby-card:hover,
  .area-redesign-page .gym-card:hover {
    transform: translateY(-4px);
    border-color: rgba(18, 105, 215, 0.24);
    box-shadow: var(--ui-shadow-card);
  }
}

.ui-count-pulse,
.home-search-page .search-results.ui-count-pulse,
.area-redesign-page #gym-count-label.ui-count-pulse,
.area-redesign-page #published-count.ui-count-pulse,
.area-redesign-page #favorite-count.ui-count-pulse {
  animation: ui-count-pulse 0.42s var(--ui-ease-out);
}

.home-search-page .search-results {
  transition: opacity 0.18s ease, transform 0.18s var(--ui-ease-out);
}

.home-search-page .search-results.ui-search-updated {
  opacity: 0.84;
  transform: translateY(2px);
}

.home-search-page .top-map-marker span {
  animation: ui-pin-drop 0.42s var(--ui-ease-out) both;
  animation-delay: calc(min(var(--ui-pin-index, 0), 24) * 0.015s);
}

.home-search-page .top-map-marker span,
.area-redesign-page .map-pin {
  box-shadow: 0 10px 20px rgba(23, 188, 174, 0.24);
}

.area-redesign-page .map-pin {
  animation: ui-pin-pop 0.36s var(--ui-ease-out) both;
}

.selected-filter-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px;
  background: rgba(238, 247, 255, 0.72);
  border: 1px solid var(--ui-line-soft);
  border-radius: 14px;
}

.selected-filter-tray[hidden] {
  display: none;
}

.selected-filter-tray__label {
  color: var(--ui-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.selected-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px 5px 11px;
  color: var(--ui-blue-dark);
  background: #fff;
  border: 1px solid rgba(18, 105, 215, 0.22);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 900;
}

.selected-filter-chip button {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  color: #fff;
  background: var(--ui-mint);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.area-redesign-page .filter-chip-group button,
.area-redesign-page .sort-tab,
.area-redesign-page .intent-choice-grid button,
.area-redesign-page .intent-choice-card {
  transition:
    transform 0.16s var(--ui-ease-out),
    box-shadow 0.16s ease,
    border-color 0.16s ease,
    background-color 0.16s ease,
    color 0.16s ease;
}

.area-redesign-page .filter-chip-group button:hover,
.area-redesign-page .sort-tab:hover,
.area-redesign-page .intent-choice-grid button:hover,
.area-redesign-page .intent-choice-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(16, 58, 109, 0.08);
}

.advanced-search-panel[open] .advanced-search-body {
  animation: ui-expand-soft 0.28s var(--ui-ease-out) both;
}

#gym-list,
.gyms-grid {
  transition: opacity 0.18s ease, transform 0.18s var(--ui-ease-out);
}

#gym-list.ui-list-updating,
.gyms-grid.ui-list-updating {
  opacity: 0.72;
  transform: translateY(4px);
}

.area-redesign-page .gym-card {
  isolation: isolate;
}

.area-redesign-page .gym-card::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  box-shadow: 0 0 0 0 rgba(23, 188, 174, 0);
  content: "";
  transition: box-shadow 0.2s ease;
}

.area-redesign-page .gym-card.ui-just-added::after {
  animation: ui-card-ring 0.72s var(--ui-ease-out);
}

.area-redesign-page .card-action-button.ui-just-activated .card-action-icon,
.area-redesign-page .card-action-button.is-active .card-action-icon,
.area-redesign-page [data-favorite].ui-just-activated .card-action-icon {
  animation: ui-heart-pop 0.42s var(--ui-ease-out);
}

.area-redesign-page .card-action-link.gym-official-link::after,
.area-redesign-page .compare-slot .gym-official-link::after,
.area-redesign-page .favorite-compare-table .gym-official-link::after {
  display: inline-block;
  margin-left: 4px;
  content: "→";
  transition: transform 0.16s var(--ui-ease-out);
}

.area-redesign-page .card-action-link.gym-official-link:hover::after,
.area-redesign-page .compare-slot .gym-official-link:hover::after,
.area-redesign-page .favorite-compare-table .gym-official-link:hover::after {
  transform: translateX(3px);
}

.area-redesign-page .gym-media {
  background:
    radial-gradient(circle at 20% 12%, rgba(23, 188, 174, 0.12), transparent 32%),
    linear-gradient(135deg, rgba(251, 253, 255, 0.98), rgba(238, 247, 255, 0.96));
}

.area-redesign-page .gym-media::after {
  position: absolute;
  right: 12px;
  bottom: 10px;
  z-index: 0;
  color: rgba(16, 58, 109, 0.18);
  content: "GYM PITA";
  font: 900 0.72rem/1 system-ui, sans-serif;
  letter-spacing: 0.08em;
}

.area-redesign-page .gym-media.is-image-ready::after {
  content: "";
}

.area-redesign-page .empty-list-message {
  position: relative;
  overflow: hidden;
}

.area-redesign-page .empty-list-message::before {
  display: block;
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  background:
    linear-gradient(135deg, var(--ui-blue), var(--ui-mint));
  border-radius: 16px;
  content: "";
  box-shadow: 0 14px 28px rgba(18, 105, 215, 0.16);
}

.compare-dock {
  position: fixed;
  right: clamp(12px, 2vw, 26px);
  bottom: clamp(12px, 2vw, 24px);
  left: clamp(12px, 2vw, 26px);
  z-index: 80;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(213, 230, 243, 0.95);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(16, 58, 109, 0.16);
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.98);
  transition:
    opacity 0.24s ease,
    transform 0.24s var(--ui-ease-out);
}

.compare-dock.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.compare-dock__summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  min-width: 0;
}

.compare-dock__count {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ui-navy);
  font-weight: 900;
  white-space: nowrap;
}

.compare-dock__count strong {
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  color: #fff;
  background: var(--ui-mint);
  border-radius: 999px;
  font-size: 0.86rem;
}

.compare-dock__items {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.compare-dock__item {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  max-width: 240px;
  min-height: 38px;
  padding: 7px 8px 7px 11px;
  color: var(--ui-text);
  background: var(--ui-blue-soft);
  border: 1px solid rgba(18, 105, 215, 0.16);
  border-radius: 999px;
  animation: ui-mini-card-in 0.28s var(--ui-ease-out);
}

.compare-dock__item span {
  min-width: 0;
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-dock__item small {
  color: var(--ui-muted);
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.compare-dock__remove {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--ui-blue-dark);
  background: #fff;
  border: 1px solid rgba(18, 105, 215, 0.2);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  line-height: 1;
}

.compare-dock__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.compare-dock__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 9px 16px;
  color: #fff;
  background: var(--ui-blue);
  border: 1px solid var(--ui-blue);
  border-radius: 999px;
  font-weight: 900;
  white-space: nowrap;
  transition:
    transform 0.18s var(--ui-ease-out),
    box-shadow 0.18s ease,
    background-color 0.18s ease;
}

.compare-dock__button.is-ready,
.compare-dock__button:hover {
  background: var(--ui-blue-dark);
  box-shadow: var(--ui-shadow-pop);
  transform: translateY(-2px);
}

.compare-dock__clear {
  min-height: 42px;
  padding: 8px 12px;
  color: var(--ui-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-weight: 900;
}

body.has-compare-dock {
  padding-bottom: 96px;
}

.ui-press-feedback {
  animation: ui-press-feedback 0.2s var(--ui-ease-out);
}

@keyframes ui-rise-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.992);
  }
  68% {
    opacity: 1;
    transform: translateY(-1px) scale(1);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ui-count-pulse {
  0% { transform: scale(1); }
  42% { transform: scale(1.08); color: var(--ui-mint-dark); }
  100% { transform: scale(1); }
}

@keyframes ui-pin-drop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.76);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ui-pin-pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.82);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ui-expand-soft {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ui-heart-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

@keyframes ui-card-ring {
  0% { box-shadow: 0 0 0 0 rgba(23, 188, 174, 0.34); }
  100% { box-shadow: 0 0 0 18px rgba(23, 188, 174, 0); }
}

@keyframes ui-mini-card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ui-press-feedback {
  0% { transform: scale(1); }
  50% { transform: scale(0.98); }
  100% { transform: scale(1); }
}

@media (max-width: 760px) {
  .hero-quick-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero-quick-action {
    justify-content: center;
    min-height: 46px;
  }

  .compare-dock {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 18px 18px 0 0;
  }

  .compare-dock__summary {
    display: grid;
    gap: 8px;
  }

  .compare-dock__items {
    padding-bottom: 2px;
  }

  .compare-dock__item {
    max-width: 210px;
  }

  .compare-dock__actions {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .compare-dock__button {
    min-height: 46px;
  }

  body.has-compare-dock {
    padding-bottom: 146px;
  }
}

@media (max-width: 760px) {
  .area-redesign-page .card-actions {
    gap: 8px;
  }

  .area-redesign-page .card-actions .card-action-interview {
    order: -1 !important;
    flex: 1 1 100% !important;
    justify-content: center !important;
    min-height: 52px !important;
    padding: 13px 16px !important;
    color: #fff !important;
    background: linear-gradient(135deg, var(--ui-mint-dark), var(--ui-blue-dark)) !important;
    border: 1px solid transparent !important;
    border-radius: 16px !important;
    font-size: 1rem !important;
    font-weight: 900 !important;
    line-height: 1.35 !important;
    text-align: center !important;
    white-space: normal !important;
    box-shadow: 0 14px 30px rgba(15, 143, 143, 0.28) !important;
  }

  .area-redesign-page .card-actions .gym-official-link {
    flex: 1 1 112px !important;
    justify-content: center !important;
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 0.78rem !important;
    box-shadow: 0 6px 14px rgba(18, 105, 215, 0.14) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }

  .ui-reveal,
  .ui-reveal.is-visible,
  .compare-dock,
  .compare-dock.is-visible {
    opacity: 1;
    transform: none;
  }
}
