/* Glasgow Flood Risk Dashboard - styling
   A calm blue palette with a traffic-light risk badge, generous spacing and
   large readable text, so a non-technical resident can read the result quickly. */

:root {
  --dark: #0b3d5c; --brand: #1264a3; --light: #e7f1f8; --ink: #1c2b36;
  --muted: #5c6b76; --card: #fff; --page: #f4f7fa; --border: #dbe4ea;
  --shadow: 0 2px 12px rgba(11,61,92,.09); --radius: 12px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI", Arial, sans-serif; color: var(--ink);
  background: var(--page); line-height: 1.5; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
h1,h2,h3,h4 { margin: 0 0 .4rem; line-height: 1.25; }
.hidden { display: none; }
.muted { color: var(--muted); font-size: .9rem; }

/* Header */
.app-header { background: linear-gradient(120deg, var(--dark), var(--brand)); color: #fff; padding: 1.3rem 0; }
.header-inner { display: flex; align-items: center; gap: 1rem; }
.logo { font-size: 2.5rem; }
.app-header h1 { font-size: 1.7rem; }
.tagline { margin: .2rem 0 0; opacity: .92; font-size: .96rem; max-width: 900px; }

/* Search */
.search-bar { margin-top: 1.2rem; }
#search-form { display: flex; gap: .6rem; }
#location-input { flex: 1; padding: .85rem 1rem; font-size: 1.05rem; border: 2px solid var(--border);
  border-radius: var(--radius); outline: none; }
#location-input:focus { border-color: var(--brand); }
#search-button { padding: .85rem 1.4rem; font-size: 1.05rem; font-weight: 600; color: #fff;
  background: var(--brand); border: none; border-radius: var(--radius); cursor: pointer; }
#search-button:hover { background: var(--dark); }
.hint { margin: .5rem 0 0; font-size: .9rem; color: var(--muted); }
.example { background: var(--light); border: 1px solid var(--border); color: var(--dark);
  border-radius: 20px; padding: .15rem .7rem; margin: 0 .15rem; cursor: pointer; font-size: .85rem; }
.example:hover { background: #d6e7f4; }

/* Live SEPA outlook banner */
.forecast-banner { margin-top: 1rem; display: flex; align-items: center; gap: .8rem; flex-wrap: wrap;
  background: #eef7ec; border: 1px solid #cfe6c8; border-left: 5px solid #2c7a3f;
  border-radius: 10px; padding: .7rem 1rem; font-size: .92rem; }
.fb-tag { background: #2c7a3f; color: #fff; font-weight: 700; font-size: .72rem; letter-spacing: .03em;
  text-transform: uppercase; padding: .2rem .55rem; border-radius: 20px; white-space: nowrap; }
.fb-text { flex: 1; min-width: 200px; color: var(--ink); }
.fb-link { color: var(--brand); font-weight: 600; text-decoration: none; white-space: nowrap; }
.fb-link:hover { text-decoration: underline; }

/* Layout */
.layout { margin: .9rem auto; display: grid; grid-template-columns: 1.6fr 1fr; gap: 1rem; align-items: start; }
.map-panel { position: relative; }
#map { height: 560px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.legend { position: absolute; bottom: 14px; left: 14px; z-index: 500; background: rgba(255,255,255,.95);
  border: 1px solid var(--border); border-radius: 10px; padding: .7rem .85rem; box-shadow: var(--shadow);
  font-size: .85rem; max-width: 240px; }
.legend h4 { font-size: .85rem; color: var(--dark); }
.legend label { display: block; margin: .25rem 0; cursor: pointer; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: middle;
  margin: 0 .25rem; opacity: .75; }
.sw.river { background: #1f78b4; } .sw.surface { background: #6a51a3; } .sw.coastal { background: #2c7fb8; }
.legend-note { margin: .4rem 0 0; color: var(--muted); font-size: .78rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.2rem 1.3rem; margin-bottom: 1rem; }
.card ol { padding-left: 1.2rem; } .card li { margin-bottom: .4rem; }
.loading { text-align: center; }
.spinner { width: 38px; height: 38px; margin: .4rem auto .8rem; border: 4px solid var(--light);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { border-left: 5px solid #d7301f; color: #8a1a0c; }

/* Result */
.risk-badge { display: inline-block; padding: .5rem 1.1rem; border-radius: 30px; color: #fff;
  font-weight: 700; font-size: 1.15rem; }
.risk-headline { font-size: 1.05rem; font-weight: 600; margin: .7rem 0 .2rem; }
.gauge { margin: 1rem 0 1.2rem; }
.gauge-track { height: 14px; background: linear-gradient(90deg,#4daf4a,#fee08b,#fc8d59,#d7301f);
  border-radius: 8px; position: relative; overflow: hidden; }
.gauge-fill { position: absolute; top: 0; right: 0; bottom: 0; background: rgba(255,255,255,.78);
  width: 100%; transition: width .6s ease; }
.gauge-labels { display: flex; justify-content: space-between; font-size: .76rem; color: var(--muted); margin-top: .25rem; }
.result-summary { font-size: 1rem; margin: .2rem 0 1rem; }
.source-list { list-style: none; padding: 0; margin: .4rem 0 1rem; }
.source-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .55rem .7rem; border: 1px solid var(--border); border-radius: 8px; margin-bottom: .4rem; }
.source-name { font-weight: 600; }
.source-band { font-size: .8rem; padding: .15rem .6rem; border-radius: 20px; white-space: nowrap; }
.band-high { background: #fcded7; color: #a11a08; } .band-medium { background: #ffe9d6; color: #9a4a10; }
.band-low { background: #fff6d6; color: #866a10; } .band-none { background: #e3f3e2; color: #2c6e2a; }
.elevation-box { background: var(--light); border-radius: 8px; padding: .7rem .9rem; font-size: .92rem; margin-bottom: .9rem; }
.matched-location { font-size: .85rem; color: var(--muted); margin: .3rem 0; }
.disclaimer { font-size: .82rem; color: var(--muted); border-top: 1px dashed var(--border); padding-top: .7rem; margin-bottom: 0; }

/* Climate context */
.climate { margin: 1.4rem auto; }
.climate h2 { color: var(--dark); }
.climate-intro { color: var(--muted); max-width: 900px; margin: 0 0 1rem; }
.seasonal-outlook { background: #fff8ec; border: 1px solid #f0dcb8; border-left: 5px solid #e6a000;
  border-radius: 10px; padding: .75rem 1rem; margin-bottom: 1rem; font-size: .93rem; }
.so-tag { background: #e6a000; color: #fff; font-weight: 700; font-size: .72rem; letter-spacing: .03em;
  text-transform: uppercase; padding: .2rem .55rem; border-radius: 20px; margin-right: .5rem; white-space: nowrap; }
.so-note { display: block; color: var(--muted); font-size: .8rem; margin-top: .35rem; }
.climate-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.climate-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.1rem; }
.climate-card h3 { font-size: .95rem; color: var(--brand); margin-bottom: .5rem; }
.climate-card .big { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.climate-card .sub { font-size: .84rem; color: var(--muted); margin-top: .2rem; }
.climate-note { font-size: .82rem; color: var(--muted); margin-top: .9rem; }

/* Footer */
.app-footer { margin: 1.2rem auto 2rem; font-size: .8rem; color: var(--muted); }
.app-footer p { margin: .3rem 0; }

/* Responsive */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  #map { height: 380px; }
  #search-form { flex-direction: column; }
  .climate-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) { .climate-cards { grid-template-columns: 1fr; } }
