/* base.css — foundation: CSS variables, reset, navbar, main layout,
   buttons, dog cards, empty state, and the auth page.
   NOTE: styles load in order base.css -> sections.css -> components.css
   (see index.html); keep that order so the cascade is preserved. */

/* =====================
   CSS Variables & Reset
   ===================== */
:root {
  --bg: #f0ede8;
  --surface: #ffffff;
  --text-primary: #1c2b1a;
  --text-secondary: #6b7a68;
  --accent: #143C52;
  --accent-hover: #1E4E6E;
  --accent-light: #FFFFFF;
  --border: #e0dbd3;
  --avatar-bg: #FFFFFF;
  --field-bg: #f7f5f1;
  --avatar-text: #143C52;
  --shadow: 0 2px 12px rgba(30, 50, 28, 0.08);
  --radius-card: 18px;
  --radius-btn: 50px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* The window itself never scrolls — each .page is its own scroll container
   (see .page below). This sidesteps every iOS Safari window-scroll behavior
   that fought page switches: toolbar-resize scroll compensation, momentum
   carry-over, scroll restoration, rubber-banding. Starting a page at the
   top is then a plain el.scrollTop = 0 in showPage(). */
html { height: 100%; overflow-anchor: none; }

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  overflow-anchor: none;
}

/* =====================
   Navbar
   ===================== */
.navbar {
  background: #143C52;
  border-bottom: none;
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 20px;   /* fixed side padding — never changes with window width */
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: none;
  margin: 0;
  padding: 0;
  height: clamp(60px, 50px + 4vw, 96px);
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-back-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}
.nav-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  transition: color 0.15s;
}
.nav-back:hover { color: rgba(255,255,255,0.8); }
.nav-back-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.3);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  font-family: 'Poppins', var(--font-display), sans-serif;
  font-size: clamp(1.5rem, 0.9rem + 2.6vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.logo-icon { font-size: 1.4rem; line-height: 1; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 50px;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  color: rgba(255,255,255,0.9);
  transition: all 0.2s ease;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}
.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,0.16);
  color: #fff;
}

/* Guest auth buttons (Log in / Sign up): a matched pill pair — same size and
   shape, one outlined and one filled. */
