/* ============================================================
   Gas Flows in Europe — light SaaS dashboard
   Matches the reference screenshot: white cards on a light
   gray canvas, colored accent bars on stat tiles, live ticker.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #F3F4F6;
  --card: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-muted: #6B7280;
  --text-faint: #9CA3AF;
  --blue: #3B82F6;
  --purple: #8B5CF6;
  --pink: #EC4899;
  --red: #EF4444;
  --crimson: #DC2626;
  --orange: #F97316;
  --gold: #F59E0B;
  --green: #10B981;
  --teal: #14B8A6;
  --green-badge-bg: #D1FAE5;
  --green-badge-text: #059669;
  --blue-badge-bg: #DBEAFE;
  --blue-badge-text: #2563EB;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.tabular { font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--blue-badge-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-mark svg { width: 20px; height: 20px; }

.brand-title { font-size: 17px; font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-chip svg { width: 16px; height: 16px; color: var(--text-faint); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge.admin { background: var(--green-badge-bg); color: var(--green-badge-text); }
.badge.live {
  background: var(--blue-badge-bg);
  color: var(--blue-badge-text);
}
.badge.live-green { background: var(--green-badge-bg); color: var(--green-badge-text); }

.logout {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.logout svg { width: 15px; height: 15px; }

/* ---------- Page layout ---------- */

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 22px 24px;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title { font-size: 16px; font-weight: 700; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.date-select-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.date-select-label { font-size: 12px; font-weight: 600; color: var(--text); }

select.date-select {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}
.icon-btn svg { width: 15px; height: 15px; }

/* ---------- Stat tile grid ---------- */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.tile-grid.prices { grid-template-columns: repeat(4, 1fr); }

.tile {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  overflow: hidden;
  background: var(--card);
}

.tile::after {
  content: "";
  position: absolute;
  top: 8px;
  bottom: 8px;
  right: 10px;
  width: 4px;
  border-radius: 3px;
  background: var(--tile-color, var(--blue));
}

.tile-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 8px; padding-right: 14px; }
.tile-value { font-size: 20px; font-weight: 700; padding-right: 14px; }
.tile-sub { font-size: 12px; color: var(--text-faint); margin-top: 4px; padding-right: 14px; }

/* ---------- Total consumption ---------- */

.total-row {
  border-top: 1px solid var(--border);
  margin-top: 18px;
  padding-top: 16px;
  font-size: 14px;
  color: var(--text-muted);
}
.total-row strong { color: var(--blue-badge-text); font-size: 15px; font-weight: 700; }

/* ---------- Ticker strip ---------- */

.ticker-bar {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  height: 48px;
}

.ticker-live {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 18px;
  height: 100%;
  background: var(--blue-badge-bg);
  color: var(--blue-badge-text);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.ticker-live svg { width: 14px; height: 14px; }

.ticker-track-wrap {
  overflow: hidden;
  flex: 1;
  height: 100%;
  position: relative;
}

.ticker-track {
  display: flex;
  align-items: center;
  height: 100%;
  width: max-content;
  animation: ticker-scroll 30s linear infinite;
}

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  font-size: 13px;
  white-space: nowrap;
  border-right: 1px solid var(--border);
  height: 20px;
}
.ticker-item .name { font-weight: 700; }
.ticker-item .unit { color: var(--text-faint); font-size: 11px; }
.ticker-item .change { display: flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; }
.ticker-item .change.up { color: var(--green-badge-text); }
.ticker-item .change.down { color: var(--red); }
.ticker-item .change svg { width: 11px; height: 11px; }

/* ---------- Storage statistics grid ---------- */

.storage-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.storage-meta .prior { color: var(--text-faint); }

.storage-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.storage-tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--card);
}

.storage-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.storage-country { font-size: 13.5px; font-weight: 700; }

.storage-trend { width: 15px; height: 15px; flex-shrink: 0; }
.storage-trend.up { color: var(--green-badge-text); }
.storage-trend.down { color: var(--red); }

.storage-value { font-size: 14.5px; font-weight: 700; }
.storage-value .pct { font-weight: 500; color: var(--text-faint); font-size: 12.5px; }

