/* ===== Global Reset & Variables ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --brand-primary: #EE8E25;
  --brand-dark: #0F0F0F;
  --bg-card: #212226;
  --bg-page: #1a1a1e;
  --neutral-0: #FFFFFF;
  --neutral-10: #E9EAEA;
  --neutral-30: #B3B5B6;
  --neutral-40: #9B9E9F;
  --neutral-50: #838688;
  --neutral-60: #6C6F71;
  --neutral-80: #3C4144;
  --neutral-90: #222426;
  --success: #43C363;
  --error: #EB655E;
  --warning: #F5A623;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-pill: 100px;
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-page);
  color: var(--neutral-0);
  letter-spacing: 0.5px;
  min-height: 100vh;
}

/* ===== Top Navigation ===== */
.demo-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: #16151A;
  border-bottom: 1px solid var(--neutral-90);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 16px; }
.nav-logo { height: 16px; filter: brightness(0) invert(1); }
.nav-title { font-size: 14px; color: var(--neutral-40); }
.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--neutral-40);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.2s;
}
.nav-tab:hover { color: var(--neutral-0); background: var(--neutral-80); }
.nav-tab.active { color: var(--neutral-0); background: var(--brand-primary); }
.nav-right { display: flex; align-items: center; }
.btn-reset {
  padding: 6px 12px;
  border: 1px solid var(--neutral-60);
  background: transparent;
  color: var(--neutral-30);
  font-size: 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-reset:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

/* ===== Flow Progress Bar ===== */
.flow-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--neutral-90);
  gap: 0;
}
.flow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.4;
  transition: opacity 0.3s;
}
.flow-step.active { opacity: 1; }
.flow-step.completed { opacity: 0.7; }
.flow-step.completed .step-dot { background: var(--success); }
.step-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--neutral-60);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}
.flow-step.active .step-dot { background: var(--brand-primary); }
.flow-step span { font-size: 12px; color: var(--neutral-30); white-space: nowrap; }
.flow-step.active span { color: var(--neutral-0); }
.flow-connector {
  width: 40px;
  height: 2px;
  background: var(--neutral-60);
  margin: 0 8px;
}

/* ===== Main Content ===== */
.demo-content {
  display: flex;
  justify-content: center;
  padding: 24px;
  min-height: calc(100vh - 130px);
}
.view-panel { display: none; width: 100%; }
.view-panel.active { display: flex; justify-content: center; }

/* ===== Phone Frame (App Views) ===== */
.phone-frame {
  width: 375px;
  height: 720px;
  background: var(--brand-dark);
  border-radius: 40px;
  border: 3px solid #333;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}
.phone-status-bar {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-size: 12px;
  color: var(--neutral-0);
  flex-shrink: 0;
}
.phone-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--neutral-90);
  flex-shrink: 0;
}
.phone-header .back-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--neutral-0);
  font-size: 18px;
  cursor: pointer;
}
.phone-header .header-title {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
}
.phone-header .header-right { width: 32px; }
.phone-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}
.phone-body::-webkit-scrollbar { width: 0; }

