/* ===== Demo Dashboard Styles ===== */

/* ===== Role Picker ===== */

.role-picker {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  background: var(--bg-dark);
}

.role-picker-inner {
  max-width: 960px;
  width: 100%;
  text-align: center;
}

.role-picker-inner h1 {
  margin-bottom: 8px;
}

.role-picker-inner .subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  margin-bottom: 48px;
}

.role-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.role-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 28px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  display: block;
}

.role-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-6px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 30px var(--accent-glow);
}

.role-card:hover .role-icon {
  background: var(--gradient-accent);
  transform: scale(1.1);
}

.role-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto 20px;
  transition: all var(--transition);
}

.role-card h3 {
  color: var(--text-heading);
  margin-bottom: 8px;
}

.role-card p {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.role-card .role-enter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

/* ===== Dashboard Layout ===== */

.dashboard {
  display: flex;
  min-height: 100vh;
}

.dash-sidebar {
  width: 260px;
  background: var(--bg-section);
  border-right: 1px solid var(--border);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.dash-sidebar-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.dash-sidebar-header .logo {
  font-size: 1.1rem;
}

.dash-role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  background: var(--accent-glow);
  padding: 4px 10px;
  border-radius: 6px;
}

.dash-nav {
  padding: 16px 0;
}

.dash-nav-group {
  margin-bottom: 8px;
}

.dash-nav-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 8px 24px;
}

.dash-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.dash-nav-item:hover {
  background: rgba(0, 212, 255, 0.04);
  color: var(--text);
}

.dash-nav-item.active {
  color: var(--accent);
  background: rgba(0, 212, 255, 0.06);
  border-left-color: var(--accent);
}

.dash-nav-item .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 1rem;
}

.dash-nav-item .nav-badge {
  margin-left: auto;
  background: rgba(255, 59, 48, 0.2);
  color: #ff3b30;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

.dash-sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
}

.dash-sidebar-footer a {
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Main content */

.dash-main {
  flex: 1;
  margin-left: 260px;
  padding: 32px;
  background: var(--bg-dark);
  min-height: 100vh;
}

.dash-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.dash-topbar h1 {
  font-size: 1.6rem;
}

.dash-topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dash-live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #34c759;
  font-weight: 600;
}

.dash-live-dot::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #34c759;
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.dash-city-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 8px;
}

/* KPI Row */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}

.kpi-card:hover {
  border-color: rgba(0, 212, 255, 0.2);
}

.kpi-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--text-heading);
  line-height: 1;
  margin-bottom: 6px;
}