.storage-change { font-size: 12.5px; font-weight: 600; margin-top: 3px; }
.storage-change.up { color: var(--green-badge-text); }
.storage-change.down { color: var(--red); }
.storage-change .pct { font-weight: 500; }

.storage-prev { font-size: 11.5px; color: var(--text-faint); margin-top: 3px; }

.storage-flow {
  font-size: 11.5px;
  color: var(--blue-badge-text);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.storage-flow svg { width: 9px; height: 9px; }

@media (max-width: 1100px) {
  .storage-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  .storage-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Map card ---------- */

.map-card { padding: 22px 24px 24px; }

.map-container {
  position: relative;
  height: 620px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.leaflet-container {
  height: 100%;
  width: 100%;
  font-family: 'Inter', sans-serif;
  background: #E8EAED;
}

/* mode-select control, styled to match the app's card language */
.map-mode-control {
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(16,24,40,0.15);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--text);
}
.map-mode-control label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
}
.map-mode-control input[type="radio"] {
  accent-color: var(--blue);
  cursor: pointer;
}

.map-fullscreen-btn {
  background: var(--card);
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(16,24,40,0.15);
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
}
.map-fullscreen-btn svg { width: 15px; height: 15px; }

/* tanker count badge + refresh (top-right control) */
.map-count-control {
  background: var(--card);
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(16,24,40,0.15);
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.map-count-control svg.ship { width: 15px; height: 15px; color: var(--blue-badge-text); }
.map-count-control .refresh-btn {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.map-count-control .refresh-btn svg { width: 14px; height: 14px; }

.map-legend {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 12px;
}
.map-legend .berthed { color: var(--orange); font-weight: 600; }
.map-legend .slow { color: var(--green-badge-text); font-weight: 600; }
.map-legend .underway { color: var(--blue); font-weight: 600; }

/* ---------- News card ---------- */

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.news-meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}
.news-meta-left svg { width: 15px; height: 15px; color: var(--blue-badge-text); }

.news-list { display: flex; flex-direction: column; }

.news-item {
  display: flex;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.news-item:last-child { border-bottom: none; padding-bottom: 4px; }

.news-item-bar {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
  background: var(--news-color, var(--orange));
}

.news-item-body { flex: 1; min-width: 0; }

.news-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.news-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--news-color, var(--orange)) 16%, white);
  color: var(--news-color, var(--orange));
}
.news-time { font-size: 12px; color: var(--text-faint); }

.news-headline-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.news-headline {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text);
}
.news-headline:hover { text-decoration: underline; }
.news-source-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12px;
  color: var(--blue-badge-text);
  font-weight: 500;
}
.news-source-link svg { width: 11px; height: 11px; }

.news-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Gas balance card ---------- */

.balance-group { margin-bottom: 18px; }
.balance-group:last-of-type { margin-bottom: 20px; }

.balance-group-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
  color: var(--balance-color, var(--green-badge-text));
}

.balance-tile-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.balance-tile {
  border-radius: 10px;
  padding: 13px 15px;
  border: 1px solid color-mix(in srgb, var(--balance-color, var(--green-badge-text)) 35%, var(--border));
  background: color-mix(in srgb, var(--balance-color, var(--green-badge-text)) 8%, white);
}
.balance-tile-label { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.balance-tile-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--balance-color, var(--green-badge-text));
}

.balance-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1.5px solid color-mix(in srgb, var(--balance-color, var(--green-badge-text)) 45%, var(--border));
  background: color-mix(in srgb, var(--balance-color, var(--green-badge-text)) 6%, white);
  border-radius: 12px;
  padding: 16px 20px;
  margin-top: 12px;
}
.balance-summary-title { font-size: 14px; font-weight: 700; color: var(--text); }
.balance-summary-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.balance-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--balance-color, var(--green-badge-text));
  white-space: nowrap;
  flex-shrink: 0;
}
.balance-summary-value .unit { font-size: 13px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }

@media (max-width: 1100px) {
  .balance-tile-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .balance-tile-grid { grid-template-columns: repeat(2, 1fr); }
  .balance-summary { flex-direction: column; align-items: flex-start; }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .tile-grid, .tile-grid.prices { grid-template-columns: repeat(2, 1fr); }
  .storage-grid { grid-template-columns: repeat(2, 1fr); }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .page { padding: 20px 16px 48px; }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
