/* MetGPT — style.css (Met Éireann navy theme) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Met Éireann deep navy brand */
  --teal:       #12395D;  /* primary navy (kept var name for compatibility) */
  --teal-light: #E3ECF4;  /* pale navy tint */
  --teal-mid:   #A9C2DA;  /* mid navy */
  --teal-dark:  #0A2540;  /* deepest navy */
  --amber:      #B8860B;
  --amber-bg:   #FBF0D8;
  --red:        #A32D2D;
  --red-bg:     #FCEBEB;
  --blue:       #2563C9;  /* vivid accent blue */
  --blue-bg:    #DCEBFC;
  --gray-50:    #F5F9FE;
  --gray-100:   #E9F1F9;
  --gray-200:   #CBD9E7;
  --gray-400:   #7688A0;
  --gray-600:   #46586E;
  --gray-900:   #12212E;
  --bg:         #FFFFFF;
  --radius:     10px;
  --radius-lg:  14px;
  /* Accent colours for splashes of life */
  --sun:        #FFB020;
  --sun-soft:   #FFF1D6;
  --sky:        #3B9AE1;
  --sky-soft:   #DCF0FB;
}

/* App is always light-themed — prevent the OS dark mode from altering colours */
:root { color-scheme: light; }

html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--gray-900); font-size: 15px; line-height: 1.6; }

/* Layout — brighter sky gradient backdrop */
.layout {
  display: flex;
  height: 100vh;
  height: 100dvh;
  background: linear-gradient(160deg, #CFE4FA 0%, #DDEEFB 35%, #EAF4FE 70%, #F5FAFF 100%);
}

/* Sidebar — navy gradient, Met Éireann branding */
.sidebar {
  width: 260px;
  min-width: 260px;
  border-right: none;
  background: linear-gradient(180deg, #0A2540 0%, #12395D 55%, #164A78 100%);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.25rem;
  gap: 1.25rem;
  overflow-y: auto;
}
.sidebar .section-label { color: rgba(255,255,255,0.6); }
.sidebar .field-hint { color: rgba(255,255,255,0.5); }
.sidebar input[type="text"],
.sidebar textarea {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
}
.sidebar input[type="text"]::placeholder,
.sidebar textarea::placeholder { color: rgba(255,255,255,0.45); }
.sidebar input[type="text"]:focus,
.sidebar textarea:focus {
  border-color: #6FA8D6;
  box-shadow: 0 0 0 2px rgba(111,168,214,0.3);
  background: rgba(255,255,255,0.15);
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0.75rem 0.9rem;
  margin: -0.5rem -0.25rem 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-text { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }
.logo-sub { font-size: 12px; color: rgba(255,255,255,0.7); }

.sidebar-section { display: flex; flex-direction: column; gap: 6px; }
.section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--gray-400); }

input[type="text"],
textarea {
  width: 100%;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--gray-900);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: none;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus,
textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(18,57,93,0.15); }

.field-hint { font-size: 11px; color: var(--gray-400); }