.kpi-value.accent { color: var(--accent); }
.kpi-value.green { color: #34c759; }
.kpi-value.orange { color: #ff9500; }
.kpi-value.red { color: #ff3b30; }

.kpi-change {
  font-size: 0.78rem;
  font-weight: 600;
}

.kpi-change.up { color: #34c759; }
.kpi-change.down { color: #ff3b30; }
.kpi-change.neutral { color: var(--text-muted); }

/* Dashboard Grid */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.dash-grid.three {
  grid-template-columns: 1fr 1fr 1fr;
}

.dash-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition);
}

.dash-panel:hover {
  border-color: rgba(0, 212, 255, 0.15);
}

.dash-panel.full {
  grid-column: 1 / -1;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
}

.panel-tag {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: rgba(0, 212, 255, 0.06);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Mini bar chart */

.mini-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 100px;
}

.mini-bar {
  flex: 1;
  background: var(--gradient-accent);
  border-radius: 3px 3px 0 0;
  min-height: 4px;
  position: relative;
  transition: opacity var(--transition);
  opacity: 0.7;
}

.mini-bar:hover {
  opacity: 1;
}

.mini-bars-labels {
  display: flex;
  gap: 4px;
  margin-top: 8px;
}

.mini-bars-labels span {
  flex: 1;
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
}

/* Gauge / donut */

.gauge-row {
  display: flex;
  gap: 24px;
  justify-content: space-around;
}

.gauge-item {
  text-align: center;
}

.gauge-ring {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 8px;
}

.gauge-ring svg {
  position: absolute;
  transform: rotate(-90deg);
}

.gauge-ring .gauge-value {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.gauge-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Feed / list items */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.feed-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 212, 255, 0.06);
}

.feed-item:last-child {
  border-bottom: none;
}

.feed-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.feed-icon.blue { background: rgba(0, 122, 255, 0.15); }
.feed-icon.green { background: rgba(52, 199, 89, 0.15); }
.feed-icon.orange { background: rgba(255, 149, 0, 0.15); }
.feed-icon.red { background: rgba(255, 59, 48, 0.15); }
.feed-icon.purple { background: rgba(175, 82, 222, 0.15); }
.feed-icon.cyan { background: var(--accent-glow); }

.feed-text {
  min-width: 0;
}

.feed-text .title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-text .desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.feed-meta {
  text-align: right;
  white-space: nowrap;
}

.feed-meta .time {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.feed-meta .status {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
}

.status-open { background: rgba(255, 149, 0, 0.15); color: #ff9500; }
.status-progress { background: rgba(0, 122, 255, 0.15); color: #007aff; }
.status-resolved { background: rgba(52, 199, 89, 0.15); color: #34c759; }
.status-critical { background: rgba(255, 59, 48, 0.15); color: #ff3b30; }
.status-normal { background: rgba(52, 199, 89, 0.15); color: #34c759; }
.status-warning { background: rgba(255, 204, 0, 0.15); color: #ffcc00; }

/* Map placeholder */

.map-placeholder {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.03) 0%, rgba(0, 112, 201, 0.06) 100%);
  border: 1px solid var(--border);
  border-radius: 8px;
  height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.map-placeholder .map-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 212, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 212, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
}

.map-dot {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: map-blink 3s infinite;
}

.map-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid;
  border-color: inherit;
  opacity: 0.3;
  animation: map-ring 3s infinite;
}

@keyframes map-blink {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

@keyframes map-ring {
  0% { transform: scale(1); opacity: 0.3; }
  100% { transform: scale(2.5); opacity: 0; }
}

.map-label {
  position: relative;
  z-index: 1;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Bill card */

.bill-card {
  background: rgba(0, 212, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.bill-card:last-child {
  margin-bottom: 0;
}

.bill-info .bill-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-heading);
}

.bill-info .bill-period {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bill-right {
  text-align: right;
}

.bill-amount {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-heading);
}

.bill-status {
  font-size: 0.7rem;
  font-weight: 600;
}

.bill-status.paid { color: #34c759; }
.bill-status.due { color: #ff9500; }

.btn-pay {
  padding: 6px 16px;
  font-size: 0.78rem;
  border-radius: 6px;
  background: var(--gradient-accent);
  color: #fff;
  border: none;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}

.btn-pay:hover { opacity: 0.85; }

/* Air quality bar */

.aqi-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}

.aqi-segment {
  transition: flex var(--transition);
}

.aqi-bar .good { background: #34c759; }
.aqi-bar .moderate { background: #ffcc00; }
.aqi-bar .poor { background: #ff9500; }
.aqi-bar .bad { background: #ff3b30; }

.aqi-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Work order table */

.wo-table {
  width: 100%;
  border-collapse: collapse;
}

.wo-table th {
  font-size: 0.72rem;
  padding: 10px 12px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  background: none;
}

.wo-table td {
  font-size: 0.85rem;
  padding: 12px;
  border-bottom: 1px solid rgba(0, 212, 255, 0.05);
  color: var(--text-muted);
}

.wo-table td:first-child {
  color: var(--text-heading);
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.wo-priority {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
}

.wo-priority.high { background: rgba(255, 59, 48, 0.15); color: #ff3b30; }
.wo-priority.medium { background: rgba(255, 149, 0, 0.15); color: #ff9500; }
.wo-priority.low { background: rgba(52, 199, 89, 0.15); color: #34c759; }

/* Progress ring for worker */

.device-health {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.device-stat {
  text-align: center;
  padding: 16px;
  background: rgba(0, 212, 255, 0.03);
  border-radius: 10px;
}

.device-stat .dv {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.device-stat .dv.green { color: #34c759; }
.device-stat .dv.orange { color: #ff9500; }
.device-stat .dv.red { color: #ff3b30; }

.device-stat .dl {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Tabs */

.dash-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--bg-section);
  padding: 4px;
  border-radius: 8px;
  width: fit-content;
}

.dash-tab {
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}

.dash-tab.active {
  background: var(--accent-glow);
  color: var(--accent);
}

.dash-tab:hover:not(.active) {
  color: var(--text);
}

/* Mobile sidebar toggle */

.dash-mobile-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.dash-mobile-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: #fff;
  margin: 4px 0;
}

/* ===== Responsive ===== */

@media (max-width: 1024px) {
  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash-grid.three {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .role-cards {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
  }

  .dash-sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
  }

  .dash-sidebar.open {
    transform: translateX(0);
  }

  .dash-main {
    margin-left: 0;
    padding: 24px 16px;
    padding-top: 64px;
  }

  .dash-mobile-toggle {
    display: block;
  }

  .kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .dash-grid {
    grid-template-columns: 1fr;
  }

  .gauge-row {
    flex-wrap: wrap;
  }

  .device-health {
    grid-template-columns: 1fr;
  }
}
