:root {
    --bg-color: #f4f4f4;
    --card-bg: #ffffff;
    --text-primary: #171a20;
    --text-secondary: #5c5e62;
    --accent-color: #FF5722;
    /* Sunns Orange */
    --success-color: #4CAF50;
    /* Green for savings */
    --font-stack: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
    --radius-l: 20px;
    --radius-m: 12px;
    --spacing-xs: 8px;
    --spacing-s: 16px;
    --spacing-m: 24px;
    --spacing-l: 40px;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--card-bg);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-s) var(--spacing-l);
    background: transparent;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 10;
}

.logo {
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 14px;
}

.header nav {
    display: none;
    /* Mobile first hidden, or just simplify for widget */
}


@media (min-width: 768px) {
    .header nav {
        display: flex;
        gap: var(--spacing-m);
    }

    .header nav a {
        text-decoration: none;
        color: var(--text-primary);
        font-weight: 500;
        font-size: 14px;
        transition: color 0.2s;
    }

    .header nav a:hover {
        color: var(--text-secondary);
    }
}

.user-actions {
    display: flex;
    gap: var(--spacing-s);
    cursor: pointer;
}

/* Main Layout */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    min-height: 100vh;
    padding-top: 80px;
    /* Space for header */
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

/* Typography */
h1.main-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: var(--spacing-m);
}

h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-s);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-l);
}

/* Cards & Panels */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-m);
    margin-bottom: var(--spacing-l);
}

.kpi-card {
    background: var(--card-bg);
    padding: var(--spacing-m);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-soft);
    /* Added soft shadow */
}

.kpi-value {
    font-size: 28px;
    font-weight: 600;
    margin: var(--spacing-xs) 0;
}

.kpi-sub {
    font-size: 12px;
    color: var(--text-secondary);
}

.chart-wrapper {
    background: var(--card-bg);
    padding: var(--spacing-m);
    border: none;
    /* Removed border */
    box-shadow: var(--shadow-soft);
    /* Added soft shadow */
    border-radius: var(--radius-m);
}

.chart-wrapper canvas {
    max-height: 300px;
}

/* Controls */
.controls-panel {
    background: var(--bg-color);
    /* Slightly distinct generic background */
    padding: var(--spacing-m);
    border-radius: var(--radius-l);
    height: fit-content;
}

/* Sticky on desktop */
@media (min-width: 1024px) {
    .controls-panel {
        position: sticky;
        top: 100px;
        border-left: 1px solid #eee;
        height: auto;
    }
}

.control-group {
    margin-bottom: var(--spacing-l);
}

.control-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

/* Inputs styling */
.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
}

.input-wrapper span {
    color: var(--text-secondary);
    margin-right: 4px;
}

.input-wrapper input {
    border: none;
    background: transparent;
    font-size: 16px;
    width: 100%;
    outline: none;
    font-family: var(--font-stack);
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Slider */
.tesla-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #d0d0d0;
    outline: none;
    margin-top: 10px;
}

.tesla-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--card-bg);
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    border: 1px solid #d0d0d0;
    transition: transform 0.1s;
}

.tesla-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Select */
.select-wrapper select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: none;
    background: var(--bg-color);
    font-size: 16px;
    font-family: var(--font-stack);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    /* Custom arrow would need SVG */
}

/* Summary Box */
.summary-box {
    background: var(--bg-color);
    padding: var(--spacing-m);
    border-radius: var(--radius-m);
    margin-bottom: var(--spacing-l);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-row.total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

/* Button */
.cta-button {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 50px;
    /* Pill shape */
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(255, 87, 34, 0.3);
}

.cta-button:hover {
    opacity: 0.95;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 87, 34, 0.4);
}

--shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.05);
--radius-l: 20px;
--radius-m: 12px;
--spacing-xs: 8px;
--spacing-s: 16px;
--spacing-m: 24px;
--spacing-l: 40px;
}

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

body {
    font-family: var(--font-stack);
    background-color: var(--card-bg);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-s) var(--spacing-l);
    background: transparent;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 10;
}

.logo {
    font-weight: 700;
    letter-spacing: 2px;
    font-size: 14px;
}

.header nav {
    display: none;
    /* Mobile first hidden, or just simplify for widget */
}

@media (min-width: 768px) {
    .header nav {
        display: flex;
        gap: var(--spacing-m);
    }

    .header nav a {
        text-decoration: none;
        color: var(--text-primary);
        font-weight: 500;
        font-size: 14px;
        transition: color 0.2s;
    }

    .header nav a:hover {
        color: var(--text-secondary);
    }
}

.user-actions {
    display: flex;
    gap: var(--spacing-s);
    cursor: pointer;
}

/* Main Layout */
.app-container {
    max-width: 1440px;
    margin: 0 auto;
    min-height: 100vh;
    padding-top: 80px;
    /* Space for header */
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-l);
    padding: var(--spacing-m);
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
        /* Results wide, Controls narrow */
        min-height: calc(100vh - 80px);
        align-items: start;
    }
}

/* Typography */
h1.main-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: var(--spacing-m);
}

h3 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-s);
}

.subtitle {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-l);
}

/* Cards & Panels */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-m);
    margin-bottom: var(--spacing-l);
}

.kpi-card {
    background: var(--card-bg);
    padding: var(--spacing-m);
    border-radius: var(--radius-m);
    box-shadow: var(--shadow-soft);
    /* Added soft shadow */
}