.btn-save {
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-save:hover { opacity: 0.88; }

.save-status { font-size: 12px; color: var(--teal); min-height: 16px; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.footer-note { font-size: 11px; color: var(--gray-400); }
.footer-note strong { color: var(--gray-600); font-weight: 500; }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: transparent;
}

.chat-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 0.5px solid var(--gray-200);
  gap: 10px;
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.chat-title { font-size: 16px; font-weight: 600; }
.chat-sub { font-size: 12px; color: var(--gray-400); }

.btn-clear {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 6px 12px;
  font-size: 13px;
  color: var(--gray-600);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-clear:hover { background: var(--gray-100); }

/* Chat window */
.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Welcome */
.welcome-card {
  background: linear-gradient(135deg, #E8F4FF 0%, #F0E9FF 100%);
  border: 1px solid rgba(37,99,201,0.12);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  max-width: 560px;
  box-shadow: 0 4px 16px rgba(18,57,93,0.06);
}
.welcome-title { font-size: 16px; font-weight: 700; color: var(--teal-dark); margin-bottom: 4px; }
.welcome-body { font-size: 13px; color: var(--gray-600); margin-bottom: 1rem; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; }
.suggestion {
  background: #fff;
  border: 1px solid var(--sky);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--blue);
  cursor: pointer;
  transition: all 0.15s;
}
.suggestion:hover { background: var(--blue); color: #fff; border-color: var(--blue); }

/* Message bubbles */
.msg { display: flex; gap: 10px; align-items: flex-start; max-width: 700px; }
.msg.user { flex-direction: row-reverse; align-self: flex-end; }

.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.msg.user .msg-avatar { background: linear-gradient(135deg, var(--teal), var(--blue)); color: #fff; }
.msg.assistant .msg-avatar { background: var(--teal-light); color: var(--teal); }

.msg-content { display: flex; flex-direction: column; gap: 6px; }
.msg.user .msg-content { align-items: flex-end; }

.bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  max-width: 520px;
}
.msg.user .bubble {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.assistant .bubble {
  background: #FFFFFF;
  color: var(--gray-900);
  border: 1px solid var(--gray-200);
  border-bottom-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(18,57,93,0.05);
}

/* Response parts inside assistant msg */
.resp-info {
  font-size: 12px;
  color: var(--gray-400);
  font-style: italic;
  padding: 0 2px;
}

.resp-warning {
  background: var(--amber-bg);
  border-left: 3px solid var(--amber);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--amber);
}

.resp-error {
  background: var(--red-bg);
  border-left: 3px solid var(--red);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--red);
}

/* Forecast card */
.forecast-card {
  background: #FFFFFF;
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 0;
  min-width: 280px;
  max-width: 420px;
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(18,57,93,0.10);
}
.fc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--teal-dark) 0%, var(--blue) 100%);
}
.fc-header-left { display: flex; align-items: center; gap: 10px; }
.fc-weather-icon { color: #FFD764; flex-shrink: 0; }
.fc-location { font-size: 15px; font-weight: 700; color: #fff; }
.fc-date { font-size: 11px; color: rgba(255,255,255,0.75); }

.fc-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 14px; padding-bottom: 8px; }
.fc-metric {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--gray-50);
  border-radius: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--blue);
}
.fc-metric-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-400);
}
.fc-metric-value { font-size: 16px; font-weight: 700; color: var(--blue); }

/* Uniform blue metric tiles (clean, Met Éireann style) */
.fc-metric--tempc,
.fc-metric--rain,
.fc-metric--chance,
.fc-metric--wind,
.fc-metric--humidity { background: var(--gray-50); border-left-color: var(--blue); }

.fc-metric--tempc .fc-metric-label,
.fc-metric--rain .fc-metric-label,
.fc-metric--chance .fc-metric-label,
.fc-metric--wind .fc-metric-label,
.fc-metric--humidity .fc-metric-label { color: var(--gray-400); }

.fc-metric--tempc .fc-metric-value,
.fc-metric--rain .fc-metric-value,
.fc-metric--chance .fc-metric-value,
.fc-metric--wind .fc-metric-value,
.fc-metric--humidity .fc-metric-value { color: var(--blue); }

.fc-metric--tempc { grid-column: 1 / -1; }
.fc-metric--wind { grid-column: 1 / -1; }
.fc-metric--wind .fc-metric-value { font-size: 14px; }

.fc-hourly-toggle {
  background: var(--gray-50);
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--gray-600);
  cursor: pointer;
  width: calc(100% - 28px);
  margin: 0 14px 14px;
  text-align: left;
}
.fc-hourly-toggle:hover { background: var(--gray-100); }

.fc-hourly { display: none; margin: 0 14px 14px; overflow-x: auto; }
.fc-hourly.open { display: block; }
.fc-hourly-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.fc-hourly-table th { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--gray-400); padding: 4px 4px; text-align: left; border-bottom: 0.5px solid var(--gray-200); }
.fc-hourly-table td { padding: 3px 4px; color: var(--gray-900); border-bottom: 0.5px solid var(--gray-200); white-space: nowrap; }
.fc-hourly-table tr:last-child td { border-bottom: none; }

