/*
 * P2 Design Update
 * Visual-only iOS-like polish. Backend/API flow is intentionally untouched.
 */
:root {
  --p2-bg-deep: #070A12;
  --p2-card: rgba(255,255,255,.095);
  --p2-card-strong: rgba(255,255,255,.14);
  --p2-hairline: rgba(255,255,255,.12);
  --p2-glow-blue: rgba(10,132,255,.34);
  --p2-glow-violet: rgba(108,92,231,.24);
  --p2-glow-green: rgba(48,209,88,.14);
  --p2-radius-card: 30px;
  --p2-radius-control: 18px;
  --p2-shadow-card: 0 24px 70px rgba(0,0,0,.38), inset 0 1px 0 rgba(255,255,255,.09);
  --p2-shadow-control: 0 12px 32px rgba(0,0,0,.22), inset 0 1px 0 rgba(255,255,255,.08);
}

html[data-theme="light"] {
  --p2-bg-deep: #F3F6FF;
  --p2-card: rgba(255,255,255,.78);
  --p2-card-strong: rgba(255,255,255,.92);
  --p2-hairline: rgba(10,20,35,.10);
  --p2-glow-blue: rgba(10,132,255,.18);
  --p2-glow-violet: rgba(108,92,231,.12);
  --p2-glow-green: rgba(48,209,88,.10);
  --p2-shadow-card: 0 22px 64px rgba(22,38,68,.13), inset 0 1px 0 rgba(255,255,255,.9);
  --p2-shadow-control: 0 12px 28px rgba(22,38,68,.10), inset 0 1px 0 rgba(255,255,255,.85);
}

body {
  letter-spacing: -0.01em;
}

.app-shell {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(850px 520px at 18% -8%, var(--p2-glow-blue), transparent 62%),
    radial-gradient(760px 520px at 108% 2%, var(--p2-glow-violet), transparent 58%),
    radial-gradient(760px 520px at 50% 110%, var(--p2-glow-green), transparent 62%),
    linear-gradient(180deg, var(--p2-bg-deep), var(--bg2));
}

.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.55), transparent 58%);
}

.topbar,
.main,
.bottom-nav,
.modal,
.loading-overlay {
  position: relative;
}

.topbar {
  z-index: 20;
  border-bottom: 1px solid var(--p2-hairline);
  background: linear-gradient(180deg, rgba(8,11,19,.72), rgba(8,11,19,.32));
  box-shadow: 0 12px 34px rgba(0,0,0,.16);
}

html[data-theme="light"] .topbar {
  background: linear-gradient(180deg, rgba(255,255,255,.84), rgba(255,255,255,.52));
}

.brand-mark {
  border-radius: 16px;
  background:
    radial-gradient(circle at 28% 20%, rgba(255,255,255,.36), transparent 30%),
    linear-gradient(145deg, rgba(10,132,255,.92), rgba(88,86,214,.62));
  box-shadow: 0 16px 34px rgba(10,132,255,.24), inset 0 1px 0 rgba(255,255,255,.24);
}

.brand-title {
  font-weight: 850;
}

.icon-btn,
.btn,
.nav-item,
.tab,
.action-btn,
.form-input,
.form-select,
.form-textarea,
.media-card,
.dp__cell {
  -webkit-tap-highlight-color: transparent;
}

.glass-card,
.form-card {
  border-radius: var(--p2-radius-card);
  background:
    linear-gradient(180deg, var(--p2-card-strong), var(--p2-card));
  border: 1px solid var(--p2-hairline);
  box-shadow: var(--p2-shadow-card);
}

.form-card {
  padding: clamp(16px, 4vw, 24px);
}

.section-head {
  margin: 18px 2px 14px;
}

.section-head--compact {
  margin-top: 14px;
}

.section-title {
  font-size: clamp(22px, 6vw, 34px);
  font-weight: 900;
  letter-spacing: -0.06em;
}

.section-note {
  line-height: 1.45;
  font-weight: 600;
}

