/* ── Reset & Variables ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green:       #62AFBA;
  --green-light: #DFF3F6;
  --green-mid:   #4A9BAA;
  --green-dark:  #3A7A88;
  --navy:        #07284C;
  --sand:        #F7F3EE;
  --sand-mid:    #EDE8E1;
  --sand-dark:   #C8BFB3;
  --text:        #191919;
  --text-muted:  #3D4248;
  --text-light:  #6B6560;
  --white:       #FFFFFF;
  --border:      rgba(0,0,0,0.10);
  --border-mid:  rgba(0,0,0,0.15);
  --radius:      12px;
  --radius-sm:   8px;
  --safe-top:    var(--native-safe-top, env(safe-area-inset-top, 0px));
  --safe-bottom: var(--native-safe-bottom, env(safe-area-inset-bottom, 0px));
  --topbar-h:    56px;
}

html { height: 100%; touch-action: pan-x pan-y; }

body {
  font-family: 'Raleway', sans-serif;
  font-size: 18px;
  line-height: 1.65;
  color: var(--text);
  background: var(--sand);
  min-height: 100%;
  font-variant-numeric: lining-nums;
}

h1, h2, h3, .serif { font-family: 'Raleway', sans-serif; }

/* ── Screens ─────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ── Login ───────────────────────────────────────────────────────────── */
body.login-active { overflow: hidden; }

#screen-login {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh; /* Safari iOS: excludes address bar so flex-centering works */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--sand);
  overflow-y: auto;
}

.login-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
}

.brand { text-align: center; margin-bottom: 2rem; }

.brand-logo {
  width: 64px; height: 64px;
  background: var(--navy);
  border-radius: 16px;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
}

.brand-name {
  font-family: 'Raleway', sans-serif;
  font-size: 26px; font-weight: 600; letter-spacing: 0.04em;
}

.brand-sub {
  font-size: 14px; color: var(--text-light);
  letter-spacing: 0.14em; text-transform: uppercase; margin-top: 3px;
}

.field { margin-bottom: 1rem; }

.field label {
  display: block; font-size: 14px; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 6px;
}

.field input {
  width: 100%; height: 44px; padding: 0 14px;
  font-family: 'Raleway', sans-serif; font-size: 18px;
  background: var(--sand); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); color: var(--text); outline: none;
}

.field input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(98,175,186,0.18);
  background: var(--white);
}

.btn-primary {
  width: 100%; height: 46px;
  background: var(--green); color: #fff; border: none;
  border-radius: var(--radius-sm);
  font-family: 'Raleway', sans-serif; font-size: 18px; font-weight: 600;
  cursor: pointer; margin-top: 0.5rem;
}

.btn-primary:active { opacity: 0.85; }

.error-banner {
  margin-top: 1rem; padding: 12px 14px;
  background: #FFF0EE; color: #8B2A2A;
  border: 1px solid #F5B8B8; border-radius: var(--radius-sm);
  font-size: 16px; display: none;
  white-space: pre-wrap; word-break: break-word; line-height: 1.55;
}

.login-hint {
  font-size: 14px; color: var(--text-light);
  text-align: center; margin-top: 1.25rem; line-height: 1.5;
}

.login-hint a { color: var(--green); }

/* ── App shell ───────────────────────────────────────────────────────── */
#screen-app {
  min-height: 100vh;
  padding-top: calc(var(--safe-top) + var(--topbar-h) + 44px);
  padding-bottom: calc(var(--safe-bottom) + 2rem);
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: var(--safe-top) 1.25rem 0;
  height: calc(var(--topbar-h) + var(--safe-top));
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  box-sizing: border-box;
}

.topbar-brand {
  font-family: 'Raleway', sans-serif;
  font-size: 20px; letter-spacing: 0.04em; font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  min-width: 0;
}

.topbar-logo {
  width: 34px; height: 34px; flex-shrink: 0;
  background: var(--navy);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}

.topbar-brand-text {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.btn-signout {
  font-size: 14px; color: var(--text-muted);
  background: none; border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 5px 13px;
  cursor: pointer; font-family: 'Raleway', sans-serif;
  flex-shrink: 0; white-space: nowrap;
}

/* ── In-app notification toast ──────────────────────────────────────── */
#notif-toast {
  position: fixed; top: calc(var(--safe-top) + var(--topbar-h) + 52px);
  left: 1rem; right: 1rem; z-index: 999;
  background: var(--navy); color: #fff;
  border-radius: 12px; padding: 0.9rem 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  display: flex; gap: 0.75rem; align-items: flex-start;
  transform: translateY(-120%); opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
#notif-toast.show {
  transform: translateY(0); opacity: 1; pointer-events: auto;
}
#notif-toast-body { flex: 1; min-width: 0; }
#notif-toast-title { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
#notif-toast-msg   { font-size: 14px; opacity: 0.88; line-height: 1.4; }
#notif-toast-close {
  background: none; border: none; color: #fff; opacity: 0.7;
  font-size: 20px; line-height: 1; cursor: pointer; padding: 0; flex-shrink: 0;
}