/* Advice bubble */
.advice-bubble {
  background: #FFFFFF;
  border: 1px solid var(--gray-200);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--gray-900);
  max-width: 520px;
  white-space: pre-wrap;
  box-shadow: 0 2px 8px rgba(18,57,93,0.05);
}

/* Typing indicator */
.typing { display: flex; gap: 4px; align-items: center; padding: 10px 14px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--gray-400); animation: bounce 1s infinite; }
.dot:nth-child(2) { animation-delay: 0.15s; }
.dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-6px); } }

/* Input area */
.chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 1rem 1.5rem;
  border-top: 0.5px solid var(--gray-200);
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.chat-textarea {
  flex: 1;
  border: 0.5px solid var(--gray-200);
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  color: var(--gray-900);
  padding: 10px 14px;
  font-size: 16px;              /* 16px avoids iOS zoom-on-focus */
  font-family: inherit;
  resize: none;
  outline: none;
  max-height: 140px;
  overflow-y: auto;
  transition: border-color 0.15s;
  line-height: 1.5;
}
.chat-textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 2px rgba(18,57,93,0.15); }

.btn-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.btn-send:hover { opacity: 0.85; }
.btn-send:disabled { opacity: 0.4; cursor: default; }

.input-hint { text-align: center; font-size: 11px; color: var(--gray-400); padding-bottom: 0.75rem; }

/* Scrollbar */
.chat-window::-webkit-scrollbar { width: 4px; }
.chat-window::-webkit-scrollbar-thumb { background: var(--gray-200); border-radius: 4px; }

/* Sidebar toggle button (hamburger) — hidden on desktop, shown on mobile */
.sidebar-toggle { display: none; }

/* Overlay behind the mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
}
.sidebar-overlay.open { display: block; }

/* ─── Mobile ─────────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    height: 100dvh;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
  }
  .layout.sidebar-open .sidebar { transform: translateX(0); }

  /* Show the hamburger on mobile */
  .sidebar-toggle {
    display: flex !important;
    background: none;
    border: 0.5px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 6px 8px;
    color: var(--gray-600);
    cursor: pointer;
    align-items: center;
  }

  .chat-topbar { padding: 0.75rem 1rem; }
  .chat-sub { display: none; }
  .chat-window { padding: 1rem; }
  .chat-input-row { padding: 0.75rem 1rem; }

  /* Hide the username label on small screens to save space */
  .topbar-actions span { display: none; }

  /* Cards and bubbles use full width on mobile */
  .forecast-card, .week-summary, .advice-bubble, .bubble { max-width: 100%; }
  .msg { max-width: 100%; }

  /* Sign-out text hidden, icon only */
  .btn-logout { padding: 6px 8px; }
  .btn-logout span, .btn-clear span { display: none; }
}

/* ─── Week summary (compact multi-day view) ──────────────────────────────── */

.week-summary {
  background: linear-gradient(135deg, var(--blue-bg) 0%, var(--teal-light) 100%);
  border: 0.5px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  max-width: 420px;
  margin-bottom: 4px;
  box-shadow: 0 2px 10px rgba(18,57,93,0.06);
}

.week-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 8px;
  margin-bottom: 6px;
  border-bottom: 0.5px solid var(--gray-200);
}
.week-loc {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
}
.week-cols {
  display: grid;
  grid-template-columns: 70px 90px 60px;
  gap: 8px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gray-400);
  text-align: right;
}

.fc-row {
  display: grid;
  grid-template-columns: 1fr 70px 90px 60px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 0.5px solid rgba(0,0,0,0.04);
}
.fc-row:last-child { border-bottom: none; }
.fc-row-day {
  font-weight: 600;
  color: var(--blue);
}
.fc-row-temp,
.fc-row-rain,
.fc-row-wind {
  text-align: right;
  color: var(--blue);
  font-weight: 600;
}