.home-hero {
  position: relative;
  padding: clamp(22px, 7vw, 34px);
  margin: 8px 0 18px;
  overflow: hidden;
  isolation: isolate;
}

.home-hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto auto;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(10,132,255,.40), transparent 64%);
  z-index: -1;
}

.home-hero::after {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.38), transparent);
}

.home-hero__badge {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(10,132,255,.28);
  background: rgba(10,132,255,.14);
  color: rgba(255,255,255,.88);
  font-size: 12px;
  font-weight: 850;
  margin-bottom: 16px;
}

html[data-theme="light"] .home-hero__badge { color: rgba(0,0,0,.78); }

.home-hero__title {
  margin: 0;
  max-width: 12ch;
  font-size: clamp(34px, 11vw, 58px);
  line-height: .92;
  letter-spacing: -0.075em;
  font-weight: 950;
}

.home-hero__text {
  margin: 14px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(14px, 3.6vw, 16px);
  line-height: 1.48;
  font-weight: 650;
}

.home-hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.home-hero__stats div {
  min-height: 74px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid var(--p2-hairline);
  background: rgba(255,255,255,.065);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}

html[data-theme="light"] .home-hero__stats div { background: rgba(255,255,255,.54); }

.home-hero__stats strong,
.home-hero__stats span {
  display: block;
}

.home-hero__stats strong {
  font-size: 14px;
  font-weight: 900;
  margin-bottom: 6px;
}

.home-hero__stats span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.action-btn {
  border-radius: 24px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.105), rgba(255,255,255,.052));
  border: 1px solid var(--p2-hairline);
  box-shadow: var(--p2-shadow-control);
  transition: transform .22s var(--ease), filter .22s var(--ease), border-color .22s var(--ease), background .22s var(--ease);
}

.action-btn:hover {
  filter: brightness(1.06);
  border-color: rgba(10,132,255,.28);
}

.action-btn:active {
  transform: scale(.985) !important;
}

.action-btn i:first-child {
  width: 46px;
  height: 46px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.25), transparent 30%),
    linear-gradient(145deg, rgba(10,132,255,.28), rgba(88,86,214,.16));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 10px 22px rgba(10,132,255,.13);
}

.action-title {
  font-size: 15px;
  font-weight: 850;
  line-height: 1.18;
  letter-spacing: -0.025em;
}

.action-sub {
  font-size: 12.5px;
  line-height: 1.32;
  font-weight: 650;
}

.form-grid {
  gap: 16px;
}

label {
  font-weight: 850;
  letter-spacing: -0.01em;
}

.form-input,
.form-select,
.form-textarea {
  border-radius: var(--p2-radius-control);
  border-color: var(--p2-hairline);
  background: rgba(255,255,255,.075);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 8px 18px rgba(0,0,0,.08);
}

html[data-theme="light"] .form-input,
html[data-theme="light"] .form-select,
html[data-theme="light"] .form-textarea {
  background: rgba(255,255,255,.82);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted2);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: rgba(10,132,255,.62);
  box-shadow: 0 0 0 4px rgba(10,132,255,.16), inset 0 1px 0 rgba(255,255,255,.08);
}

.form-textarea {
  line-height: 1.45;
}

.location-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.location-btn {
  min-height: 54px;
  height: auto;
  padding: 10px 12px;
  white-space: normal;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.btn-primary {
  background:
    radial-gradient(circle at 30% 10%, rgba(255,255,255,.22), transparent 30%),
    linear-gradient(180deg, rgba(10,132,255,.98), rgba(0,102,255,.74));
  box-shadow: 0 16px 36px rgba(10,132,255,.24), var(--p2-shadow-control);
}

.btn-secondary {
  background: rgba(255,255,255,.09);
  border-color: var(--p2-hairline);
  box-shadow: var(--p2-shadow-control);
}

html[data-theme="light"] .btn-secondary { background: rgba(255,255,255,.72); }

.btn:disabled,
.btn.is-disabled {
  opacity: .55;
  filter: grayscale(.35);
  pointer-events: none;
}

.tabs {
  padding: 10px;
  border-bottom-color: var(--p2-hairline);
  background: rgba(255,255,255,.045);
}

.tab {
  border-radius: 16px;
  background: rgba(255,255,255,.065);
  border-color: var(--p2-hairline);
}

.tab.is-active {
  background:
    radial-gradient(circle at 30% 12%, rgba(255,255,255,.20), transparent 35%),
    linear-gradient(180deg, rgba(10,132,255,.98), rgba(10,132,255,.68));
  box-shadow: 0 14px 30px rgba(10,132,255,.20);
}

.media-uploader {
  position: relative;
  border-radius: 26px;
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(10,132,255,.105), rgba(255,255,255,.045));
  border: 1px solid rgba(10,132,255,.20);
  overflow: hidden;
}