/* ── Nav tabs ────────────────────────────────────────────────────────── */
.nav-outer {
  position: fixed;
  top: calc(var(--safe-top) + var(--topbar-h));
  left: 0; right: 0; z-index: 99;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: stretch;
}

.nav-scroll-btn {
  flex-shrink: 0; width: 36px; border: none; background: var(--white);
  color: var(--text-muted); cursor: pointer; font-size: 18px;
  display: none; align-items: center; justify-content: center;
  padding: 0;
}
.nav-scroll-btn.visible { display: flex; }
.nav-scroll-btn:first-child { border-right: 1px solid var(--border); }
.nav-scroll-btn:last-child  { border-left:  1px solid var(--border); }

.nav-tabs {
  display: flex; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

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

.nav-tab {
  flex: none; padding: 12px 16px;
  font-size: 16px; font-weight: 600; color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  white-space: nowrap; background: none;
  border-left: none; border-right: none; border-top: none;
  font-family: 'Raleway', sans-serif; letter-spacing: 0.02em;
}

.nav-tab.active { color: var(--green); border-bottom-color: var(--green); }

@media (max-width: 400px) {
  .topbar-brand-text { font-size: 18px; }
  .btn-signout { padding: 5px 9px; font-size: 13px; }
  .nav-tab { padding: 11px 12px; font-size: 15px; }
}

/* ── Content pane ────────────────────────────────────────────────────── */
.content { max-width: 700px; margin: 0 auto; padding: 1.5rem 1.25rem; }

.section { display: none; }
.section.active { display: block; }

/* ── Content loading skeleton ────────────────────────────────────────── */
.section-loading {
  display: flex; flex-direction: column; gap: 12px; padding: 1rem 0;
}

.skel {
  background: linear-gradient(90deg, var(--sand-mid) 25%, var(--sand-dark) 50%, var(--sand-mid) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

.skel-card  { height: 120px; border-radius: var(--radius); }
.skel-line  { height: 16px; }
.skel-short { height: 16px; width: 60%; }

@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── Loading overlay ─────────────────────────────────────────────────── */
#loading-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(247,243,238,0.88); z-index: 999;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 1rem;
}

#loading-overlay.show { display: flex; }

.spinner {
  width: 32px; height: 32px;
  border: 2.5px solid var(--sand-dark);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-label { font-size: 17px; color: var(--text-muted); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Shared content styles (used by server-rendered sections) ────────── */
.card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}

.card-title {
  font-family: 'Raleway', sans-serif;
  font-size: 22px; font-weight: 600; margin-bottom: 1rem;
}

.section-label {
  font-size: 14px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-light); margin-bottom: 8px;
}

.welcome-heading {
  font-family: 'Raleway', sans-serif;
  font-size: 36px; font-weight: 600; line-height: 1.2; margin-bottom: 4px;
}

.welcome-heading em { font-style: italic; color: var(--green); }

.welcome-meta {
  font-size: 16px; color: var(--text-muted); margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.status-badge {
  font-size: 14px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 99px;
}

.badge-confirmed { background: #DFF3F6; color: #2C7A86; }
.badge-pending   { background: #FEF4E0; color: #7A4B0A; }
.badge-cancelled { background: #FDEAEA; color: #7A1F1F; }

.apt-banner {
  background: var(--navy); color: var(--white);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center;
}

.apt-banner-label { font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.65; margin-bottom: 4px; }
.apt-banner-name  { font-family: 'Raleway', sans-serif; font-size: 26px; font-weight: 600; letter-spacing: 0.03em; }

.date-strip {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 12px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}

.date-label { font-size: 14px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 3px; }
.date-value { font-family: 'Raleway', sans-serif; font-size: 22px; font-weight: 600; }
.date-day   { font-size: 14px; color: var(--text-muted); margin-top: 1px; }
.date-right { text-align: right; }

.nights-pill {
  text-align: center; background: var(--green-light); color: var(--navy);
  border-radius: var(--radius-sm); padding: 7px 14px;
  font-size: 16px; font-weight: 600; white-space: nowrap;
}

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1rem; }

.detail-item { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.detail-item-label { font-size: 14px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 3px; }
.detail-item-value { font-size: 19px; font-weight: 600; }
.detail-item-sub   { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

.guest-row { display: flex; align-items: center; gap: 14px; }

.guest-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--green-light); color: var(--navy);
  font-family: 'Raleway', sans-serif; font-size: 22px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.guest-name { font-size: 19px; font-weight: 600; }
.guest-meta { font-size: 16px; color: var(--text-muted); margin-top: 2px; }

.security-banner {
  background: var(--navy); color: #fff;
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}

.security-banner-label { font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.7; margin-bottom: 6px; }
.security-banner-code  { font-family: 'Raleway', sans-serif; font-size: 38px; font-weight: 600; letter-spacing: 0.12em; }
.security-banner-sub   { font-size: 14px; opacity: 0.75; margin-top: 6px; }

.time-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 1.25rem; }

.time-card {
  flex: 1; min-width: 120px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem 1.25rem; text-align: center;
}

.time-card-label { font-size: 14px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 6px; }
.time-card-time  { font-family: 'Raleway', sans-serif; font-size: 30px; font-weight: 600; color: var(--green); }
.time-card-sub   { font-size: 14px; color: var(--text-muted); margin-top: 2px; }

.steps { list-style: none; }

.step { display: flex; gap: 14px; margin-bottom: 1.25rem; }

.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green); color: var(--white);
  font-size: 16px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}

.step-body { flex: 1; }
.step-title { font-weight: 600; font-size: 17px; margin-bottom: 3px; }
.step-desc  { font-size: 16px; color: var(--text-muted); line-height: 1.6; }

.wifi-card {
  background: var(--sand); border: 1px dashed var(--sand-dark);
  border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1rem;
}

.wifi-network  { font-size: 17px; color: var(--text-muted); margin-bottom: 3px; }
.wifi-password { font-size: 24px; font-family: 'Raleway', sans-serif; font-weight: 600; letter-spacing: 0.05em; color: var(--text); }

.wifi-copy {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: 10px; font-size: 14px; color: var(--green);
  cursor: pointer; background: none; border: 1px solid var(--green);
  border-radius: var(--radius-sm); padding: 4px 12px;
  font-family: 'Raleway', sans-serif;
}

.rules-list { list-style: none; }

.rule-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 17px;
}

.rule-item:last-child { border-bottom: none; }

.rule-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 19px;
}

.rule-icon.allowed { background: #EAF3DE; }
.rule-icon.no      { background: #FDEAEA; }
.rule-icon.caution { background: #FEF4E0; }
.rule-icon.info    { background: var(--green-light); }

.rule-body  { flex: 1; }
.rule-title { font-weight: 600; margin-bottom: 2px; }
.rule-desc  { font-size: 16px; color: var(--text-muted); }

.places-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 1.25rem; }

.place-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; }
.place-emoji { font-size: 24px; margin-bottom: 6px; }
.place-name  { font-weight: 600; font-size: 17px; }
.place-desc  { font-size: 16px; color: var(--text-muted); margin-top: 2px; line-height: 1.5; }

.map-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; color: var(--green); text-decoration: none; font-weight: 600; }
.map-btn:hover { text-decoration: underline; }

.checklist { list-style: none; }

.checklist-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); font-size: 17px; }
.checklist-item:last-child { border-bottom: none; }