/* ... */

.chart-wrapper {
    background: var(--card-bg);
    padding: var(--spacing-m);
    border: none;
    /* Removed border */
    box-shadow: var(--shadow-soft);
    /* Added soft shadow */
    border-radius: var(--radius-m);
}

.chart-wrapper canvas {
    max-height: 300px;
}

/* Controls Panel (Right) */
.controls-panel {
    background: var(--card-bg);
    padding: var(--spacing-l);
    /* Stickiness for desktop */
    position: relative;
}

@media (min-width: 1024px) {
    .controls-panel {
        position: sticky;
        top: 100px;
        border-left: 1px solid #eee;
        height: auto;
    }
}

.control-group {
    margin-bottom: var(--spacing-l);
}

.control-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-xs);
}

/* Inputs styling */
.input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 16px;
}

.input-wrapper span {
    color: var(--text-secondary);
    margin-right: 4px;
}

.input-wrapper input {
    border: none;
    background: transparent;
    font-size: 16px;
    width: 100%;
    outline: none;
    font-family: var(--font-stack);
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

/* Slider */
.tesla-slider {
    width: 100%;
    -webkit-appearance: none;
    height: 4px;
    border-radius: 2px;
    background: #d0d0d0;
    outline: none;
    margin-top: 10px;
}

.tesla-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--card-bg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    border: 1px solid #d0d0d0;
    transition: transform 0.1s;
}

.tesla-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 5px;
    font-weight: 600;
}

/* Select */
.select-wrapper select {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: none;
    background: var(--bg-color);
    font-size: 16px;
    font-family: var(--font-stack);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    /* Custom arrow would need SVG */
}

/* Summary Box */
.summary-box {
    background: var(--bg-color);
    padding: var(--spacing-m);
    border-radius: var(--radius-m);
    margin-bottom: var(--spacing-l);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text-secondary);
}

.summary-row.total {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 16px;
}

/* Button */
.cta-button {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 4px;
    /* Tesla uses slightly rounded/sharp buttons */
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.cta-button:hover {
    opacity: 0.9;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none;
    /* simple hide */
}

.modal-card {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 400px;
    text-align: left;
    animation: slideUp 0.4s ease-out;
}

.modal-card.wide {
    max-width: 500px;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    background: #f9f9f9;
    outline: none;
    transition: border 0.2s;
}

.form-group input:focus {
    border-color: var(--accent-color);
    background: white;
}

/* Tabs for Installation Type */
.tabs {
    display: flex;
    background: #e0e0e0;
    padding: 4px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: 8px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.tab.active {
    background: white;
    color: var(--text-primary);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Pricing Summary Utils */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
}

.price-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    font-size: 15px;
}

.price-row.total {
    border-bottom: none;
    font-weight: 700;
    font-size: 20px;
    margin-top: 10px;
}

.highlight-text {
    font-weight: 500;
}

.divider {
    border: 0;
    border-top: 1px solid #eee;
    margin: 10px 0;
}

.due-today {
    background: #f4f4f4;
    padding: 16px;
    border-radius: 12px;
    margin: 20px 0;
}

.due-today .price-row {
    border: none;
    padding: 0;
    font-weight: 600;
    font-size: 18px;
}

.disclaimer {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.small-text {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: center;
    margin-top: 12px;
}

/* WhatsApp Input Styling */

/* Radio Group for Project Type */
.radio-group {
    display: flex;
    gap: 10px;
}

.radio-label {
    flex: 1;
    cursor: pointer;
}

.radio-label input {
    display: none;
}

.radio-button {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.radio-label input:checked+.radio-button {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.phone-input-group {
    display: flex;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    transition: border-color 0.3s;
}

.phone-input-group:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.prefix {
    background: #f9f9f9;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-right: 1px solid #ddd;
    color: #555;
    font-weight: 500;
}

#lead-phone {
    border: none;
    border-radius: 0;
    margin-bottom: 0;
}

/* End Phone Input Styles */
.phone-input-group input {
    border: none;
    border-radius: 0;
    background: transparent;
    padding: 12px;
    width: 100%;
    outline: none;
}

.phone-input-group input:focus {
    background: transparent;
}

/* Dashboard v2.0: 4-Quadrant Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

.results-panel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 300px 300px;
    gap: 20px;
}

.quadrant {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Q1: Video */
.video-quadrant {
    padding: 0;
    border: none;
}

.hero-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay {
    position: absolute;
    bottom: 20px;
    left: 20px;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* Q2: KPIs */
.kpi-quadrant {
    justify-content: center;
    gap: 20px;
}

/* Q3/Q4: Charts */
.chart-quadrant h3 {
    margin-bottom: 10px;
    font-size: 16px;
    color: var(--text-secondary);
}

.chart-box {
    flex: 1;
    position: relative;
    width: 100%;
}

/* Battery Selector (Pills) */
.battery-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.battery-pill {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.battery-pill:hover {
    border-color: #bbb;
}

.battery-pill.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px var(--accent-color) inset;
    color: var(--accent-color);
    font-weight: 700;
}

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

    .results-panel-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
}

/* Mobile Modal Enhancements */
@media (max-width: 768px) {
    .modal-card {
        padding: 20px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .modal-header {
        margin-bottom: 20px;
    }

    h2 {
        font-size: 18px;
    }
}