/* Section Layout */
.container {
  max-width: min(1600px, 95%);
  margin: 0 auto;
  padding: 4rem 2rem;
}

#chart .container,
#history .container {
  width: 80vw !important;
}

section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* Nav */
#main-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  transition: background 0.3s ease;
}

.nav-container {
  max-width: min(1600px, 95%);
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


.device-info-col {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.custom-dropdown {
  position: relative;
  min-width: 220px;
  user-select: none;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  background: rgba(168, 85, 247, 0.05);
  border: 1px solid rgba(168, 85, 247, 0.2);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-trigger:hover {
  background: rgba(168, 85, 247, 0.1);
  border-color: var(--color-accent);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.1);
}

.trigger-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}

#selected-device-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}

#selected-device-location {
  font-size: 0.65rem;
  color: var(--color-grey-3);
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

.dropdown-trigger .arrow {
  margin-left: 1.5rem;
  font-size: 0.5rem;
  color: var(--color-accent);
  transition: transform 0.3s ease;
}

.custom-dropdown.active .dropdown-trigger .arrow {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 0;
  width: 100%;
  background: rgba(13, 13, 13, 0.95);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.2rem;
  max-height: 400px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  animation: dropdown-fade-in 0.2s ease-out;
  scrollbar-width: thin;
  scrollbar-color: rgba(168, 85, 247, 0.3) transparent;
}

.dropdown-menu::-webkit-scrollbar {
  width: 5px;
}

.dropdown-menu::-webkit-scrollbar-track {
  background: transparent;
}

.dropdown-menu::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.2);
  border-radius: 10px;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

@keyframes dropdown-fade-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.custom-dropdown.active .dropdown-menu {
  display: flex;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.dropdown-item.selected {
  background: rgba(168, 85, 247, 0.1);
}

.dropdown-item .item-meta {
  display: flex;
  flex-direction: column;
}

.dropdown-item .item-name {
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
}

.dropdown-item .item-location {
  font-size: 0.75rem;
  color: var(--color-grey-3);
}

.dropdown-item .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--aq-good);
  box-shadow: 0 0 10px var(--aq-good);
}

.status-dot.offline {
  background: var(--color-grey-3);
}

#device-location {
  font-size: 0.75rem;
  color: var(--color-grey-2);
  margin-left: 0.2rem;
  margin-top: 0.2rem;
  opacity: 0.6;
}

.nav-controls-group {
  display: flex;
  align-items: center;
  gap: 3rem;
}

/* Removed standard select styles */

.nav-links a {
  text-decoration: none;
  color: var(--color-grey-2);
  margin-left: 2rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--color-accent);
}

.nav-links .accent-link {
  color: var(--color-accent);
  border: 1px solid var(--color-accent);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
}

.fs-link-btn {
  background: var(--color-accent);
  color: #fff;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-left: 2rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.2);
}

.fs-link-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(168, 85, 247, 0.3);
  opacity: 0.95;
}

/* Hero - Section 1 */
#now {
  position: relative;
  background: radial-gradient(circle at center, rgba(168, 85, 247, 0.05) 0%, transparent 70%);
}

#now h1 {
  font-size: 3rem;
  color: var(--color-grey-1);
  text-align: center;
  margin-bottom: 1rem;
}

.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--color-grey-2);
}

.indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--aq-good);
}

.status-online .indicator {
  background: var(--aq-good);
  box-shadow: 0 0 10px var(--aq-good);
  animation: pulse 2s infinite;
}

.status-offline .indicator {
  background: var(--aq-critical);
  box-shadow: 0 0 10px var(--aq-critical);
  animation: pulse-red 2s infinite;
}

.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  grid-template-areas:
    "temp hum"
    "wide status";
}

@media (max-width: 900px) {
  .live-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "temp"
      "hum"
      "wide"
      "status";
  }
}

#card-temperature {
  grid-area: temp;
}

#card-humidity {
  grid-area: hum;
}

#card-aq {
  grid-area: wide;
}

#card-aq-status {
  grid-area: status;
}

.data-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 20px var(--color-accent-glow);
}

.monumental .value {
  font-size: 6rem;
  font-weight: 900;
  color: #fff;
}

.monumental .unit {
  font-size: 2rem;
  color: var(--color-grey-3);
  margin-left: 0.5rem;
}