/* ===== FleetView Frame ===== */
.fleetview-frame {
  width: 100%;
  max-width: 1200px;
  background: var(--brand-dark);
  border-radius: var(--radius-lg);
  border: 1px solid var(--neutral-90);
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.fv-header {
  height: 48px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background: #16151A;
  border-bottom: 1px solid var(--neutral-90);
}
.fv-header .fv-logo { height: 14px; filter: brightness(0) invert(1); }
.fv-header .fv-nav { margin-left: 40px; display: flex; gap: 24px; }
.fv-header .fv-nav span { font-size: 13px; color: var(--neutral-40); cursor: pointer; }
.fv-header .fv-nav span.active { color: var(--brand-primary); }
.fv-layout { display: flex; min-height: 600px; }
.fv-sidebar {
  width: 220px;
  background: #16151A;
  border-right: 1px solid var(--neutral-90);
  padding: 16px 0;
}
.fv-sidebar-item {
  padding: 10px 20px;
  font-size: 13px;
  color: var(--neutral-40);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.2s;
}
.fv-sidebar-item:hover { color: var(--neutral-0); background: rgba(255,255,255,0.03); }
.fv-sidebar-item.active {
  color: var(--brand-primary);
  background: rgba(238,142,37,0.08);
  border-right: 2px solid var(--brand-primary);
}
.fv-main { flex: 1; padding: 20px; }

/* ===== App Components ===== */
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.menu-item:hover { background: #2a2b30; }
.menu-item .item-left { display: flex; align-items: center; gap: 12px; }
.menu-item .item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.menu-item .item-title { font-size: 14px; font-weight: 500; }
.menu-item .item-subtitle { font-size: 12px; color: var(--neutral-40); margin-top: 2px; }
.menu-item .item-arrow { color: var(--neutral-50); font-size: 14px; }

.info-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 12px;
}
.info-card .card-title {
  font-size: 12px;
  color: var(--neutral-40);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--neutral-90);
}
.info-row:last-child { border-bottom: none; }
.info-row .label { font-size: 13px; color: var(--neutral-40); }
.info-row .value { font-size: 13px; color: var(--neutral-0); font-weight: 500; }

.input-field {
  width: 100%;
  padding: 10px 12px;
  background: var(--neutral-90);
  border: 1px solid var(--neutral-80);
  border-radius: var(--radius-sm);
  color: var(--neutral-0);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--brand-primary); }
.input-field::placeholder { color: var(--neutral-50); }
.input-field.has-warning { border-color: var(--warning); }

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--brand-primary);
  border: none;
  border-radius: var(--radius-lg);
  color: var(--neutral-0);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-primary:hover { background: #d67d1f; }
.btn-primary:disabled { background: var(--neutral-60); cursor: not-allowed; opacity: 0.6; }

.btn-secondary {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--neutral-60);
  border-radius: var(--radius-lg);
  color: var(--neutral-0);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--neutral-30); }

.btn-danger {
  width: 100%;
  padding: 14px;
  background: transparent;
  border: 1px solid var(--error);
  border-radius: var(--radius-lg);
  color: var(--error);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-danger:hover { background: rgba(235,101,94,0.1); }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
}
.status-badge.pending { background: rgba(245,166,35,0.15); color: var(--warning); }
.status-badge.active { background: rgba(67,195,99,0.15); color: var(--success); }
.status-badge.stopped { background: rgba(235,101,94,0.15); color: var(--error); }

.notification-banner {
  background: rgba(238,142,37,0.1);
  border: 1px solid rgba(238,142,37,0.3);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: all 0.2s;
}
.notification-banner:hover { background: rgba(238,142,37,0.15); }
.notification-banner .banner-title { font-size: 13px; font-weight: 600; color: var(--brand-primary); }
.notification-banner .banner-desc { font-size: 12px; color: var(--neutral-30); margin-top: 4px; }

/* ===== FleetView Table ===== */
.fv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.fv-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--neutral-40);
  font-weight: 500;
  border-bottom: 1px solid var(--neutral-90);
  font-size: 12px;
}
.fv-table td {
  padding: 12px;
  border-bottom: 1px solid var(--neutral-90);
  color: var(--neutral-10);
}
.fv-table tr:hover td { background: rgba(255,255,255,0.02); }

.fv-filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
}
.fv-filter-bar select, .fv-filter-bar input {
  padding: 8px 12px;
  background: var(--neutral-90);
  border: 1px solid var(--neutral-80);
  border-radius: var(--radius-sm);
  color: var(--neutral-0);
  font-size: 12px;
  outline: none;
}
.fv-stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.fv-stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.fv-stat-card .stat-label { font-size: 11px; color: var(--neutral-40); text-transform: uppercase; }
.fv-stat-card .stat-value { font-size: 24px; font-weight: 600; margin-top: 4px; }
.fv-stat-card .stat-value.orange { color: var(--brand-primary); }
.fv-stat-card .stat-value.green { color: var(--success); }
.fv-stat-card .stat-value.yellow { color: var(--warning); }
.fv-stat-card .stat-value.red { color: var(--error); }