.media-uploader::before {
  content: "";
  position: absolute;
  inset: auto -70px -90px auto;
  width: 190px;
  height: 190px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(10,132,255,.18), transparent 68%);
  pointer-events: none;
}

.media-head {
  position: relative;
  z-index: 1;
}

.media-count {
  background: rgba(10,132,255,.13);
  border-color: rgba(10,132,255,.23);
  color: var(--text);
}

.media-add {
  position: relative;
  z-index: 1;
  border-style: dashed;
  border-color: rgba(10,132,255,.32);
  min-height: 56px;
}

.media-card {
  min-height: 126px;
  border-radius: 22px;
  box-shadow: 0 16px 32px rgba(0,0,0,.24);
}

.media-card img,
.media-video-card {
  height: 126px;
}

.media-remove {
  box-shadow: 0 8px 18px rgba(0,0,0,.24);
}

.media-meta {
  font-size: 10.5px;
}

.bottom-nav {
  height: 72px;
  border-radius: 26px;
  padding: 7px;
  background: rgba(10,12,18,.58);
  border-color: var(--p2-hairline);
  box-shadow: 0 24px 60px rgba(0,0,0,.34), inset 0 1px 0 rgba(255,255,255,.08);
}

html[data-theme="light"] .bottom-nav { background: rgba(255,255,255,.82); }

.nav-item {
  border-radius: 20px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.nav-item.is-active {
  background:
    radial-gradient(circle at 30% 10%, rgba(255,255,255,.22), transparent 35%),
    linear-gradient(180deg, rgba(10,132,255,.94), rgba(10,132,255,.68));
  box-shadow: 0 14px 28px rgba(10,132,255,.24);
}

.nav-item i { font-size: 19px; }
.nav-item span { font-weight: 850; }

.modal-backdrop,
.loading-backdrop {
  background: rgba(0,0,0,.54);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-sheet {
  border-radius: 30px;
  background: rgba(18,20,30,.76);
  box-shadow: 0 28px 90px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.10);
}

html[data-theme="light"] .modal-sheet { background: rgba(255,255,255,.88); }

.modal-head,
.modal-actions { border-color: var(--p2-hairline); }
.modal-title { font-weight: 950; letter-spacing: -0.04em; }

.loading-card {
  border-radius: 26px;
  min-width: min(340px, calc(100vw - 32px));
}

.spinner {
  width: 26px;
  height: 26px;
}

.confirm-card,
.success-receipt {
  display: grid;
  gap: 12px;
}

.success-receipt {
  text-align: center;
  padding: 4px 0 2px;
}

.success-receipt__icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 4px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 30% 20%, rgba(255,255,255,.30), transparent 35%),
    linear-gradient(145deg, rgba(52,199,89,.96), rgba(10,132,255,.72));
  box-shadow: 0 18px 40px rgba(52,199,89,.20);
  font-size: 28px;
}

