@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Montserrat:wght@400;500;600&display=swap');

:root {
  --pink-50: #fff8fb;
  --pink-100: #fdeef4;
  --pink-200: #f8d9e6;
  --pink-300: #efb9cf;
  --pink-500: #d873a1;
  --pink-600: #bd5c89;
  --rose-dark: #7a3957;
  --gold: #c79a55;
  --text: #4d3340;
  --white: #ffffff;
  --shadow: 0 20px 60px rgba(145, 66, 103, 0.18);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: 'Montserrat', sans-serif;
  color: var(--text);
  background:
    radial-gradient(
      circle at top left,
      rgba(255, 255, 255, 0.95),
      transparent 35%
    ),
    linear-gradient(
      160deg,
      #fff9fc 0%,
      #fbe8f1 45%,
      #f7d7e5 100%
    );
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

/* ==================================================
   PANTALLA PRINCIPAL
   ================================================== */

.page {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  display: grid;
  place-items: center;
  padding:
    clamp(8px, 2vh, 22px)
    14px;
  overflow: hidden;
}

.event-card {
  position: relative;
  width: min(100%, 520px);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  border-radius: 32px;
  padding:
    clamp(15px, 3vh, 34px)
    22px
    clamp(14px, 2.5vh, 28px);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.event-card::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 25px;
  border: 1px solid rgba(199, 154, 85, 0.28);
  pointer-events: none;
}

.hero,
.finder,
.result-card {
  position: relative;
  z-index: 2;
}

.hero {
  min-height: 0;
  text-align: center;
}

/* ==================================================
   LOGO Y FOTO
   ================================================== */

.event-logo {
  display: block;
  width: clamp(40px, 7.5vh, 82px);
  height: clamp(40px, 7.5vh, 82px);
  object-fit: contain;
  margin:
    0 auto
    clamp(4px, 1.2vh, 12px);
  filter: drop-shadow(
    0 8px 18px rgba(122, 57, 87, 0.18)
  );
}

.portrait-frame {
  width: clamp(90px, 19vh, 185px);
  height: clamp(90px, 19vh, 185px);
  flex-shrink: 0;
  margin:
    0 auto
    clamp(5px, 1.7vh, 18px);
  padding: clamp(4px, 0.8vh, 7px);
  border-radius: 50%;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(
      135deg,
      var(--gold),
      var(--pink-300),
      var(--gold)
    ) border-box;
  border: 3px solid transparent;
  box-shadow: 0 14px 34px rgba(122, 57, 87, 0.2);
  animation: portraitIn 0.9s ease both;
}

.portrait {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center top;
  border-radius: 50%;
}

/* ==================================================
   TÍTULOS
   ================================================== */

.small-title {
  margin:
    0 0
    clamp(2px, 0.5vh, 4px);
  color: var(--pink-600);
  font-size: clamp(0.62rem, 1.35vh, 0.82rem);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2 {
  font-family: 'Cormorant Garamond', serif;
}

h1 {
  margin: 0;
  color: var(--rose-dark);
  font-size: clamp(1.75rem, 5.7vh, 3.4rem);
  line-height: 0.95;
  font-weight: 700;
}

.subtitle {
  max-width: 390px;
  margin:
    clamp(5px, 1.4vh, 14px)
    auto
    0;
  color: #765766;
  font-size: clamp(0.72rem, 1.55vh, 0.95rem);
  line-height: 1.4;
}

/* ==================================================
   BUSCADOR
   ================================================== */

.finder {
  flex-shrink: 0;
  margin-top: clamp(8px, 2.4vh, 26px);
  padding:
    clamp(10px, 2.2vh, 22px)
    clamp(12px, 3vw, 18px);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(216, 115, 161, 0.18);
  box-shadow: 0 12px 30px rgba(122, 57, 87, 0.08);
}

.finder h2 {
  margin:
    0 0
    clamp(7px, 1.6vh, 16px);
  text-align: center;
  color: var(--rose-dark);
  font-size: clamp(1.35rem, 3.8vh, 2rem);
  line-height: 1;
}

.search-wrap {
  position: relative;
}

.input-container {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  color: var(--pink-500);
  font-size: clamp(1.1rem, 2.5vh, 1.35rem);
  pointer-events: none;
}

#guest-search {
  width: 100%;
  min-height: clamp(42px, 6.5vh, 56px);
  padding: 0 50px 0 48px;
  border: 1px solid var(--pink-200);
  border-radius: 18px;
  outline: none;
  color: var(--text);
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;

  appearance: none;
  -webkit-appearance: none;
}

/* Elimina la X automática de Chrome, Safari y celulares */
#guest-search::-webkit-search-cancel-button,
#guest-search::-webkit-search-decoration,
#guest-search::-webkit-search-results-button,
#guest-search::-webkit-search-results-decoration {
  display: none;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

/* Elimina la X automática de versiones antiguas de Edge */
#guest-search::-ms-clear,
#guest-search::-ms-reveal {
  display: none;
  width: 0;
  height: 0;
}

