/* Shared design system for DonjanTracking — mobile-first, app-like PWA */

body {
  font-family: 'Sarabun', sans-serif;
  background-color: #f0fdf4;
  overflow-x: hidden;
}

/* prevent long unbroken Thai text from forcing flex children to overflow the viewport */
.app-hero * {
  min-width: 0;
  overflow-wrap: break-word;
}

/* Senior-friendly tap targets, kept from the previous design */
button, a {
  min-height: 44px;
}

/* ---------- Gradient hero header ---------- */
.app-hero {
  background: linear-gradient(135deg, #15803d 0%, #16a34a 45%, #4ade80 100%);
  border-radius: 0 0 1.75rem 1.75rem;
  color: #fff;
  padding-top: max(1.25rem, env(safe-area-inset-top));
}

/* ---------- Hero banner image (landing page) ---------- */
.hero-banner {
  transition: transform 0.3s ease;
}
@media (min-width: 768px) {
  .hero-banner:hover {
    transform: scale(1.01);
  }
}

/* ---------- Cards ---------- */
.app-card {
  background: #fff;
  border-radius: 1.25rem;
  border: 1px solid #dcfce7;
  box-shadow: 0 2px 10px -4px rgba(21, 128, 61, 0.12);
}

/* ---------- Bottom navigation bar ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  background: #fff;
  border-radius: 1.75rem 1.75rem 0 0;
  box-shadow: 0 -8px 24px -12px rgba(21, 128, 61, 0.25);
  padding: 0.4rem 0.4rem max(0.4rem, env(safe-area-inset-bottom));
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.4rem 0.2rem;
  border-radius: 1rem;
  color: #6b7280;
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.bottom-nav-item .bn-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.bottom-nav-item.active {
  color: #15803d;
  background: #f0fdf4;
}

/* elevated center button inside .bottom-nav, same style as the guest bottom nav's home button */
.bottom-nav-elevated {
  flex: 0 0 auto;
  align-self: center;
  position: relative;
  top: -1.4rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  border: 4px solid #fff;
  box-shadow: 0 12px 24px -8px rgba(21, 128, 61, 0.55);
  text-decoration: none;
  margin: 0 0.25rem;
}

/* ---------- Floating action button ---------- */
.fab {
  position: fixed;
  right: 1rem;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  z-index: 45;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 30px -12px rgba(21, 128, 61, 0.55);
  border: none;
}

/* ---------- Bottom sheet (mobile) / centered modal (desktop) ---------- */
.app-sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.app-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.app-sheet-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 1.75rem 1.75rem 0 0;
  padding: 1.25rem 1.25rem max(1.25rem, env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.app-sheet.is-open .app-sheet-panel {
  transform: translateY(0);
}

.app-sheet-handle {
  width: 3rem;
  height: 0.3rem;
  border-radius: 9999px;
  background: #d1d5db;
  margin: 0 auto 0.75rem;
}

@media (min-width: 768px) {
  .app-sheet-panel {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: min(560px, 92vw);
    max-height: 85vh;
    border-radius: 1.25rem;
    transform: translate(-50%, -46%);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .app-sheet.is-open .app-sheet-panel {
    transform: translate(-50%, -50%);
    opacity: 1;
  }
}

/* page bottom padding so content clears the fixed bottom nav */
.pb-app-nav {
  padding-bottom: calc(6rem + env(safe-area-inset-bottom));
}

/* ---------- Guest bottom nav (public landing) with elevated center button ---------- */
.guest-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border-radius: 1.75rem 1.75rem 0 0;
  box-shadow: 0 -8px 24px -12px rgba(21, 128, 61, 0.25);
  padding: 0.6rem 1.75rem max(0.6rem, env(safe-area-inset-bottom));
}

.guest-bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  color: #6b7280;
  font-size: 0.72rem;
  font-weight: 600;
  text-decoration: none;
}

.guest-bottom-nav-item .icon {
  font-size: 1.25rem;
  line-height: 1;
}

.guest-bottom-nav-item.active {
  color: #15803d;
}

.guest-bottom-nav-home {
  position: relative;
  top: -1.6rem;
  flex: 0 0 auto;
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #16a34a, #22c55e);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 4px solid #fff;
  box-shadow: 0 12px 24px -8px rgba(21, 128, 61, 0.55);
  text-decoration: none;
}
