:root {
  --bg-color: #0d1117;
  --card-bg: rgba(22, 27, 34, 0.8);
  --accent-color: #58a6ff;
  --text-primary: #c9d1d9;
  --text-secondary: #8b949e;
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --red-accent: #f85149;
  --green-accent: #238636;
  --root-zoom: 1;
  --zoom: var(--root-zoom);
}

.navbar {
  --zoom: var(--root-zoom) !important;
}

html {
  overflow-x: hidden;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.5;
  font-size: calc(16px * var(--zoom, 1));
}

h1,
h2,
h3,
.navbar-brand {
  font-family: 'Outfit', sans-serif;
}

.app-container {
  min-height: 100vh;
  padding-top: 80px;
  background: radial-gradient(circle at top right, #161b22, #0d1117);
}

/* Navbar */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 70px;
  background: rgba(13, 17, 23, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  z-index: 1000;
}

.navbar-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-brand i {
  color: var(--red-accent);
}

.nav-links {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  list-style: none;
}

.navbar-collapse {
  align-items: center;
}

.navbar-nav {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem;
  cursor: pointer;
  background: transparent !important;
  border: none;
}

.nav-link:hover {
  color: var(--accent-color) !important;
}

/* Dropdown Menu CSS */
.nav-item {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  padding: 0.5rem 0;
  display: none !important;
  /* overriden by hover */
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  z-index: 1050;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

/* Restrict hover open to desktop */
@media (min-width: 992px) {
  .nav-item:hover .dropdown-menu {
    display: flex !important;
    opacity: 1;
    transform: translateY(0);
  }
}

/* Allow Bootstrap JS toggle functionality on all devices, notably mobile */
.nav-item.show .dropdown-menu,
.dropdown-menu.show {
  display: flex !important;
  opacity: 1;
  transform: translateY(0);
}

.dropdown-item {
  padding: 0.6rem 1.2rem;
  color: var(--text-primary) !important;
  text-decoration: none;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.2s, color 0.2s;
  background: transparent !important;
}

.dropdown-item:hover {
  background: var(--glass-bg) !important;
  color: var(--accent-color) !important;
}

.dropdown-item i,
.dropdown-item svg {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  color: var(--accent-color);
}

.dropdown-divider {
  height: 1px;
  background: var(--glass-border);
  margin: 0.4rem 0;
}


/* Mobile Toggler */
.navbar-toggler {
  display: none;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Search Bar in Navbar */
.search-container {
  display: flex;
  align-items: center;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  padding: 0.5rem 1rem;
  border-radius: 99px;
  width: 300px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-container:focus-within {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.3);
}

.search-input {
  background: none;
  border: none;
  color: #fff;
  outline: none;
  width: 100%;
  padding-left: 0.5rem;
}

/* Grid Layout */
.main-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem;
}

.section {
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: #fff;
}

.section-title i {
  opacity: 0.7;
}

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

/* Link Card */
.link-card {
  background: var(--card-bg);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: calc(1rem * var(--zoom, 1));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(0.75rem * var(--zoom, 1));
  text-decoration: none;
  transition: transform 0.2s, background 0.2s, border-color 0.2s;
  text-align: center;
  height: 100%;
}

.link-card:hover {
  transform: translateY(-4px);
  background: var(--glass-bg);
  border-color: var(--accent-color);
}

.link-img {
  width: calc(80px * var(--zoom, 1));
  height: calc(80px * var(--zoom, 1));
  object-fit: contain;
}

.link-icon {
  font-size: calc(2rem * var(--zoom, 1));
  color: var(--text-secondary);
}

.link-name {
  font-size: calc(0.85rem * var(--zoom, 1));
  font-weight: 500;
  color: var(--text-primary);
}

/* Weather Bar */
.weather-bar {
  background: linear-gradient(90deg, #1e293b, #0f172a);
  padding: 1rem 2rem;
  margin: 1rem 2rem 2rem;
  border-radius: 16px;
  border: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  gap: 2rem;
  overflow-x: auto;
}

/* Foreca Widgets Base Styles */
.weather-widgets-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.weather-widget-item {
  display: inline-block;
  vertical-align: top;
}

.foreca-widget-container {
  display: inline-block;
  margin: 0 5px 10px 5px;
}

.weather-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  white-space: nowrap;
}

/* Mobile Responsiveness */
@media (max-width: 991px) {
  .navbar {
    padding: 0 1rem;
    height: auto;
    min-height: 70px;
  }

  .navbar-collapse {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem;
    z-index: 1000;
    display: none !important;
    /* Hide by default on mobile */
  }

  /* Bootstrap's show class */
  .navbar-collapse.show {
    display: flex !important;
    flex-direction: column;
  }

  .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .navbar-toggler {
    display: block;
    margin-left: auto;
  }

  .search-container {
    width: 100%;
    margin-top: 1rem;
    margin-right: 0 !important;
  }

  /* Make dropdowns static aligned and naturally scrollable on mobile */
  .dropdown-menu {
    position: static !important;
    width: 100% !important;
    max-height: 50vh;
    overflow-y: auto;
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding-left: 1rem;
    transform: none !important;
  }

  .navbar-collapse {
    max-height: 80vh;
    overflow-y: auto;
  }
}

@media (min-width: 992px) {
  .navbar-collapse {
    display: flex !important;
  }
}

/* Make Foreca widgets full width on mobile */
@media (max-width: 768px) {
  .foreca-widget-container {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 0 1rem 0;
    padding: 0 5px;
    text-align: center;
  }

  .foreca-widget-container>div,
  .foreca-widget-container iframe,
  div[id^="foreca-daily-weather-"] {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: block;
    box-sizing: border-box;
  }
}

@media (max-width: 480px) {
  .weather-widgets-wrapper {
    margin-left: -15px !important;
    margin-right: -15px !important;
    width: calc(100% + 30px);
    gap: 0;
  }
  .weather-widget-item {
    display: block;
    width: 100%;
  }
  .foreca-widget-container {
    padding: 0;
  }
  .foreca-widget-container>div,
  .foreca-widget-container iframe,
  div[id^="foreca-daily-weather-"] {
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
  }
}

/* SEARCH FILTER FIXES */
.search-hidden {
  display: none !important;
}

/* Soft hide for elements that break when display is none (like Windy map / WebGL) */
.soft-hidden {
  clip-path: inset(50% 50% 50% 50%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  visibility: visible !important;
}

/* Scroll to top -nappi */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 48px;
  height: 48px;
  background: rgba(88, 166, 255, 0.15);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(88, 166, 255, 0.35);
  border-radius: 50%;
  color: var(--accent-color);
  font-size: 1.1rem;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: background 0.25s, border-color 0.25s, transform 0.2s, box-shadow 0.25s;
  box-shadow: 0 4px 20px rgba(88, 166, 255, 0.15);
}

.back-to-top:hover {
  background: rgba(88, 166, 255, 0.3);
  border-color: var(--accent-color);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(88, 166, 255, 0.35);
  color: #fff;
}

@media (max-width: 768px) {
  .back-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }
}