/* Energy Monitoring - Smart Home Dashboard Styles */

:root {
  --primary: #10b981;
  --primary-dark: #059669;
  --secondary: #3b82f6;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;
  --background: #0f172a;
  --surface: #1e293b;
  --surface-light: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
  --gradient-surface: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  
  /* Shadows */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  
  /* Border radius */
  --radius: 12px;
  --radius-lg: 16px;
  
  /* Transitions */
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--background);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 28px;
}

.logo-text {
  font-size: 20px;
  font-weight: 600;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.connection-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 20px;
  font-size: 14px;
}

.connection-status.online .status-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: var(--surface-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

/* Dashboard Grid */
.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

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

.card-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Power Meter */
.power-meter {
  grid-column: span 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: center;
}

.meter-display {
  text-align: center;
}

.meter-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
}

.meter-value .value {
  font-size: 64px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.meter-value .unit {
  font-size: 24px;
  color: var(--text-muted);
}

.meter-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.meter-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.1);
  border-radius: 20px;
  color: var(--success);
  font-size: 13px;
}

.meter-ring {
  display: flex;
  justify-content: center;
}

.meter-ring svg {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface-light);
  stroke-width: 12;
}

.ring-fill {
  fill: none;
  stroke: url(#gradient);
  stroke-width: 12;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--surface-light);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

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

.stat-card.green .stat-value { color: var(--success); }
.stat-card.blue .stat-value { color: var(--secondary); }
.stat-card.yellow .stat-value { color: var(--warning); }

/* Devices Section */
.devices-section {
  grid-column: span 2;
}

.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.device-card {
  background: var(--surface-light);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: var(--transition);
}

.device-card:hover {
  background: rgba(59, 130, 246, 0.1);
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.device-icon {
  font-size: 24px;
}

.device-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.device-status.offline {
  background: var(--danger);
}

.device-name {
  font-size: 14px;
  font-weight: 500;
}

.device-power {
  font-size: 20px;
  font-weight: 600;
  color: var(--primary);
}

.device-power span {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Charts */
.chart-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  grid-column: span 2;
}

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

.chart-title {
  font-size: 18px;
  font-weight: 600;
}

.chart-tabs {
  display: flex;
  gap: 8px;
}

.chart-tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: var(--transition);
}

.chart-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.chart-canvas {
  width: 100%;
  height: 300px;
}

/* Usage Breakdown */
.usage-section {
  grid-column: span 1;
}

.usage-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.usage-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.usage-icon {
  width: 40px;
  height: 40px;
  background: var(--surface-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.usage-info {
  flex: 1;
}

.usage-name {
  font-size: 14px;
  font-weight: 500;
}

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

.usage-bar {
  width: 100px;
  height: 6px;
  background: var(--surface-light);
  border-radius: 3px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* Subscription Tiers */
.subscription-section {
  grid-column: span 2;
  background: var(--gradient-surface);
}

.subscription-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 20px;
}

.subscription-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
  transition: var(--transition);
  border: 2px solid transparent;
}

.subscription-card:hover {
  border-color: var(--primary);
  transform: translateY(-4px);
}

.subscription-card.featured {
  border-color: var(--primary);
  position: relative;
}

.subscription-card.featured::before {
  content: 'Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  padding: 4px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.subscription-name {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.subscription-price {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 4px;
}

.subscription-price span {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

.subscription-features {
  list-style: none;
  margin: 20px 0;
  text-align: left;
}

.subscription-features li {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

.subscription-features li::before {
  content: '✓';
  color: var(--success);
  font-weight: bold;
}

.subscription-btn {
  width: 100%;
  padding: 12px;
  background: var(--surface-light);
  border: none;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.subscription-card.featured .subscription-btn {
  background: var(--gradient-primary);
}

.subscription-btn:hover {
  transform: translateY(-2px);
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 24px;
}

/* Responsive */
@media (max-width: 768px) {
  .power-meter {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  .meter-ring {
    display: none;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .devices-section,
  .chart-container,
  .subscription-section {
    grid-column: span 1;
  }
  
  .subscription-grid {
    grid-template-columns: 1fr;
  }
}
