/* EcoSmartHomes Dashboard Stylesheet */
:root {
  --primary-deep: #003f2d;
  --primary-dark: #002d20;
  --accent-emerald: #10b981;
  --accent-green: #00a86b;
  --accent-light: #e6f4ef;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --bg-soft: #f8fafc;
  --card-bg: #ffffff;
  --code-bg: #1e293b;
  --border-color: #e2e8f0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-soft);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  line-height: 1.6;
}

/* Dashboard Header Banner */
.dashboard-header {
  background: linear-gradient(135deg, var(--primary-deep) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 60px 20px 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 63, 45, 0.2);
}

.dashboard-header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 200%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, transparent 60%);
  pointer-events: none;
}

.dashboard-title-wrapper {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

.dashboard-logo-icon {
  width: 56px;
  height: 56px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.dashboard-header h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.dashboard-header p.tagline {
  font-size: 1.15rem;
  color: #a7f3d0;
  margin: 0;
  font-weight: 400;
}

/* Main Dashboard Container */
.dashboard-container {
  max-width: 1200px;
  margin: -30px auto 60px;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

/* Section Titles */
.section-title-wrapper {
  margin: 45px 0 25px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-badge {
  background: var(--accent-light);
  color: var(--primary-deep);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.section-title-wrapper h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.75rem;
  color: var(--primary-deep);
  margin: 0;
  font-weight: 700;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.kpi-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 28px 24px;
  border: 1px solid var(--border-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.kpi-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(0, 63, 45, 0.1);
  border-color: var(--accent-emerald);
}

.kpi-icon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: #ecfdf5;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.kpi-tooltip-trigger {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
  background: #f1f5f9;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.kpi-tooltip-trigger:hover {
  background: var(--primary-deep);
  color: white;
}

.kpi-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-metric {
  font-family: 'Outfit', sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--primary-deep);
  line-height: 1.1;
  margin-bottom: 12px;
}

.kpi-metric-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-green);
  background: #f0fdf4;
  padding: 4px 10px;
  border-radius: 12px;
  display: inline-block;
  margin-bottom: 12px;
}

.kpi-description {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: auto;
  line-height: 1.5;
}

/* Tooltip Popup Box */
.tooltip-popup {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 0.82rem;
  padding: 14px;
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  z-index: 100;
  margin-bottom: 10px;
  line-height: 1.4;
}

.tooltip-popup::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 6px;
  border-style: solid;
  border-color: #0f172a transparent transparent transparent;
}

.kpi-card:hover .tooltip-popup.active,
.kpi-tooltip-trigger:hover + .tooltip-popup {
  display: block;
}

/* ROI Mini Bar Chart */
.roi-chart-container {
  margin-top: 12px;
}

.roi-chart-row {
  margin-bottom: 10px;
}

.roi-chart-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text-main);
}

.roi-bar-bg {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.roi-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #00a86b 100%);
  border-radius: 4px;
  transition: width 0.8s ease-in-out;
}

/* Section 2: Code Accordions & Simulators */
.accordion-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.accordion-panel {
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border-color);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
  transition: border-color 0.25s, box-shadow 0.25s;
}

.accordion-panel.open {
  border-color: var(--accent-emerald);
  box-shadow: 0 8px 24px rgba(0, 63, 45, 0.08);
}

.accordion-header {
  padding: 20px 24px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.accordion-header:hover {
  background: #f8fafc;
}

.accordion-title-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.accordion-number {
  background: var(--primary-deep);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.accordion-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.2rem;
  margin: 0;
  color: var(--primary-deep);
  font-weight: 600;
}

.accordion-icon {
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.accordion-panel.open .accordion-icon {
  transform: rotate(180deg);
  color: var(--accent-green);
}

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0, 1, 0, 1);
  background: #fdfdfd;
  border-top: 1px solid transparent;
}

.accordion-panel.open .accordion-content {
  max-height: 1000px;
  border-top-color: var(--border-color);
  transition: max-height 0.5s ease-in-out;
}

.accordion-inner {
  padding: 24px;
}

/* Formula Code Box */
.code-box {
  background: var(--code-bg);
  color: #f1f5f9;
  border-radius: 12px;
  padding: 18px 22px;
  font-family: 'Fira Code', 'Courier New', monospace;
  font-size: 0.95rem;
  margin-bottom: 20px;
  overflow-x: auto;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.3);
  line-height: 1.5;
}

.code-var { color: #38bdf8; font-weight: 600; }
.code-op { color: #f43f5e; font-weight: 600; }
.code-func { color: #a855f7; }
.code-num { color: #fbbf24; }
.code-comment { color: #64748b; font-style: italic; }

.formula-explainer {
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.6;
  background: #f8fafc;
  padding: 16px 20px;
  border-radius: 10px;
  border-left: 4px solid var(--accent-emerald);
}

/* Interactive Simulators inside Accordions */
.sim-container {
  margin-top: 20px;
  background: #ffffff;
  padding: 20px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.sim-slider-group {
  margin-bottom: 15px;
}

.sim-slider-label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 8px;
}

.sim-slider {
  width: 100%;
  accent-color: var(--accent-green);
  height: 8px;
  cursor: pointer;
}

.sim-result-box {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  padding: 16px 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 15px;
}

.sim-result-title {
  font-weight: 600;
  color: var(--primary-deep);
}

.sim-result-value {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-green);
}

/* Payback Form Controls */
.payback-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 15px;
}

@media (max-width: 600px) {
  .payback-grid { grid-template-columns: 1fr; }
}

.input-group label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.input-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  box-sizing: border-box;
}

.input-group input:focus {
  outline: none;
  border-color: var(--accent-green);
  box-shadow: 0 0 0 3px rgba(0, 168, 107, 0.15);
}

.payback-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  background: #dcfce7;
  color: #166534;
}

/* Dashboard Footer Accent */
.dashboard-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 40px 20px 20px;
  text-align: center;
  position: relative;
  margin-top: 80px;
}

.dashboard-footer::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #10b981 0%, #00a86b 50%, #059669 100%);
}

.dashboard-footer p.protocol {
  font-family: 'Fira Code', monospace;
  font-size: 0.9rem;
  color: #a7f3d0;
  margin-bottom: 20px;
}

.dashboard-footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 25px;
}

.dashboard-footer-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.92rem;
  transition: color 0.2s;
}

.dashboard-footer-links a:hover {
  color: var(--accent-emerald);
}