.success-receipt__title {
  font-size: 22px;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.success-receipt__text {
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.success-receipt__meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.success-receipt__meta div {
  border: 1px solid var(--p2-hairline);
  border-radius: 18px;
  background: rgba(255,255,255,.065);
  padding: 12px;
}

.success-receipt__meta strong,
.success-receipt__meta span { display: block; }
.success-receipt__meta strong { font-weight: 900; margin-bottom: 4px; }
.success-receipt__meta span { font-size: 12px; color: var(--muted); font-weight: 700; }

.wifi-card,
.admin-v2__card,
.contact-item,
.placeholder {
  border-radius: 22px;
  border-color: var(--p2-hairline);
  background: linear-gradient(180deg, rgba(255,255,255,.095), rgba(255,255,255,.045));
  box-shadow: var(--p2-shadow-control);
}

.contact-item {
  border-bottom: 0;
  margin-bottom: 12px;
}

.dp__cell {
  border-color: var(--p2-hairline);
  background: rgba(255,255,255,.075);
}

@media (max-width: 720px) {
  .main {
    padding-left: 14px;
    padding-right: 14px;
  }

  .home-hero__stats {
    grid-template-columns: 1fr;
  }

  .home-hero__stats div {
    min-height: auto;
  }

  .location-actions {
    grid-template-columns: 1fr;
  }

  .modal-sheet {
    width: calc(100% - 22px);
  }
}

@media (max-width: 520px) {
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .brand-mark,
  .icon-btn {
    width: 42px;
    height: 42px;
  }

  .brand-title {
    max-width: 58vw;
  }

  .section-title {
    font-size: clamp(22px, 8vw, 30px);
  }

  .action-btn {
    padding: 14px;
    border-radius: 22px;
  }

  .action-btn i:first-child {
    width: 42px;
    height: 42px;
  }

  .bottom-nav {
    width: min(560px, calc(100% - 18px));
    bottom: calc(env(safe-area-inset-bottom) + 8px);
  }

  .success-receipt__meta {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .glass-card,
  .action-btn,
  .media-card,
  .wifi-card,
  .admin-v2__card {
    will-change: transform;
  }

  .form-card,
  .glass-card {
    animation: p2CardIn .42s var(--ease) both;
  }

  @keyframes p2CardIn {
    from { opacity: 0; transform: translateY(10px) scale(.992); }
    to { opacity: 1; transform: translateY(0) scale(1); }
  }
}


/* P2.1 polish: updated hero copy, responsive nav and button fixes */
.home-hero__title {
  max-width: 14ch;
  font-size: clamp(30px, 7.2vw, 46px);
  line-height: 0.96;
}

.home-hero__text {
  max-width: 760px;
}

.home-hero__stats strong {
  font-size: 15px;
}

.home-hero__stats span {
  font-size: 11.5px;
  line-height: 1.35;
}

.location-btn {
  width: 100%;
  min-height: 56px;
  height: auto;
  padding: 12px 14px;
  text-align: center;
  justify-content: center;
  align-items: center;
  white-space: normal !important;
  word-break: break-word;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.18;
}

.location-btn span {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.18;
}

.bottom-nav {
  overflow-x: auto;
  overflow-y: hidden;
  justify-content: flex-start;
  gap: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.bottom-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  flex: 0 0 76px;
  min-width: 76px;
  scroll-snap-align: center;
}

.nav-item span {
  font-size: 10px;
}

@media (min-width: 900px) {
  .bottom-nav {
    width: min(860px, calc(100% - 32px));
    justify-content: center;
    overflow-x: visible;
  }

  .nav-item {
    flex: 1 1 0;
    min-width: 0;
  }

  .home-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-hero {
    padding: 28px 30px;
  }
}

@media (max-width: 640px) {
  .home-hero {
    padding: 20px 18px;
  }

  .home-hero__badge {
    margin-bottom: 14px;
  }

  .home-hero__stats {
    gap: 8px;
  }

  .bottom-nav {
    width: calc(100% - 14px);
    padding: 7px 8px;
  }

  .nav-item {
    flex-basis: 72px;
    min-width: 72px;
  }
}

@media (max-width: 420px) {
  .home-hero__title {
    font-size: clamp(28px, 9vw, 36px);
  }

  .action-title {
    font-size: 14px;
  }

  .location-btn {
    font-size: 13px;
    padding-left: 12px;
    padding-right: 12px;
  }
}