.data-card label {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  color: var(--color-grey-3);
  margin-bottom: 0.5rem;
}

.description {
  font-size: 0.9rem;
  color: var(--color-grey-3);
  font-style: italic;
  margin-top: 1rem;
}

.wide {
  grid-area: wide;
}

.aq-content {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.aq-value-main .value {
  font-size: 4rem;
  font-weight: 900;
}

.sparkline-container {
  flex-grow: 1;
  color: var(--color-accent);
}

.status-box {
  background: rgba(34, 197, 94, 0.05);
  border: 1px solid rgba(34, 197, 94, 0.1);
  padding: 2rem;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: all 1.5s ease;
  height: 100%;
}

.status-box-card {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
}

.status-box h2 {
  font-size: 2.5rem;
  color: var(--aq-good);
}

/* Progress-bar */
.progress-bar-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.05);
}

.progress-bar {
  height: 100%;
  width: 100%;
  background: var(--color-accent);
  transform-origin: left;
}

/* Section 2: History */
#history {
  background: #0d0d0d;
}

.tabs-container {
  margin: 3rem 0;
}

.tabs {
  display: flex;
  gap: 1.5rem;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--color-grey-2);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.3s;
}

.tab-btn.active {
  color: #fff;
}

.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -0.6rem;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-accent);
}

.tab-meta {
  margin-top: 1rem;
  color: var(--color-grey-3);
  font-style: italic;
}

.table-wrapper {
  position: relative;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.data-table {
  display: flex;
  flex-direction: column;
}

.table-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  padding: 1.2rem;
  border-bottom: 1px solid var(--color-border);
  transition: transform 0.2s, background 0.2s;
}

.table-row:last-child {
  border-bottom: none;
}

.table-row:hover {
  background: rgba(168, 85, 247, 0.05);
  transform: translateX(4px);
}

.row-index {
  color: var(--color-grey-3);
  font-weight: 500;
}

.row-time {
  color: var(--color-grey-2);
}

.row-value {
  font-family: var(--font-display);
  text-align: right;
  font-weight: 700;
}

.status-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.8rem;
  display: inline-block;
  font-weight: 700;
}

/* Section 3: Chart */
.chart-container {
  background: var(--color-surface);
  padding: 3rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  box-shadow: 0 0 50px var(--color-accent-glow);
  height: 60vh;
  min-height: 500px;
}

/* Footer */
footer {
  padding: 4rem 0;
  text-align: center;
}

.footer-line {
  height: 1px;
  background: var(--color-accent);
  opacity: 0.2;
  margin-bottom: 2rem;
}

footer p {
  color: var(--color-grey-3);
  font-size: 0.8rem;
}

/* Controls */
.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.limit-selector {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--color-grey-2);
}

.limit-options {
  display: flex;
  gap: 0.5rem;
}

.limit-btn {
  background: var(--color-grey-4);
  border: 1px solid var(--color-border);
  color: var(--color-grey-2);
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.limit-btn.active {
  background: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}

.refresh-btn {
  background: none;
  border: 1px solid var(--color-accent);
  color: var(--color-accent);
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-btn:hover {
  background: var(--color-accent);
  color: #fff;
}

/* Status Colors for Status Box and Badges */
.aq-1 {
  background-color: rgba(34, 197, 94, 0.12);
  border-color: var(--aq-good);
  color: var(--aq-good);
}

.aq-2 {
  background-color: rgba(234, 179, 8, 0.12);
  border-color: var(--aq-low);
  color: var(--aq-low);
}

.aq-3 {
  background-color: rgba(249, 115, 22, 0.12);
  border-color: var(--aq-high);
  color: var(--aq-high);
}

.aq-4 {
  background-color: rgba(239, 68, 68, 0.12);
  border-color: var(--aq-critical);
  color: var(--aq-critical);
}

.badge-1 {
  background-color: var(--aq-good);
  color: #000;
}

.badge-2 {
  background-color: var(--aq-low);
  color: #000;
}

.badge-3 {
  background-color: var(--aq-high);
  color: #000;
}

.badge-4 {
  background-color: var(--aq-critical);
  color: #fff;
}

#nordvekst-link {
  color: var(--color-accent);
  text-decoration: none;
}