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

:root {
  --bg-color: #f3f4f6;
  --card-bg: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --radius: 12px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* Test Data Banner */
.test-banner {
  display: none;
  background-color: var(--orange);
  color: white;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
}

.test-banner.visible {
  display: block;
}

.dashboard {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-left {
  font-size: 14px;
  color: var(--text-primary);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--text-muted);
}

.status-dot.status-ok {
  background-color: var(--green);
}

.status-dot.status-stale {
  background-color: var(--orange);
}

.status-dot.status-error {
  background-color: var(--red);
}

.time-display {
  font-weight: 600;
}

.separator {
  color: var(--text-muted);
}

.date-display {
  color: var(--text-secondary);
}

.header-center {
  font-size: 14px;
  color: var(--text-secondary);
}

.weather-icon {
  flex-shrink: 0;
}

.weather-temp {
  color: var(--text-primary);
}

.aqi {
  color: var(--text-secondary);
}

.header-right {
  font-size: 14px;
  color: var(--text-secondary);
}

.next-event {
  color: var(--text-primary);
}

.chevron-icon {
  flex-shrink: 0;
}

/* Widgets Grid */
.widgets-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Widget Card */
.widget {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.widget-icon {
  flex-shrink: 0;
}

.icon-green {
  color: var(--green);
}

.icon-orange {
  color: var(--orange);
}

.icon-gray {
  color: var(--text-muted);
}

.widget-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

.widget-content {
  display: flex;
  flex-direction: column;
}

/* Backup Widget */
.backup-content {
  justify-content: flex-start;
}

.backup-status {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Disk Widget */
.disk-content {
  align-items: stretch;
  text-align: left;
}

.disk-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.disk-bar-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.disk-bar-label {
  font-size: 13px;
  color: var(--text-secondary);
  width: 50px;
  flex-shrink: 0;
}

.disk-bar {
  flex: 1;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.disk-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}

.server-fill {
  background-color: var(--green);
}

.media-fill {
  background-color: var(--orange);
}

.disk-bar-pct {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  width: 36px;
  text-align: right;
}

.backup-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border-color);
}

.backup-icon {
  font-size: 14px;
  font-weight: 600;
}

.backup-icon.backup-ok {
  color: var(--green);
}

.backup-icon.backup-error {
  color: var(--red);
}

.backup-text {
  font-size: 13px;
  color: var(--text-secondary);
}

.backup-text.backup-error {
  color: var(--red);
}

/* AWS Widget */
.aws-content {
  justify-content: flex-start;
}

.aws-amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.amount-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}

.amount-details {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Traffic Widget */
.traffic-content {
  justify-content: flex-start;
}

.traffic-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.traffic-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}

.traffic-site-name {
  font-size: 13px;
  color: var(--text-secondary);
}

.traffic-sites {
  font-size: 13px;
  color: var(--text-secondary);
  list-style: none;
}

.traffic-sites li {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.site-name {
  color: var(--text-secondary);
}

.site-visits {
  font-weight: 500;
  color: var(--text-primary);
}

/* VTSAX Widget */
.vtsax-content {
  justify-content: flex-start;
}

.vtsax-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 4px;
}

.price-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
}

.price-label {
  font-size: 14px;
  color: var(--text-secondary);
}

.vtsax-change {
  font-size: 14px;
  font-weight: 500;
}

.vtsax-change.positive {
  color: var(--green);
}

.vtsax-change.negative {
  color: var(--red);
}

/* Joke Widget */
.joke-content {
  justify-content: flex-start;
}

.joke-setup {
  font-size: 14px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.joke-punchline {
  font-size: 14px;
  color: var(--text-secondary);
  font-style: italic;
}

/* Year Progress Widget */
.year-content {
  align-items: center;
  text-align: center;
}

.year-percent {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background-color: var(--green);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.year-label {
  font-size: 13px;
  color: var(--text-muted);
}

/* Footer */
.footer {
  display: flex;
  justify-content: flex-end;
  padding: 16px 0;
  margin-top: 24px;
}

.updated-text {
  font-size: 12px;
  color: var(--text-muted);
}

/* Responsive - Tablet */
@media (max-width: 899px) {
  .widgets-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Responsive - Mobile */
@media (max-width: 599px) {
  .dashboard {
    padding: 16px;
  }

  .header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-left,
  .header-center,
  .header-right {
    width: 100%;
  }

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

  .widget {
    padding: 16px;
  }
}

/* Widget States */
.widget.stale {
  opacity: 0.7;
}

.widget.stale .widget-title::after {
  content: ' (stale)';
  font-size: 11px;
  color: var(--orange);
}

.widget.error {
  border-color: var(--red);
}

.widget.error .widget-content::after {
  content: 'Data unavailable';
  display: block;
  color: var(--red);
  font-size: 12px;
  margin-top: 8px;
}

.widget.loading .widget-content {
  opacity: 0.5;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--border-color) 25%, #f9fafb 50%, var(--border-color) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
  border-radius: 4px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