.check-circle {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1.5px solid var(--sand-dark); flex-shrink: 0;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}

.check-circle.checked { background: var(--green); border-color: var(--green); }

.check-circle.checked::after {
  content: ''; width: 10px; height: 6px;
  border-left: 2px solid white; border-bottom: 2px solid white;
  transform: rotate(-45deg) translateY(-1px);
}

.checklist-text { flex: 1; }
.checklist-text.done { color: var(--text-light); }

.contact-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  margin-bottom: 0.75rem; text-decoration: none; color: inherit;
}

.contact-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--green-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 22px; }
.contact-label { font-size: 14px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 600; margin-bottom: 3px; }
.contact-value { font-size: 18px; font-weight: 600; }
.contact-arrow { margin-left: auto; color: var(--text-light); font-size: 20px; }

@media (max-width: 480px) {
  .detail-grid { grid-template-columns: 1fr; }
  .places-grid { grid-template-columns: 1fr; }
  .welcome-heading { font-size: 30px; }
  .login-card { padding: 2rem 1.25rem; }
}

/* ── Splash screen ───────────────────────────────────────────────────────── */
#splash-screen {
  position: fixed; inset: 0; z-index: 2000;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
}

#splash-screen.out { animation: splashScreenOut 0.45s ease-in forwards; }

