/* WattSnap App Styles — matches landing page design tokens */
:root {
  --bg-deep: #0a0e17;
  --bg-card: #111827;
  --bg-card-hover: #1a2332;
  --accent-green: #22d67a;
  --accent-green-dim: rgba(34, 214, 122, 0.12);
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(148, 163, 184, 0.1);
  --border-active: rgba(34, 214, 122, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

/* APP LAYOUT */
.app-container {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  position: relative;
}

/* NAV */
.app-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  margin-bottom: 0.5rem;
}

.app-nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.app-nav-brand span { color: var(--accent-green); }

.app-nav-links {
  display: flex;
  gap: 0.25rem;
}

.app-nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  transition: all 0.2s;
  font-weight: 500;
}

.app-nav-links a:hover,
.app-nav-links a.active {
  color: var(--accent-green);
  background: var(--accent-green-dim);
}

/* SCANNER */
.scanner-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.scanner-upload-area {
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  border: 2px dashed transparent;
  margin: 1rem;
  border-radius: var(--radius-sm);
}

.scanner-upload-area:hover {
  border-color: var(--border-active);
  background: rgba(34, 214, 122, 0.03);
}

.scanner-upload-area.dragover {
  border-color: var(--accent-green);
  background: rgba(34, 214, 122, 0.06);
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

.upload-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.upload-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.upload-methods {
  display: flex;
  gap: 0.75rem;
  padding: 0 1rem 1rem;
}

.upload-btn {
  flex: 1;
  padding: 0.85rem;
  background: var(--accent-green-dim);
  border: 1px solid rgba(34, 214, 122, 0.2);
  border-radius: var(--radius-sm);
  color: var(--accent-green);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.upload-btn:hover {
  background: rgba(34, 214, 122, 0.18);
}

.upload-btn.primary {
  background: var(--accent-green);
  color: var(--bg-deep);
  border-color: var(--accent-green);
}

.upload-btn.primary:hover {
  background: #1ec06d;
}

/* IMAGE PREVIEW */
.image-preview {
  position: relative;
  margin: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-sm);
}

.image-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.image-preview-text {
  font-size: 0.85rem;
  color: white;
  font-weight: 500;
}

.btn-remove {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--accent-red);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  font-weight: 500;
}

/* ROOM SELECT */
.room-selector {
  padding: 0 1rem 1rem;
}

.room-selector label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  display: block;
}

.room-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.room-chip {
  padding: 0.4rem 0.85rem;
  background: rgba(148, 163, 184, 0.08);
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text-secondary);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.room-chip:hover {
  border-color: rgba(148, 163, 184, 0.25);
  color: var(--text-primary);
}

.room-chip.active {
  background: var(--accent-green-dim);
  border-color: rgba(34, 214, 122, 0.3);
  color: var(--accent-green);
}

/* SCAN BUTTON */
.scan-action {
  padding: 0 1rem 1.25rem;
}

.btn-scan {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--accent-green), #4ade80);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--bg-deep);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.2s;
  letter-spacing: -0.01em;
}

.btn-scan:hover { opacity: 0.9; }
.btn-scan:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* LOADING */
.scanning-state {
  padding: 3rem 2rem;
  text-align: center;
}

.scanning-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

.scanning-text {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
}

.scanning-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* RESULT CARD */
.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1rem;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.result-info h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.result-detail {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.result-cost {
  text-align: right;
}

.result-cost-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
}

.result-cost-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ENERGY BAR */
.energy-bar-container {
  padding: 0.75rem 1.25rem 1rem;
}

.energy-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.energy-bar {
  height: 6px;
  background: rgba(148, 163, 184, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.energy-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}

.energy-bar-fill.class-a { background: var(--accent-green); width: 14%; }
.energy-bar-fill.class-b { background: #86efac; width: 28%; }
.energy-bar-fill.class-c { background: var(--accent-amber); width: 42%; }
.energy-bar-fill.class-d { background: #fb923c; width: 57%; }
.energy-bar-fill.class-e { background: #f87171; width: 71%; }
.energy-bar-fill.class-f { background: var(--accent-red); width: 85%; }
.energy-bar-fill.class-g { background: #dc2626; width: 100%; }

/* ALTERNATIVES */
.alternatives-section {
  padding: 0 1.25rem 1.25rem;
}

.alternatives-title {
  font-size: 0.78rem;
  color: var(--accent-green);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
}

.alt-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem;
  background: rgba(34, 214, 122, 0.04);
  border: 1px solid rgba(34, 214, 122, 0.1);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

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

.alt-info h4 {
  font-size: 0.9rem;
  font-weight: 600;
}

.alt-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.alt-savings {
  text-align: right;
}

.alt-savings-value {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  color: var(--accent-green);
  font-size: 0.95rem;
}

.alt-savings-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* MY HOME DASHBOARD */
.dashboard-header {
  margin-bottom: 2rem;
}

.dashboard-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.dashboard-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.stat-card.highlight {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.04);
}

.stat-card.savings {
  border-color: rgba(34, 214, 122, 0.2);
  background: rgba(34, 214, 122, 0.04);
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card.highlight .stat-value { color: var(--accent-red); }
.stat-card.savings .stat-value { color: var(--accent-green); }

/* ROOM SECTIONS */
.room-section {
  margin-bottom: 1.5rem;
}

.room-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.room-section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
}

.room-section-cost {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent-amber);
}

.appliance-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  transition: all 0.2s;
}

.appliance-list-item:hover {
  border-color: rgba(148, 163, 184, 0.2);
}

.appliance-list-name {
  font-weight: 500;
  font-size: 0.92rem;
}

.appliance-list-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.appliance-list-cost {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
}

.appliance-list-item .btn-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  margin-left: 0.5rem;
  opacity: 0;
  transition: opacity 0.2s;
}

.appliance-list-item:hover .btn-delete {
  opacity: 1;
}

.appliance-list-item .btn-delete:hover {
  color: var(--accent-red);
}

/* COST COLORS */
.cost-high { color: var(--accent-red); }
.cost-med { color: var(--accent-amber); }
.cost-low { color: var(--accent-green); }

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-icon {
  font-size: 3.5rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.empty-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  background: var(--accent-green);
  color: var(--bg-deep);
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}

.btn-primary:hover { opacity: 0.9; }

/* TOAST */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.75rem 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-primary);
  z-index: 100;
  animation: toastIn 0.3s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
}

@keyframes toastIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* TIPS SECTION */
.tips-section {
  margin-top: 1.5rem;
}

.tips-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.tip-card {
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.tip-card strong {
  color: var(--text-primary);
}

/* HIDDEN */
.hidden { display: none !important; }

/* PAGE TRANSITIONS */
.page { animation: fadeIn 0.25s ease; }

/* RESPONSIVE TWEAKS */
@media (max-width: 380px) {
  .upload-methods { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr; }
}
