/* ==========================================================
   Today.Nexusario — Styles v3.5 (Clean Unified Build, Nov 2025)
   Responsive grid • Unified dark mode • Frosted mobile nav
   Unified Loader • Fade-In • Card Animation • Error Overlay
   ========================================================== */


/* ==========================================================
   SECTION 1 — RESET & BASE
   ========================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #3a82f7;
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  text-decoration: none;
  z-index: 1000;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 10px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}


/* ==========================================================
   SECTION 2 — ROOT VARIABLES (LIGHT/DARK TOKENS)
   ========================================================== */
:root {
  --max-width: 1280px;
  --radius: 14px;
  --space: 1.25rem;
  --gap: 1.25rem;

  --bg: #f9f9f9;
  --text: #222;
  --card-bg: #fff;
  --border: #eee;
  --brand: #0077ff;
  --muted: #666;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --text: #eee;
    --card-bg: #1b1b1b;
    --border: #2a2a2a;
    --brand: #4da3ff;
    --muted: #b0b0b0;
  }
}


/* ==========================================================
   SECTION 3 — LAYOUT
   ========================================================== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
}

main {
  flex: 1;
  padding: 1.5rem 0 2rem;
  contain: content;
}

/* Responsive grid */
.cards-grid {
  display: grid;
  gap: var(--gap);
  align-items: stretch;
  justify-items: stretch;
  margin: 1.25rem 0 2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

@media (min-width: 640px) and (max-width: 1199px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1200px) {
  .cards-grid { grid-template-columns: repeat(4, 1fr); }
}


/* ==========================================================
   SECTION 4 — HEADER, BRAND, AND NAVIGATION
   ========================================================== */
.site-header {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 56px;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  text-decoration: none;
}
.brand-text { display: flex; align-items: baseline; font-size: 1.35rem; font-weight: 700; letter-spacing: 0.3px; }
.brand-main { color: #fff; font-weight: 700; }
.brand-dot { color: #3a82f7; margin: 0 2px; font-weight: 800; font-size: 1.3rem; }
.brand-sub { color: #ddd; opacity: 0.85; font-weight: 500; }
.brand:hover .brand-main, .brand:hover .brand-sub { color: #fff; opacity: 1; }

/* Tabbar */
.tabbar {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: #f0f2f5;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid #e6e6e6;
}
.tabbar .tab {
  padding: .5rem .9rem;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 600;
  color: #333;
  opacity: .9;
  transition: all .2s ease;
}
.tabbar .tab:hover { opacity: 1; }
.tabbar .tab.is-active,
.tabbar .tab[aria-current="page"] {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}


/* ==========================================================
   SECTION 5 — CARDS, TILES, AND SEARCH
   ========================================================== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: var(--space);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  aspect-ratio: 1 / 1.05;
  min-height: 240px;
  transition: all .2s ease;
  content-visibility: auto;
}
.card:hover { transform: translateY(-3px); box-shadow: 2px 4px 8px rgba(0,0,0,0.4); }
.card-foot { margin-top: auto; }

.card-head h2 { margin: 0 0 .15rem 0; font-size: clamp(1rem,0.9vw + 0.6rem,1.1rem); font-weight: 600; }
.card-head .tag { font-size: .85rem; opacity: .7; }
.stat { font-size: clamp(1.5rem,1vw + 1rem,1.8rem); font-weight: 650; line-height: 1.2; }
.meta { font-size: .85rem; color: var(--muted); }
.card-cta { font-size: .85rem; font-weight: 500; color: var(--brand); }
.card-cta:hover { text-decoration: underline; }

/* Tiles group */
.tiles-group {
  margin: 1.5rem 0 2.25rem;
  padding: .4rem 1.2rem 1.2rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.tiles-group .cards-grid { margin: 0; }

/* Row title */
.row-title {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .6rem;
  margin: 0 0 .9rem 0;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: .2px;
}

/* Title badge + fuel search */
.title-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .45rem 2rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f6f7f9;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.title-icon {
  width: 18px; height: 18px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #111; color: #fff;
  font-size: .72rem; font-weight: 800;
}

/* Fuel search input */
.title-badge input[type="search"] {
  appearance: none;
  border: 1px solid rgba(0,0,0,0.12);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 1rem 0.45rem 1rem;
  margin-left: 0.6rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: #111;
  width: 160px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.title-badge input[type="search"]::placeholder { color: #888; }
.title-badge input[type="search"]:focus-visible {
  outline: none;
  border-color: #0077ff;
  box-shadow: 0 0 0 3px rgba(0,119,255,0.2);
  background: #fff;
}

/* Updating animation */
.tile.updating { opacity: 0.6; transition: opacity 0.3s ease; }
.tile.updating .value { color: #ffd54f; transition: color 0.3s ease; }

/* ==========================================================
   Modern City Search (Fuel Section) — v3.3 visual harmony
   ========================================================== */
.city-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.75rem;
}

/* Input field */
#citySearch {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  width: 180px;
  transition: all 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(12px) saturate(160%);
}

#citySearch::placeholder {
  color: rgba(255, 255, 255, 0.6);
  opacity: 1;
}

#citySearch:focus-visible {
  outline: none;
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(77, 163, 255, 0.25);
  color: #fff;
}

/* City list dropdown */
#cityList {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(20, 20, 20, 0.96);
  backdrop-filter: blur(10px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  max-height: 220px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
  z-index: 9999;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

/* Each item */
#cityList li {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.85);
  transition: background 0.25s ease, color 0.25s ease;
}
#cityList li:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* Hide list when inactive */
.hidden { display: none !important; }

/* Light mode adjustments */
@media (prefers-color-scheme: light) {
  #citySearch {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
    color: #111;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  }
  #citySearch::placeholder { color: #888; }
  #cityList {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
  }
  #cityList li { color: #333; }
  #cityList li:hover { background: #f0f0f0; color: #000; }
}



/* ==========================================================
   SECTION 6 — FOOTER
   ========================================================== */
.site-foot {
  background: #181818;
  border-top: 1px solid #2a2a2a;
  color: #ccc;
  text-align: center;
  padding: 0rem 1rem 1rem;
}
.footer-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-evenly;
  align-items: flex-start;
  max-width: 1280px;
  margin: auto;
  gap: 1rem;
}

.footer-col { flex: auto; min-width: 260px; }
.footer-col h4 { font-size: 1rem; color: #fff; margin-bottom: 0.7rem; font-weight: 600; }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 0.4rem; }
.footer-col a { color: #bbb; text-decoration: none; font-size: 0.9rem; transition: color 0.2s ease; }
.footer-col a:hover { color: #3a82f7; }
.footer-logo { font-size: 1.4rem; font-weight: 600; margin: 1.8rem 0 0.2rem; }
.brand-main { color: #fff; }
.brand-dot { color: #3a82f7; margin: 0 2px; }
.brand-sub { opacity: 0.85; color: #ddd; }
.footer-tagline { color: #999; margin-bottom: 0.6rem; font-size: 0.95rem; }
address { font-style: normal; line-height: 1.6; color: #aaa; font-size: 0.9rem; }
address a { color: #3a82f7; }
address a:hover { text-decoration: underline; }
.footer-divider { border: none; border-top: 1px solid #2a2a2a; margin: 0.6rem auto; max-width: 900px; opacity: 0.8; }
.footer-bottom { text-align: center; font-size: 0.9rem; color: #999; line-height: 1.7; }
.footer-bottom small { display: inline-block; max-width: 900px; }


/* ==========================================================
   SECTION 7 — UTILITIES AND STATES
   ========================================================== */
:focus-visible { outline: 2px solid #5aa7ff; outline-offset: 2px; border-radius: 8px; }

.card.is-error{border:1px solid rgba(226,98,98,0.6);}
.card.is-error .meta,.card.is-error .delta,.card.is-error .card-cta{color:#e26262!important;}
.card.is-error .card-cta{text-decoration:underline;cursor:pointer;}

.delta-pos { color: #4caf50; }
.delta-neg { color: #f44336; }
.delta-zero { color: #999; }

/* ==========================================================
   SECTION 8 — LOADER AND OVERLAYS
   ========================================================== */
.loader-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg, #181818);
  color: var(--text, #f2f2f2);
  font-size: 1.05rem; font-weight: 500;
  z-index: 999;
  opacity: 1; visibility: visible;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.loader-overlay.hidden,
body.dashboard-ready .loader-overlay { opacity: 0; visibility: hidden; display: none !important; }

body { opacity: 1; transform: none; }

.tiles-group .card {
  opacity: 0; transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s cubic-bezier(0.25,0.46,0.45,0.94);
}
body.dashboard-ready .tiles-group .card { opacity: 1; transform: translateY(0); }
.tiles-group .card:nth-child(1){transition-delay:.05s;}
.tiles-group .card:nth-child(2){transition-delay:.10s;}
.tiles-group .card:nth-child(3){transition-delay:.15s;}
.tiles-group .card:nth-child(4){transition-delay:.20s;}
.tiles-group .card:nth-child(5){transition-delay:.25s;}

.error-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #1c1c1c; color: #ff5c5c;
  font-size: 1.05rem; font-weight: 600;
  z-index: 1000;
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }


/* ==========================================================
   SECTION 9 — REUSABLE EFFECTS
   ========================================================== */


.fade-in { transition: opacity 0.4s ease-in; opacity: 1 !important; }
.no-match { color: rgba(255,255,255,0.4); pointer-events: none; font-style: italic; }
/* ==========================================================
   Modern Shimmer (Fuel only) — v3.4
   ========================================================== */
.shimmer-modern {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}
.shimmer-modern::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    110deg,
    transparent 0%,
    rgba(255, 255, 255, 0.25) 40%,
    transparent 80%
  );
  animation: shimmer-slide 1.6s infinite;
}
@keyframes shimmer-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@media (prefers-color-scheme: dark) {
  .shimmer-modern {
    background: rgba(255, 255, 255, 0.06);
  }
  .shimmer-modern::after {
    background: linear-gradient(
      110deg,
      transparent 0%,
      rgba(255, 255, 255, 0.18) 40%,
      transparent 80%
    );
  }
}
.is-loading .shimmer-modern {
  opacity: 0.7;
  filter: blur(0.3px);
  transition: opacity 0.3s ease, filter 0.3s ease;
}





/* ==========================================================
   SECTION 10 — DARK MODE REFINEMENTS
   ========================================================== */
@media (prefers-color-scheme: dark) {
  .brand-main { color:#fff; }
  .brand-dot { color:var(--brand); }
  .brand-sub { color:#ccc; }

  .tabbar { background:#1a1a1a; border-color:#333; }
  .tabbar .tab { color:#ddd; }
  .tabbar .tab.is-active,
  .tabbar .tab[aria-current="page"] { background:#2a2a2a; color:#fff; }

  .tiles-group { background:#181818; border-color:#222; box-shadow:0 2px 6px rgba(0,0,0,0.6); }
  .title-badge { background:#222; color:#eee; border-color:#333; }
  .card:hover { box-shadow:0 4px 10px rgba(0,0,0,0.45); }

  .title-badge input[type="search"] {
    background:#1e1e1e; color:#eee; border-color:#333; box-shadow:0 1px 2px rgba(0,0,0,0.5);
  }
  .title-badge input[type="search"]:focus-visible {
    border-color:#4da3ff; box-shadow:0 0 0 3px rgba(77,163,255,0.25); background:#1f1f1f;
  }
  .title-badge input[type="search"]::placeholder { color:#aaa; }
}


/* ==========================================================
   SECTION 11 — MOBILE NAVIGATION & BREAKPOINT FIXES
   ========================================================== */
@media (max-width: 768px) {
  html, body { max-width:100%; overflow-x:hidden; }

  .menu-toggle {
    display:inline-flex; align-items:center; justify-content:center;
    margin-left:auto; background:#1b1b1b; color:#f5f5f5;
    border:1px solid #2a2a2a; border-radius:10px;
    padding:0.5rem 0.7rem; font-size:1.1rem; cursor:pointer;
    transition:all 0.25s ease; z-index:10001;
  }
  .menu-toggle:hover {
    background:#242424; border-color:#3a82f7; color:#3a82f7;
    box-shadow:0 0 6px rgba(58,130,247,0.4);
  }

  .site-header {
    position:fixed; top:0; left:0; right:0;
    z-index:10000; background:var(--card-bg);
    border-bottom:1px solid var(--border);
    height:65px; overflow:hidden;
  }

  .header-row { min-height:56px; }
  main { margin-top:58px !important; }

  .tabbar {
    position:fixed; top:70px; left:37%; right:10%; width:60%;
    margin:0 auto; flex-direction:column; align-items:center; justify-content:flex-start;
    background:rgba(18,18,18,0.6); backdrop-filter:blur(20px) saturate(250%);
    border-top:1px solid rgba(255,255,255,0.158); box-shadow:0 4px 14px rgba(0,0,0,0.4);
    overflow:hidden; opacity:0; max-height:0; border-radius:14px;
    transition:opacity 0.35s ease, max-height 0.35s ease;
  }
  .tabbar.open { opacity:1 !important; max-height:305px !important; padding:0.4rem 0 0.7rem; }
  .tabbar .tab {
    width:100%; text-align:center; padding:0.9rem 1rem;
    font-size:1rem; font-weight:600; color:#eee;
    transition:background 0.25s ease;
  }
  .tabbar .tab:hover { background:rgba(255,255,255,0.1); }

  @keyframes fadeSlideIn { from{opacity:0;transform:translateY(10px);}to{opacity:1;transform:translateY(0);} }

  section:first-of-type {
    background: var(--card-bg);
    margin-top: 0 !important;
    padding-top: 1rem !important;
  }
  body.is-dashboard main, body.dashboard main {
    margin-top:60px !important; padding-top:0.8rem;
  }

  .card { padding:calc(var(--space)*0.85); max-height:210px !important; }
  .cards-grid { gap:calc(var(--gap)*0.8); }
  .tiles-group {
    background:rgba(18,18,18,0.9);
    border-color:rgba(255,255,255,0.212);
    text-align:center;
    align-items: center;
    align-content: center;
  }
  .card { background:rgba(18,18,18,0.993); box-shadow:0 2px 8px rgba(0,0,0,0.4); }
  .title-badge { background:rgb(18,18,18,0.993); }

  .footer-container {
    flex-direction:column; align-items:center; text-align:center;
  }
  .footer-col { margin-bottom:1rem; }
  .footer-bottom small { line-height:1.8; }

  .container { padding:0 0.8rem; }
}

@media (min-width:769px) {
  .menu-toggle { display:none !important; }
  .tabbar {
    position:static !important;
    display:inline-flex !important;
    flex-direction:row !important;
    background:none !important;
    box-shadow:none !important;
    backdrop-filter:none !important;
    max-height:none !important;
    opacity:1 !important;
    width:auto !important;
  }
}