#splash-logo-wrap {
  display: flex; flex-direction: column; align-items: center;
}

#splash-logo {
  filter: brightness(0) invert(1);
  opacity: 0; transform: translateY(14px);
  animation: splashRise 0.65s cubic-bezier(0.22,1,0.36,1) 0.2s forwards;
}

#splash-tagline {
  font-family: 'Raleway', sans-serif;
  font-size: 12px; letter-spacing: 0.20em; text-transform: uppercase;
  color: rgba(255,255,255,0.45); margin-top: 12px;
  opacity: 0;
  animation: splashFadeIn 0.45s ease 0.7s forwards;
}

#splash-dots {
  display: flex; gap: 7px; margin-top: 52px;
  opacity: 0;
  animation: splashFadeIn 0.35s ease 1.05s forwards;
}

#splash-dots span {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(255,255,255,0.28);
  animation: splashDotPulse 1.3s ease-in-out 1.05s infinite;
}
#splash-dots span:nth-child(2) { animation-delay: 1.25s; }
#splash-dots span:nth-child(3) { animation-delay: 1.45s; }

@keyframes splashRise    { to { opacity: 1; transform: translateY(0); } }
@keyframes splashFadeIn  { to { opacity: 1; } }
@keyframes splashScreenOut { to { opacity: 0; } }
@keyframes splashDotPulse {
  0%, 100% { background: rgba(255,255,255,0.28); transform: scale(1); }
  50%       { background: rgba(98,175,186,0.85);  transform: scale(1.3); }
}

/* ── App download banner ─────────────────────────────────────────────────── */
#app-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  min-height: 60px; background: var(--navy); color: #fff;
  display: flex; align-items: center; padding: 0.5rem 0.75rem; gap: 0.6rem;
}

.app-banner-icon {
  width: 40px; height: 40px; border-radius: 9px; flex-shrink: 0;
}

.app-banner-text { flex: 1; min-width: 0; overflow: hidden; }
.app-banner-name { font-size: 15px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.app-banner-sub  { font-size: 12px; opacity: 0.72; margin-top: 2px; line-height: 1.3; }

.app-banner-links { display: flex; gap: 0.4rem; flex-shrink: 0; }

.app-banner-links a {
  background: var(--green); color: #fff; border-radius: 20px;
  padding: 5px 11px; font-size: 12px; font-weight: 700;
  white-space: nowrap; text-decoration: none;
  font-family: 'Raleway', sans-serif; display: block;
}

.app-banner-close {
  background: none; border: none; color: rgba(255,255,255,0.55);
  font-size: 24px; line-height: 1; cursor: pointer; padding: 4px 2px 4px 6px;
  flex-shrink: 0; font-family: sans-serif;
}

/* Shift layout down when banner is visible */
body.has-app-banner .topbar   { top: var(--app-banner-h, 60px); }
body.has-app-banner .nav-outer { top: calc(var(--app-banner-h, 60px) + var(--safe-top) + var(--topbar-h)); }
body.has-app-banner #screen-app { padding-top: calc(var(--app-banner-h, 60px) + var(--safe-top) + var(--topbar-h) + 44px); }
body.has-app-banner #screen-login { padding-top: calc(var(--app-banner-h, 60px) + 1rem); }
body.has-app-banner #notif-toast  { top: calc(var(--app-banner-h, 60px) + var(--safe-top) + var(--topbar-h) + 52px); }

/* ── Language toggle ─────────────────────────────────────────────────────── */
.lang-toggle {
  display: flex; align-items: center;
  background: var(--sand); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 2px; gap: 1px;
  flex-shrink: 0;
}

.lang-btn {
  padding: 3px 9px; font-size: 13px; font-weight: 700; letter-spacing: 0.07em;
  border: none; background: transparent; cursor: pointer; border-radius: 5px;
  color: var(--text-light); font-family: 'Raleway', sans-serif;
  transition: background 0.15s, color 0.15s;
}

.lang-btn.active {
  background: var(--white); color: var(--navy);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.login-lang-toggle {
  margin: 0 auto 1.5rem; width: fit-content;
  background: var(--sand); border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm); padding: 3px; gap: 2px;
}

.login-lang-btn {
  padding: 6px 18px; font-size: 14px;
}