/* ===== Dialog/Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 360px;
  width: 90%;
}
.modal-box h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.modal-box p { font-size: 13px; color: var(--neutral-30); line-height: 1.6; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn-primary, .modal-actions .btn-secondary { flex: 1; padding: 12px; font-size: 14px; }

/* ===== Animations ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.animate-in { animation: fadeIn 0.3s ease-out; }

/* ===== Checkbox ===== */
.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
}
.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-primary);
  margin-top: 2px;
  flex-shrink: 0;
}
.checkbox-row label { font-size: 12px; color: var(--neutral-30); line-height: 1.5; cursor: pointer; }

/* ===== Earnings highlight ===== */
.earnings-box {
  background: rgba(67,195,99,0.08);
  border: 1px solid rgba(67,195,99,0.2);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin: 12px 0;
}
.earnings-box .earn-title { font-size: 12px; color: var(--success); font-weight: 600; margin-bottom: 8px; }
.earnings-box .earn-item { font-size: 12px; color: var(--neutral-30); padding: 3px 0; }
.earnings-box .earn-item strong { color: var(--neutral-0); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  background: var(--success);
  color: #fff;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 300;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ===== Flow Overview ===== */
.flow-overview {
  width: 100%;
  max-width: 1000px;
  padding: 20px;
}
.flow-overview h2 {
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 8px;
}
.flow-overview .flow-subtitle {
  font-size: 13px;
  color: var(--neutral-40);
  text-align: center;
  margin-bottom: 32px;
}
.flow-diagram {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.flow-row {
  display: flex;
  align-items: stretch;
  gap: 0;
}
.flow-actor {
  width: 140px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-right: 2px solid var(--neutral-80);
}
.flow-actor.installer { color: var(--brand-primary); }
.flow-actor.cloud { color: #0EA5E9; }
.flow-actor.homeowner { color: var(--success); }
.flow-actor.powerdash { color: #A78BFA; }
.flow-action {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 14px 20px;
  gap: 12px;
  border-bottom: 1px solid var(--neutral-90);
  position: relative;
}
.flow-action::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 16px;
  height: 2px;
  background: var(--neutral-60);
  transform: translateY(-50%);
}
.flow-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.flow-step-num.s1 { background: rgba(238,142,37,0.2); color: var(--brand-primary); }
.flow-step-num.s2 { background: rgba(14,165,233,0.2); color: #0EA5E9; }
.flow-step-num.s3 { background: rgba(67,195,99,0.2); color: var(--success); }
.flow-step-num.s4 { background: rgba(14,165,233,0.2); color: #0EA5E9; }
.flow-step-num.s5 { background: rgba(167,139,250,0.2); color: #A78BFA; }
.flow-action-text { flex: 1; }
.flow-action-text .action-title { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.flow-action-text .action-desc { font-size: 11px; color: var(--neutral-40); line-height: 1.5; }
.flow-arrow-down {
  display: flex;
  justify-content: center;
  padding: 4px 0;
  margin-left: 140px;
}
.flow-arrow-down::after {
  content: '▼';
  font-size: 10px;
  color: var(--neutral-60);
}
.flow-legend {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--neutral-90);
}
.flow-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--neutral-40);
}
.flow-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}


/* ===== Phone Tab Bar ===== */
.phone-tab-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  height: 56px;
  border-top: 1px solid var(--neutral-90);
  background: #16151A;
  flex-shrink: 0;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--neutral-50);
  cursor: pointer;
  padding: 4px 12px;
  transition: color 0.2s;
}
.tab-item.active { color: var(--brand-primary); }
.tab-item span:first-child { font-size: 18px; }