#guest-search::placeholder {
  color: #aa8d9a;
}

#guest-search:focus {
  border-color: var(--pink-500);
  box-shadow:
    0 0 0 4px rgba(216, 115, 161, 0.13);
  transform: translateY(-1px);
}

/* X personalizada */
.clear-button {
  position: absolute;
  right: 10px;
  top: 50%;
  z-index: 3;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--rose-dark);
  background: var(--pink-100);
  opacity: 0;
  pointer-events: none;
  transform:
    translateY(-50%)
    scale(0.8);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease;
}

.clear-button.visible {
  opacity: 1;
  pointer-events: auto;
  transform:
    translateY(-50%)
    scale(1);
}

.clear-button:hover {
  background: var(--pink-200);
}

/* ==================================================
   SUGERENCIAS
   ================================================== */

.suggestions {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  max-height: min(290px, 32dvh);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--pink-200);
  box-shadow: 0 18px 40px rgba(122, 57, 87, 0.18);
  scrollbar-width: thin;
  scrollbar-color:
    var(--pink-300)
    transparent;
}

.suggestions.open {
  display: block;
  animation: dropdownIn 0.2s ease both;
}

.suggestions::-webkit-scrollbar {
  width: 6px;
}

.suggestions::-webkit-scrollbar-track {
  background: transparent;
}

.suggestions::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--pink-300);
}

.suggestion {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border: 0;
  border-bottom: 1px solid #f4e4eb;
  text-align: left;
  color: var(--text);
  background: transparent;
  transition: background 0.15s ease;
}

.suggestion:last-child {
  border-bottom: 0;
}

.suggestion:hover,
.suggestion.active {
  background: var(--pink-50);
}

.suggestion-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 600;
}

.suggestion-hint {
  flex-shrink: 0;
  color: var(--pink-600);
  font-size: 0.78rem;
  font-weight: 600;
}

.search-message {
  min-height: clamp(16px, 2.5vh, 22px);
  margin:
    clamp(4px, 1vh, 10px)
    4px
    0;
  color: #826571;
  font-size: clamp(0.7rem, 1.45vh, 0.82rem);
  line-height: 1.35;
}

/* ==================================================
   RESULTADO
   Aparece sobre el contenido para no crear scroll
   ================================================== */

.result-card {
  position: absolute;
  inset: clamp(10px, 2vh, 18px);
  z-index: 100;
  margin: 0;
  padding:
    clamp(16px, 3vh, 26px)
    clamp(14px, 4vw, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  border-radius: 25px;
  color: var(--text);
  background:
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.99),
      rgba(253, 238, 244, 0.99)
    );
  border: 1px solid var(--pink-200);
  box-shadow:
    0 16px 36px rgba(122, 57, 87, 0.18);
  animation: resultOverlayIn 0.35s ease both;
}

.result-card[hidden] {
  display: none !important;
}

.result-icon {
  margin-bottom: clamp(3px, 1vh, 6px);
  color: var(--gold);
  font-size: clamp(1.4rem, 3.5vh, 1.8rem);
}

.result-welcome {
  margin: 0;
  color: var(--pink-600);
  font-size: clamp(0.68rem, 1.5vh, 0.8rem);
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

#result-name {
  max-width: 100%;
  margin:
    clamp(5px, 1vh, 7px)
    0
    clamp(7px, 1.5vh, 10px);
  overflow-wrap: anywhere;
  color: var(--rose-dark);
  font-size: clamp(1.6rem, 5.5vh, 2.8rem);
  line-height: 1;
}

