:root {
    --font-heading: 'Fredoka', sans-serif;
    --primary-accent: #049f82;
    --light-teal: #ddfdf7;
    --slate-gray: #474848;
    --jet-black: #131313;
    --off-white: #fafbfb;
}

body {
    font-family: sans-serif;
    margin: 0;
    background-color: var(--off-white);
    color: var(--jet-black);
}

h1, h2, h3, h4, h5, h6, .section-title, .main-nav a, .slider-container label {
    font-family: var(--font-heading);
}

.hero-section-container {
    background-image: url('main page.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    color: #fafbfb;
}

.hero-section-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    position: relative;
    z-index: 1;
}

.logo img {
    height: 40px;
}

.main-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 2rem;
}

.main-nav a {
    color: #fafbfb;
    text-decoration: none;
    letter-spacing: 0.1em;
    font-size: 0.9rem;
}

.header-actions .btn-secondary {
    border: 1px solid #fafbfb;
    color: #fafbfb;
}

.hero-content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem;
    position: relative;
    z-index: 1;
    flex-grow: 1;
    align-items: center;
}

.hero-text {
    text-align: left;
    max-width: 50%;
}

.hero-text h1 {
    font-size: 4rem;
    font-weight: 900;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-text p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
}

.forward-banner {
    background-color: #049f82;
    color: #fafbfb;
    padding: 4rem 2rem;
}

.forward-banner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.forward-banner-text h2 {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.2;
    color: #fafbfb;
}

.forward-banner-description p {
    line-height: 1.6;
}

.calculator-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
}

.card {
    background-color: #ffffff;
    border: 1px solid #ddfdf7;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h2 {
    color: #049f82;
    margin-top: 0;
}

.config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
}

#panel-wattage {
    width: 100%;
    max-width: 100px;
    padding: 0.5rem;
    border: 1px solid #474848;
    border-radius: 4px;
    font-size: 1rem;
}

.slider-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.slider-wrapper {
    position: relative;
    width: 100%;
    margin-top: 40px; /* space for the badge above the slider */
}

#panel-count {
    position: absolute;
    bottom: 18px; /* Positioned directly above the track with a precise 2px gap under the bottom tip of the arrow */
    transform: translateX(-50%);
    background-color: var(--primary-accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: auto; /* Enable dragging directly from the badge */
    cursor: grab;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    z-index: 5;
    font-family: var(--font-heading);
    user-select: none; /* Prevent text selection during drag */
    -webkit-user-select: none;
}

#panel-count:active {
    cursor: grabbing;
}

#panel-count::before {
    content: '';
    position: absolute;
    top: 100%; /* Arrow is at the BOTTOM of the badge, pointing DOWN */
    left: 50%;
    margin-left: -5px; /* Half of 10px total width for subpixel-perfect horizontal alignment */
    border-width: 5px;
    border-style: solid;
    border-color: var(--primary-accent) transparent transparent transparent;
}

.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px; /* thin horizontal rounded bar */
    border-radius: 4px;
    background: var(--light-teal); /* unfilled track */
    outline: none;
    cursor: pointer;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Chrome, Safari, Opera, Edge */
.slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid var(--primary-accent);
    background: #ffffff;
    cursor: pointer;
    margin-top: -8px; /* center the thumb on the 8px track */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.1s ease;
    box-sizing: border-box;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

/* Firefox */
.slider::-moz-range-track {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: transparent;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 3px solid var(--primary-accent);
    background: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    box-sizing: border-box;
    transition: transform 0.1s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.results-container {
    display: flex;
    justify-content: space-around;
    text-align: center;
    flex-wrap: wrap;
}

.result {
    flex: 1;
    min-width: 200px;
    margin: 1rem;
}

.result h3 {
    color: #474848;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.result p {
    font-size: 1.5rem;
    font-weight: bold;
    color: #049f82;
}

.breakdown-box {
    border: 1px solid #ddfdf7;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #474848;
}

.payback-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-top: 1px solid #ddfdf7;
    border-bottom: 1px solid #ddfdf7;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background-color: #049f82;
    color: #ffffff;
}

