/* Azure Lifeboat — Crisis Mode UI (Azure AI brand) */

:root {
  --bg-wave: #020617;
  --bg-dark: #030712;
  --bg-darker: #010409;
  --glass-bg: rgba(8, 15, 30, 0.82);
  --glass-border: rgba(255, 255, 255, 0.06);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent-blue: #38bdf8;
  --accent-blue-hover: #0284c7;
  --accent-glow: rgba(56, 189, 248, 0.55);
  --warning: #f59e0b;
  --success: #4ade80;
  --font-main: "Inter", system-ui, -apple-system, sans-serif;
}

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

body.lifeboat-page {
  font-family: var(--font-main);
  color: var(--text-primary);
  background: var(--bg-wave);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
}

.lifeboat-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 120% 40% at 50% 100%, rgba(15, 35, 65, 0.35) 0%, transparent 55%),
    linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-wave) 35%, var(--bg-wave) 100%);
}

.page-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header — matches Azure AI chat home */
.site-header {
  position: relative;
  text-align: center;
  margin-bottom: 1.5rem;
  animation: fadeInDown 0.7s ease;
}

.state-pill {
  position: absolute;
  top: 0;
  left: 0;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--glass-border);
  background: rgba(2, 6, 23, 0.92);
  backdrop-filter: blur(8px);
}

.state-active { color: var(--accent-blue); border-color: rgba(56, 189, 248, 0.45); }
.state-ready { color: var(--success); border-color: rgba(74, 222, 128, 0.4); }
.state-degraded { color: var(--warning); border-color: rgba(245, 158, 11, 0.4); }
.state-standby { color: var(--text-secondary); }
.state-error { color: #f87171; border-color: rgba(248, 113, 113, 0.4); }
.state-recovery_pending { color: #fb923c; border-color: rgba(251, 146, 60, 0.4); }

.site-brand {
  display: inline-flex;
  margin-bottom: 0.5rem;
}

.site-brand__logo {
  width: 88px;
  height: auto;
  filter: drop-shadow(0 0 20px var(--accent-glow));
  animation: brand-float 4s ease-in-out infinite;
}

.site-brand__logo--lifeboat {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 55%;
}

@keyframes brand-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.site-header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.tagline {
  color: var(--text-secondary);
  font-weight: 300;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 0.15rem;
}

.mode-badge {
  display: inline-block;
  margin-top: 0.65rem;
  padding: 0.3rem 0.85rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.08);
}

/* Cards */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem 1.35rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.notice {
  margin-bottom: 1.25rem;
  border-left: 3px solid var(--accent-blue);
  font-size: 0.92rem;
  color: var(--text-secondary);
}

.notice strong {
  color: var(--text-primary);
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.weather-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.glass-card h2 {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--accent-blue);
  margin-bottom: 0.85rem;
}

.coords {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.data-status {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}

.status-live {
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.status-last_verified_data {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-provenance {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 189, 248, 0.28);
  margin-left: 0.35rem;
  font-size: 0.6rem;
}

.stale-notice {
  font-size: 0.75rem;
  color: var(--warning);
  white-space: pre-line;
  margin: 0.5rem 0;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.meta {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.35rem;
}

.metric {
  font-size: 2.25rem;
  font-weight: 300;
  color: var(--accent-blue);
  line-height: 1.1;
  margin-bottom: 0.75rem;
}

.metric span {
  font-size: 1rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.detail-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.88rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.detail-list div:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-list dt {
  color: var(--text-secondary);
  font-weight: 400;
}

.detail-list dd {
  color: var(--text-primary);
  font-weight: 500;
}

.warnings-card {
  border-color: rgba(245, 158, 11, 0.25);
  grid-column: 1 / -1;
}

.warning-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(245, 158, 11, 0.15);
}

.warning-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.warning-item strong {
  color: var(--warning);
  display: block;
  margin-bottom: 0.25rem;
}

.warning-item p {
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.forecast-card {
  grid-column: 1 / -1;
}

.forecast-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.forecast-day {
  display: grid;
  grid-template-columns: 7rem 1fr 1fr;
  gap: 0.75rem;
  align-items: center;
  font-size: 0.85rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.forecast-day .date {
  color: var(--accent-blue);
  font-weight: 600;
}

.forecast-day .temps {
  color: var(--text-primary);
}

.forecast-day .wind {
  color: var(--text-secondary);
  text-align: right;
}

.unavailable {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--text-secondary);
}

/* Chat — Azure-style input */
.chat-section h2 {
  margin-bottom: 0.35rem;
}

.chat-disclaimer {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.chat-standby {
  font-size: 0.82rem;
  color: var(--warning);
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.input-area[data-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

.chat-messages {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
  scrollbar-width: thin;
  scrollbar-color: var(--glass-border) transparent;
}

.chat-msg {
  padding: 0.75rem 1rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.55;
  animation: fadeIn 0.35s ease;
}

.chat-msg.user {
  align-self: flex-end;
  max-width: 85%;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-bottom-right-radius: 4px;
}

.chat-msg.assistant {
  align-self: flex-start;
  max-width: 90%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-bottom-left-radius: 4px;
  color: var(--text-secondary);
}

.input-area {
  display: flex;
  gap: 0.5rem;
  background: rgba(2, 6, 23, 0.75);
  border: 1px solid var(--glass-border);
  padding: 0.4rem;
  border-radius: 24px;
  transition: border-color 0.25s;
}

.input-area:focus-within {
  border-color: rgba(56, 189, 248, 0.45);
}

#chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0.65rem 1rem;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
}

#chat-input::placeholder {
  color: var(--text-secondary);
}

.input-area button {
  background: var(--accent-blue);
  color: var(--bg-darker);
  border: none;
  border-radius: 18px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.2s;
}

.input-area button:hover {
  background: var(--accent-blue-hover);
  transform: scale(1.04);
}

/* Footer — blends into wave image */
.app-footer {
  margin-top: 2rem;
  align-self: stretch;
  text-align: center;
  padding: 0 0 1rem;
  background: transparent;
}

.footer-wave-shell {
  width: 100vw;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  max-height: min(20vh, 180px);
  line-height: 0;
  overflow: hidden;
  background: var(--bg-wave);
}

.footer-wave {
  display: block;
  width: 100%;
  max-height: min(18vh, 160px);
  object-fit: cover;
  object-position: bottom center;
  opacity: 0.72;
  filter: saturate(1.05) contrast(1.02);
}

.footer-text {
  font-size: 0.65rem;
  color: rgba(148, 163, 184, 0.55);
  letter-spacing: 0.06em;
  margin-top: 0.35rem;
}

.refresh-note {
  font-size: 0.6rem;
  color: rgba(148, 163, 184, 0.4);
  margin-top: 0.25rem;
}

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

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .page-shell {
    padding: 1rem 0.85rem 0;
  }

  .site-header {
    padding-top: 0.15rem;
  }

  .state-pill {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    margin-bottom: 0;
    z-index: 2;
  }

  .site-brand {
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .site-header h1 {
    font-size: 1.65rem;
  }

  .site-brand__logo--lifeboat {
    width: 72px;
    height: 72px;
  }

  .weather-grid {
    grid-template-columns: 1fr;
  }

  .forecast-day {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .forecast-day .wind {
    text-align: left;
  }
}
