/* ========================================
   Layout — Header, Nav, Main Content
   ======================================== */

:root {
  --max-app-width: 600px;
}

/* ---- Header ---- */
#app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: white;
  padding: 0 20px;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 12px rgba(164, 123, 91, 0.3);
  max-width: var(--max-app-width, 600px);
  margin-left: auto;
  margin-right: auto;
}

.header-content {
  flex-shrink: 0;
}

.header-content h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.puppy-age {
  font-size: 13px;
  opacity: 0.9;
  margin-top: 1px;
  font-weight: 500;
}

.header-summary {
  flex: 1;
  text-align: right;
  font-size: 15px;
  letter-spacing: 1px;
  opacity: 0.95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.refresh-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.refresh-btn:active {
  transform: scale(0.9);
  background: rgba(255,255,255,0.35);
}

.refresh-btn.spinning {
  animation: spin 0.8s ease;
}

/* ---- Loading Skeleton ---- */
.loading-skeleton {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loading-skeleton.hidden {
  display: none;
}

.skeleton-bar {
  height: 48px;
  background: linear-gradient(90deg, var(--cream-dark) 25%, var(--gold-light) 50%, var(--cream-dark) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-card {
  height: 80px;
  background: linear-gradient(90deg, var(--cream-dark) 25%, var(--gold-light) 50%, var(--cream-dark) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius);
  animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-card-short {
  height: 56px;
  width: 75%;
}

/* ---- Main Content ---- */
#main-content {
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  min-height: calc(100vh - var(--header-height));
  min-height: calc(100dvh - var(--header-height));
}

#main-content.hidden {
  display: none;
}

.view {
  display: none;
  padding: 16px;
  animation: fadeIn 0.25s ease;
  max-width: var(--max-app-width, 600px);
  margin-left: auto;
  margin-right: auto;
}

.view.active {
  display: block;
}

/* ---- Section Titles ---- */
.section-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--text);
}

.section-subtitle {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-light);
  margin: 16px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 12px;
}

/* ---- Bottom Nav ---- */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: var(--max-app-width, 600px);
  margin-left: auto;
  margin-right: auto;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: white;
  display: flex;
  box-shadow: 0 -2px 12px rgba(61, 44, 30, 0.08);
  z-index: 9999;
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  padding: 8px 4px;
}

.nav-tab.active {
  color: var(--gold-dark);
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.nav-tab.active .nav-label {
  color: var(--gold-dark);
}

.nav-tab:active {
  transform: scale(0.93);
}

/* ---- Pull to Refresh indicator ---- */
.pull-indicator {
  position: fixed;
  top: var(--header-height);
  left: 50%;
  transform: translateX(-50%) translateY(-100%);
  background: var(--gold);
  color: white;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  z-index: 99;
  transition: transform 0.2s;
  pointer-events: none;
}

.pull-indicator.visible {
  transform: translateX(-50%) translateY(0);
}

/* ---- Date Selector ---- */
.date-selector {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 16px;
  position: relative;
}

.date-nav {
  background: white;
  border: none;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  font-size: 26px;
  color: var(--gold-darker);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.date-nav:active {
  transform: scale(0.92);
  box-shadow: var(--shadow-md);
}

.date-nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.date-display {
  text-align: center;
  min-width: 180px;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: none;
  color: var(--text);
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.date-display:hover,
.date-display:active {
  background: rgba(212, 165, 116, 0.12);
}

.date-display .date-main {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.date-display .date-sub {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 2px;
}

.date-picker-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

/* ---- Desktop ---- */
@media (min-width: 600px) {
  #main-content {
    max-width: 560px;
    margin: 0 auto;
  }
}

@media (min-width: 768px) {
  :root {
    --header-height: 80px;
  }

  #app-header {
    padding: 0 32px;
  }

  .header-content h1 {
    font-size: 26px;
  }

  .view {
    padding: 24px;
  }

  #main-content {
    max-width: 640px;
  }
}