.btn-secondary {
    background-color: transparent;
    color: #131313;
    border: 2px solid #049f82;
}

.telemetry-container p {
    font-size: 1rem;
    color: #474848;
}

.weather-status-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #4B5563;
    margin-top: 0.5rem;
}

.telemetry-pulser-row {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center;
    gap: 0.25rem;
    margin: 1rem 0;
    text-align: left !important;
}

.dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background-color: #049f82;
    transition: background-color 0.5s ease;
}

.dot.inactive {
    background-color: #d1d5db; /* Light Slate Gray */
    animation: none;
}

.night-message {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-left: 0.5rem;
    font-weight: 500;
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    50% {
        opacity: .5;
    }
}

.telemetry-disclaimer {
    font-size: 10px !important;
    color: #049f82 !important;
    text-align: left !important;
    width: 100% !important;
    display: block !important;
    border-top: 1px solid #f3f4f6;
    padding-top: 0.75rem;
    margin-top: 1rem;
    font-style: italic;
}

.text-amber-500 { color: #f59e0b; }
.text-gray-400 { color: #9ca3af; }
.text-blue-400 { color: #60a5fa; }
.text-indigo-300 { color: #a5b4fc; }
.text-indigo-400 { color: #818cf8; }




#live-telemetry {
    font-weight: bold;
    color: #049f82;
}

/* Breakdown Page Styles */
.breakdown-body {
    background-color: #fafbfb;
}

.breakdown-header {
    background-color: #131313;
    padding: 2rem;
    text-align: center;
}

.breakdown-header h1 {
    color: #fafbfb;
    font-size: 2.5rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 2rem;
    color: #049f82;
    text-decoration: none;
    font-size: 1rem;
}

.breakdown-content {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 8px;
}

.breakdown-section {
    margin-bottom: 2rem;
}

.breakdown-section h2 {
    color: #049f82;
    border-bottom: 2px solid #ddfdf7;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.breakdown-section p {
    line-height: 1.6;
    color: #474848;
}

.deployment-footprint {
    background-color: #049f82;
    padding: 4rem 2rem;
    text-align: left;
}

.section-title {
    max-width: 1200px;
    margin: 0 auto 2rem auto;
}

.section-title h2 {
    font-size: 2rem;
    font-weight: 900;
    color: #fafbfb;
}

.section-title p {
    font-size: 1.1rem;
    color: #fafbfb;
    max-width: 600px;
}

.deployment-map-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1.5rem;
    width: 100%;
}

.deployment-map {
    width: 100%;
    max-width: 1280px;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(71, 72, 72, 0.1);
    object-fit: contain;
}

.data-driven-section {
    background-color: #FFFFFF;
    padding: 4rem 2rem;
}

.data-driven-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.data-driven-text h2 {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.2;
    color: #131313;
}

.data-driven-text p {
    line-height: 1.6;
    color: #474848;
    margin-bottom: 2rem;
}

.data-driven-image img {
    width: 100%;
    max-width: 600px;
    border-radius: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.join-community-section {
    background-color: #049f82;
    padding: 4rem 2rem;
    color: #FFFFFF;
}

.join-community-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    align-items: center;
}

.join-community-image img {
    width: 100%;
    max-width: 450px;
    border-radius: 1.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.join-community-text {
    text-align: left;
}

.join-community-text h2 {
    font-size: 2.5rem;
    font-weight: 900;
    line-height: 1.2;
    color: #FFFFFF;
}

.join-community-text p {
    line-height: 1.6;
    margin-bottom: 2rem;
}

.btn-light {
    background-color: #FFFFFF;
    color: #049f82;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-light:hover {
    background-color: #f0f0f0;
}

.oem-partners-section {
    background-color: #FFFFFF;
    padding: 4rem 2rem;
    text-align: center;
}

.oem-partners-section h2 {
    text-align: center;
    max-width: 1200px;
    margin: 0 auto 2rem auto;
    color: #131313;
}

.oem-logos-wrapper {
    overflow: hidden;
    width: 100%;
}

.oem-logos {
    display: flex;
    white-space: nowrap;
    animation: marquee 25s linear infinite;
    gap: 4rem;
}

.oem-logos img {
    height: 3rem;
    object-fit: contain;
}

@keyframes marquee {
    0% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(-50%);
    }
}

.main-footer {
    background-color: #049f82;
    color: #FFFFFF;
    padding: 4rem 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-contact ul, .footer-nav ul {
    list-style: none;
    padding: 0;
}

.footer-contact li, .footer-nav li {
    margin-bottom: 1rem;
}

.footer-nav a {
    color: #FFFFFF;
    text-decoration: none;
}

.footer-copyright {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    padding-top: 2rem;
    margin-top: 2rem;
    text-align: left;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.mr-2 {
    margin-right: 0.5rem;
}

/* Responsive Styles */
@media (max-width: 1024px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
    }

    .main-nav ul {
        justify-content: center;
        flex-wrap: wrap;
    }

    .header-actions .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-content-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero-text {
        max-width: 100%;
        text-align: center;
    }

    .config-grid {
        grid-template-columns: 1fr;
    }

    .forward-banner-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .data-driven-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .data-driven-image {
        margin-top: 2rem;
    }

    .join-community-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .join-community-text {
        text-align: center;
        margin-top: 2rem;
    }

    .footer-grid {
        text-align: center;
    }
}

/* --- Savings Card Loading Animation Overlay --- */
#savings-card {
    position: relative;
}

.loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    z-index: 100;
    pointer-events: none;
}

.loader-spinner {
    width: 45px;
    height: 45px;
    border: 4px solid #ddfdf7;
    border-top: 4px solid #049f82;
    border-radius: 50%;
    animation: loader-spin 0.8s linear infinite;
}

@keyframes loader-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- USD Equivalent Diaspora Price Reference --- */
.usd-equivalent {
    font-size: 0.65em !important;
    color: #474848 !important;
    font-weight: normal !important;
    margin-left: 0.4rem !important;
    white-space: nowrap !important;
}

/* --- Redesigned Savings Card 2x2 Grid --- */
.savings-grid-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin: 1.5rem 0;
}

.savings-cell {
    background-color: #ffffff;
    border: 1px solid #ddfdf7;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(4, 159, 130, 0.03);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.cell-header {
    background-color: #ddfdf7;
    color: #131313;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    text-align: left;
}

.cell-body {
    padding: 1.2rem 1rem;
    font-size: 1.3rem;
    font-weight: bold;
    color: #049f82;
    text-align: left;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    flex-grow: 1;
}

.cell-body .unit {
    font-size: 0.85rem;
    color: #474848;
    font-weight: normal;
    margin-left: 0.25rem;
}

/* Centralized Footnotes Section */
.footnotes-section {
    border-top: 1px solid #ddfdf7;
    padding-top: 1rem;
    margin-top: 1.5rem;
    text-align: left;
}

.footnotes-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footnotes-list li {
    font-size: 0.75rem;
    color: #474848;
    line-height: 1.4;
}

/* Responsive adjustment for Grid */
@media (max-width: 576px) {
    .savings-grid-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Mobile Navigation Header Collapse & Transition */
.nav-toggle {
    display: none; /* hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    z-index: 1100;
}

@media (min-width: 769px) {
    .nav-toggle {
        display: none !important;
    }
    .mobile-menu {
        display: contents !important;
    }
}

.nav-toggle .bar {
    width: 24px;
    height: 2px;
    background-color: #049f82; /* Brand Deep Teal */
    transition: all 0.3s ease;
    display: block;
}

/* Hamburger to X Transform */
.nav-toggle.open .bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}
.nav-toggle.open .bar:nth-child(2) {
    opacity: 0;
}
.nav-toggle.open .bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 768px) {
    .main-header, .config-header {
        position: relative !important;
        z-index: 1000 !important;
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        gap: 0 !important;
        padding: 1rem 1.5rem !important;
    }

    .nav-toggle {
        display: flex !important;
    }

    .mobile-menu {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #131313; /* Rich Jet Black matching palette */
        padding: 2.5rem 2rem;
        border-bottom: 3px solid #049f82;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: all 0.3s ease-in-out;
        z-index: 1050;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    }

    .mobile-menu.open {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .mobile-menu .main-nav {
        display: block !important;
        width: 100%;
    }

    .mobile-menu .main-nav ul {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 1.5rem !important;
    }

    .mobile-menu .main-nav a {
        font-size: 1.1rem !important;
        color: #fafbfb !important;
        font-weight: 600 !important;
        padding: 0.5rem 1rem !important;
        display: block !important;
        text-align: center !important;
        transition: color 0.3s ease !important;
    }

    .mobile-menu .main-nav a:hover,
    .mobile-menu .main-nav a.active-nav {
        color: #0afacd !important; /* Bright Cyan active hover state */
    }

    .mobile-menu .header-actions {
        display: flex !important;
        width: 100%;
        justify-content: center !important;
    }

    .mobile-menu .header-actions .btn {
        width: 100% !important;
        max-width: 300px !important;
        text-align: center !important;
    }
}

/* Global Defensive Mobile Responsiveness Overrides */
html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

*, *::before, *::after {
    box-sizing: inherit !important;
}

/* Prevent unbroken long strings (emails, names, links) from forcing horizontal scroll */
p, h1, h2, h3, h4, h5, h6, span, label, div, a, li, td, th, textarea, input {
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

/* Responsive Card Grid for Admin Console Lists */
#saved-configs-list,
#surveys-list,
#investments-list,
#admin-slots-list,
#admin-configs-list,
#admin-approvals-list,
#admin-investors-list,
#admin-gift-power-list {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 1.25rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Individual Card Defensive Sizing */
.history-card {
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow-wrap: break-word !important;
    word-break: break-word !important;
}

.history-card-header,
.history-card-body,
.history-card-actions {
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
}

/* Custom Responsive Modal Override */
.invoice-modal-content,
.modal-content {
    box-sizing: border-box !important;
    width: 95% !important;
    max-width: 500px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 1.5rem !important;
}

#investment-breakdown-modal .invoice-modal-content {
    max-width: 650px !important;
}

@media (max-width: 576px) {
    .invoice-modal-content,
    .modal-content {
        padding: 1rem !important;
        width: 98% !important;
    }
}

/* Mobile Admin Console Layout Optimizations */
@media (max-width: 768px) {
    /* Admin Tab Bar Icons Collapse */
    .dashboard-tabs {
        display: flex !important;
        width: 100% !important;
        justify-content: space-between !important;
        gap: 0.25rem !important;
        border-bottom: 1px solid #ddfdf7 !important;
        padding-bottom: 0.5rem !important;
    }
    
    .dashboard-tabs .tab-btn {
        flex: 1 !important;
        text-align: center !important;
        padding: 0.75rem 0.25rem !important;
        font-size: 1.2rem !important; /* Larger touch targets for icons on mobile */
        border-radius: 8px !important;
        transition: all 0.2s ease !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .dashboard-tabs .tab-btn span {
        display: none !important; /* Hide text label on mobile */
    }
    
    .dashboard-tabs .tab-btn i {
        margin: 0 !important;
        display: inline-block !important;
    }
    
    .dashboard-tabs .tab-btn.active {
        background-color: var(--primary-light) !important;
        color: var(--primary) !important;
        border-bottom: none !important;
        box-shadow: inset 0 -2px 0 var(--primary) !important;
    }
    
    /* Position unseen red dot badge beautifully relative to icon button */
    .dashboard-tabs .tab-btn .tab-badge-dot {
        top: 4px !important;
        right: calc(50% - 14px) !important;
        width: 7px !important;
        height: 7px !important;
    }

    /* Stats Cards Responsive Reflow (5 cards -> 2x2 grid with 5th spanning) */
    #admin-stats-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.75rem !important;
    }
    
    #admin-stats-container > div:nth-child(5) {
        grid-column: span 2 !important;
    }
}

/* Card Padding Compression on Small Screens */
@media (max-width: 480px) {
    .config-card,
    .invoice-card {
        padding: 1rem !important;
    }
}