.result-label {
  margin:
    0 0
    clamp(7px, 1.5vh, 10px);
  color: #7d6270;
  font-size: clamp(0.76rem, 1.7vh, 1rem);
}

.table-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(160px, 90%);
  min-height: clamp(55px, 9vh, 72px);
  max-width: 100%;
  padding:
    clamp(9px, 1.7vh, 12px)
    clamp(16px, 4vw, 22px);
  overflow-wrap: anywhere;
  border-radius: 20px;
  color: white;
  background:
    linear-gradient(
      135deg,
      var(--pink-500),
      var(--pink-600)
    );
  box-shadow:
    0 12px 28px rgba(189, 92, 137, 0.28);
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.65rem, 6vh, 3rem);
  font-weight: 700;
  line-height: 1;
}

.result-note {
  margin:
    clamp(8px, 1.7vh, 16px)
    0
    clamp(9px, 2vh, 18px);
  color: #775b69;
  font-size: clamp(0.72rem, 1.6vh, 0.9rem);
}

.secondary-button {
  min-height: clamp(40px, 6vh, 46px);
  padding: 0 18px;
  border: 1px solid var(--pink-300);
  border-radius: 14px;
  color: var(--rose-dark);
  background: white;
  font-weight: 600;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.secondary-button:hover {
  transform: translateY(-1px);
  background: var(--pink-50);
}

/* ==================================================
   DECORACIONES
   ================================================== */

.decoration {
  position: absolute;
  z-index: 1;
  width: clamp(80px, 17vh, 145px);
  height: auto;
  pointer-events: none;
  opacity: 0.9;
}

.decoration-top {
  top: -16px;
  left: -24px;
}

.decoration-bottom {
  right: -25px;
  bottom: -20px;
  transform: rotate(180deg);
}

/* ==================================================
   ACCESIBILIDAD
   ================================================== */

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ==================================================
   ANIMACIONES
   ================================================== */

@keyframes portraitIn {
  from {
    opacity: 0;
    transform:
      translateY(16px)
      scale(0.94);
  }

  to {
    opacity: 1;
    transform:
      translateY(0)
      scale(1);
  }
}

@keyframes dropdownIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes resultOverlayIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==================================================
   TELÉFONOS
   ================================================== */

@media (max-width: 480px) {
  .page {
    padding: 0;
    place-items: stretch;
  }

  .event-card {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding:
      max(14px, env(safe-area-inset-top))
      16px
      max(14px, env(safe-area-inset-bottom));
  }

  .event-card::before {
    inset: 8px;
    border-radius: 0;
  }

  .finder {
    border-radius: 20px;
  }

  .result-card {
    inset:
      max(10px, env(safe-area-inset-top))
      10px
      max(10px, env(safe-area-inset-bottom));
  }

  .decoration-top {
    left: -22px;
  }

  .decoration-bottom {
    right: -22px;
  }
}

/* ==================================================
   PANTALLAS DE POCA ALTURA
   ================================================== */

@media (max-height: 700px) {
  .event-card {
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .finder {
    border-radius: 20px;
  }

  .suggestion {
    padding-top: 11px;
    padding-bottom: 11px;
  }
}

@media (max-height: 560px) {
  .event-logo {
    display: none;
  }

  .subtitle {
    display: none;
  }

  .portrait-frame {
    width: clamp(78px, 18vh, 100px);
    height: clamp(78px, 18vh, 100px);
    margin-bottom: 4px;
  }

  .finder {
    margin-top: 6px;
    padding: 9px 12px;
  }

  .finder h2 {
    margin-bottom: 6px;
  }

  .search-message {
    min-height: 14px;
    margin-top: 3px;
  }

  .suggestions {
    max-height: 30dvh;
  }
}

@media (max-height: 460px) {
  .event-card {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .portrait-frame {
    width: 64px;
    height: 64px;
    padding: 3px;
    border-width: 2px;
  }

  .small-title {
    display: none;
  }

  h1 {
    font-size: 1.45rem;
  }

  .finder {
    margin-top: 4px;
    padding: 7px 10px;
  }

  .finder h2 {
    margin-bottom: 4px;
    font-size: 1.15rem;
  }

  #guest-search {
    min-height: 38px;
  }

  .search-message {
    min-height: 0;
    margin-top: 2px;
    font-size: 0.65rem;
  }
}