.nav-auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: clamp(6px, 3.4px + 0.425vw, 7.65px) clamp(11px, 6px + 0.85vw, 17px);
  border-radius: 50px;
  font-size: clamp(0.72rem, 0.6rem + 0.425vw, 0.935rem);
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  line-height: 1.2;
  border: 1px solid rgba(255,255,255,0.75);
  transition: all 0.2s ease;
}
.nav-auth-btn.ghost { background: transparent; color: #fff; }
.nav-auth-btn.ghost:hover { background: rgba(255,255,255,0.15); }
.nav-auth-btn.solid { background: #fff; color: #143C52; border-color: #fff; }
.nav-auth-btn.solid:hover { background: #EEF1F5; border-color: #EEF1F5; }

/* Guest nav collapse: below the landing hero's image-overlay breakpoint (980px)
   the three guest pills are replaced by a white hamburger + dropdown. */
.nav-guest-inline { display: flex; align-items: center; gap: 10px; }
.nav-guest-menu { display: none; position: relative; }

.nav-hamburger {
  width: 44px; height: 44px; padding: 0;
  border: none; background: transparent; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  cursor: pointer; transition: background 0.18s ease;
}
.nav-hamburger:hover { background: rgba(255,255,255,0.15); }
.nav-hamburger span { display: block; width: 24px; height: 2.5px; background: #fff; border-radius: 2px; }

.nav-dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 10px);
  background: #fff; border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,0.22);
  padding: 8px; min-width: 190px; z-index: 200;
}
.nav-dropdown.open { display: block; }
.nav-dropdown::before {
  content: ""; position: absolute; top: -7px; right: 16px;
  width: 14px; height: 14px; background: #fff; transform: rotate(45deg);
}
.nav-dropdown-link {
  display: block; position: relative; padding: 12px 16px; border-radius: 10px;
  text-decoration: none; font-family: var(--font-body); font-size: 0.95rem; font-weight: 500;
  color: #243b44; transition: background 0.15s ease, color 0.15s ease; cursor: pointer;
}
.nav-dropdown-link:hover { background: #eef1f5; color: #143C52; }
.nav-dropdown-link.login { font-weight: 600; color: #143C52; }
.nav-dropdown-sep { height: 1px; background: #e6edf1; margin: 6px 8px; }

/* Logged-in nav collapse: reuse the guest hamburger + dropdown, rows carry icons. */
.nav-auth-inline { display: flex; align-items: center; gap: 8px; }
.nav-auth-menu { display: none; position: relative; }
.nav-dropdown-link.with-icon { display: flex; align-items: center; gap: 11px; }
.nav-dropdown-link.with-icon svg { color: #143C52; flex: 0 0 auto; }

@media (max-width: 980px) {
  .nav-guest-inline { display: none; }
  .nav-guest-menu { display: block; }
}


/* =====================
   Main Content
   ===================== */
/* Each page is its own scroll container filling the space under the navbar. */
.page {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;   /* else overflow-y:auto makes overflow-x compute to auto,
                           letting the page drift sideways (off-center on refresh) */
  -webkit-overflow-scrolling: touch;
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 40px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 68px;      /* reserved header height so the first card lines up with the dog page's first card */
  margin-bottom: 34px;
  flex-wrap: wrap;
  gap: 16px;
}
/* The Your Dogs header (title + subtitle) and the dog profile header
   (avatar + name + sub) hold different content that reflows differently as the
   width changes. Both share the SAME min-height + margin at each breakpoint so
   the first card starts at the same Y — flipping between the pages is seamless.
   Keep these values in lockstep with .dog-page-header in components.css. */
@media (max-width: 768px) {
  .page-header { min-height: 60px; margin-bottom: 28px; }
}
@media (max-width: 480px) {
  .page-header { min-height: 82px; margin-bottom: 24px; }
}

.page-title {
  font-family: var(--font-body);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* =====================
   Add a Dog Button
   ===================== */
.btn-add {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  box-shadow: 0 2px 8px rgba(0, 145, 210, 0.25);
  white-space: nowrap;
}
.btn-add:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(0, 145, 210, 0.3);
}
.btn-add:active { transform: translateY(0); }

/* =====================
   Dog Cards
   ===================== */
.dog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.dog-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeInUp 0.35s ease both;
}
.dog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(30, 50, 28, 0.12);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card-info {
  flex: 1;
  min-width: 0;
}

.card-info h2 {
  font-family: var(--font-body);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.card-info .breed {
  font-size: 0.88rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.dog-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: var(--avatar-text);
  font-size: 1.2rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.card-stats svg { color: var(--accent); flex-shrink: 0; }

/* =====================
   Empty State
   ===================== */

/* =====================
   Auth Page
   ===================== */
#page-auth {
  display: flex;
  /* No align/justify centering: with a scroll container, centered content
     taller than the viewport gets its top cut off and unreachable. The
     card centers itself with margin:auto instead, which degrades correctly
     to scrollable-from-the-top when it overflows. */
  padding: 40px 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow);
  /* Centers within the flex page when it fits; overflow scrolls from the top. */
  margin: auto;
}

/* Equal-height auth forms: min-height >= the taller (login) form, so login and
   every create-account step fill to the same height and the card neither
   resizes nor shifts when switching tabs or advancing steps. */
#form-login, #form-signup { min-height: 300px; display: flex; flex-direction: column; }
.signup-steps { flex: 1 0 auto; }
.signup-progress-track {
  height: 6px; background: var(--surface-alt, #eee);
  border-radius: 999px; overflow: hidden; margin-bottom: 8px;
}
.signup-progress-bar {
  height: 100%; background: var(--accent); width: 20%;
  border-radius: 999px; transition: width .25s ease;
}
.signup-step-label {
  font-size: 0.8rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 20px;
}
.signup-nav { display: flex; gap: 10px; margin-top: auto; }
.signup-nav .btn-secondary { flex: 0 0 auto; width: auto; }
.signup-nav .btn-primary { flex: 1 1 auto; }
.pw-reqs { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.pw-reqs li { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: #c0392b; }
.pw-reqs li.met { color: #1a7f37; }
.pw-reqs li i { font-size: 1rem; flex-shrink: 0; }
.pw-breach-note { font-size: 0.75rem; color: var(--text-secondary); margin-top: 10px; line-height: 1.4; }
.pw-breach-note i { font-size: 0.85rem; vertical-align: -1px; }
.email-suggest { font-size: 0.82rem; color: var(--text-secondary); margin-top: 8px; }
.email-suggest button {
  background: none; border: none; padding: 0; font: inherit; cursor: pointer;
  color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px;
}
.email-suggest button:hover { opacity: 0.8; }

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.auth-logo span { font-size: 1.6rem; }
.auth-logo h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text-primary);
}

/* Login / Create Account wordmark ("Kaibu" heading) — blue like the landing
   page, scoped so the "My Account" heading (which reuses .auth-title
   elsewhere) is untouched. */
#page-auth .auth-title { color: var(--accent); font-family: 'Poppins', var(--font-display), sans-serif; font-weight: 700; letter-spacing: -0.01em; }

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border-radius: 50px;
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 50px;
  background: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

/* Per-form heading + subtitle (replaces the shared subtitle + pill tabs). */
.auth-heading {
  font-family: var(--font-body);
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.auth-sub {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 22px;
}

/* Grouped email + password: one bordered block with a hairline between. */
.field-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg);
  transition: border-color 0.2s;
}
.field-group:focus-within { border-color: var(--accent); }
.field-group > input {
  width: 100%;
  padding: 12px 14px;
  border: none;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: none;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  outline: none;
}
.field-group .password-input-group {
  border: none;
  border-radius: 0;
  background: none;
}
/* Keep browser autofill from painting the fields pale blue. */
.field-group input:-webkit-autofill,
.field-group input:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  -webkit-text-fill-color: var(--text-primary);
  caret-color: var(--text-primary);
}

.auth-row-right { text-align: right; margin: 10px 0 16px; }

.auth-switch {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 18px;
}
.auth-switch a { color: var(--accent); font-weight: 500; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-primary);
}
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--accent); }
/* iOS centers the value of date inputs by default — left-align it so the
   birthday field matches the weight and other text fields. */
input[type="date"] {
  text-align: left;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}
input[type="date"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
#signup-address-wrap input,
#edit-profile-address-wrap input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--bg);
  outline: none;
  transition: border-color 0.2s;
}
#signup-address-wrap input:focus,
#edit-profile-address-wrap input:focus { border-color: var(--accent); }

.auth-error {
  color: #c0392b;
  font-size: 0.85rem;
  margin-bottom: 12px;
  min-height: 18px;
}

.auth-title {
  font-family: var(--font-body);
  font-size: 1.6rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.btn-primary {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}
.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

/* Google / social sign-in */
.btn-google {
  width: 100%;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  color: #1f2937;
  border: 1px solid var(--border, #dadce0);
  border-radius: var(--radius-btn);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.btn-google:hover { background: #f7f8fa; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.btn-google svg { flex-shrink: 0; }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border, #e3e8ee);
}

.abt-col-left p {
  margin-bottom: 1.5rem;
}

.abt-col-left p:last-child {
  margin-bottom: 0;
}

