.page-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 3rem 0;
    text-align: center;
}

.page-header .container {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.page-header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1rem;
    opacity: 0.95;
    max-width: 800px;
    margin: 0 auto;
}

.calculator-section {
    padding: 4rem 0;
}

/* Net-Metering Banner */
.net-metering-banner {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    color: white;
}

.net-metering-banner h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    font-weight: 700;
}

.net-metering-banner p {
    line-height: 1.8;
    margin-bottom: 0.75rem;
    opacity: 0.95;
}

.net-metering-banner ul {
    margin-left: 1.5rem;
    margin-top: 0.75rem;
}

.net-metering-banner ul li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.net-metering-banner .highlight {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Calculator Cards */
.calc-card {
    max-width: 800px;
    margin: 0 auto 2rem;
    background: var(--white);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.calc-card h2 {
    font-size: 1.35rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

/* Map Styles */
#map {
    height: 400px;
    width: 100%;
    border-radius: 8px;
    margin: 1rem 0;
    border: 2px solid var(--light-color);
    z-index: 1;
}

.map-instructions {
    text-align: center;
    margin: 0.5rem 0;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.selected-coords {
    text-align: center;
    margin-top: 0.5rem;
    color: var(--text-dark);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--dark-color);
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--light-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg);
    color: var(--dark-color);
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: #666;
    font-size: 0.85rem;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border: 2px solid var(--light-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.checkbox-item:hover {
    border-color: var(--primary-color);
    background: rgba(46, 204, 113, 0.05);
}

.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] {
    width: auto;
    cursor: pointer;
}

.checkbox-item span {
    flex: 1;
}

/* Advanced Options */
.advanced-toggle-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.advanced-toggle-btn:hover {
    background: rgba(46, 204, 113, 0.1);
}

.advanced-options {
    display: none;
    padding-top: 1rem;
    border-top: 1px solid var(--light-color);
    margin-bottom: 1rem;
    animation: fadeIn 0.3s ease;
}

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

.btn-calculate {
    width: 100%;
    margin-top: 1rem;
}

.btn-calculate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results Section */
.results-section {
    max-width: 800px;
    margin: 3rem auto 0;
    display: none;
}

.results-section.show {
    display: block;
    animation: fadeIn 0.5s ease;
}

.result-main-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--white);
    padding: 3rem;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 24px rgba(46, 204, 113, 0.3);
}

.result-main {
    font-size: 3.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-label {
    font-size: 1.05rem;
    opacity: 0.95;
}

/* ── Cost Hero Card ─────────────────────────────────────────────── */
.cost-hero-card {
    background: var(--white);
    border-radius: 14px;
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    margin-bottom: 1.25rem;
    border: 2px solid var(--primary-color);
    box-shadow: 0 4px 20px rgba(90, 154, 110, 0.18);
    position: relative;
    overflow: hidden;
}

.cost-hero-card::before {
    content: '₼';
    position: absolute;
    top: -10px;
    right: 16px;
    font-size: 7rem;
    font-weight: 800;
    color: var(--primary-color);
    opacity: 0.06;
    line-height: 1;
    pointer-events: none;
}

.cost-hero-value {
    font-size: 3.75rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.cost-hero-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 0.4rem;
}

.cost-hero-sub {
    font-size: 0.88rem;
    color: var(--text-dark);
    opacity: 0.45;
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.detail-item {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
    box-shadow: var(--shadow);
    border: 2px solid var(--light-color);
}

.detail-item.cost-item {
    border-left: 3px solid var(--primary-color);
    background: rgba(46, 204, 113, 0.05);
}

.detail-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.detail-label {
    font-size: 0.9rem;
    color: var(--text-dark);
}

.info-box {
    background: var(--light-color);
    border: 2px solid rgba(46, 204, 113, 0.3);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.info-box h3 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    color: var(--dark-color);
}

.info-box ul {
    margin-left: 1.5rem;
    margin-top: 0.75rem;
}

.info-box ul li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

/* Environmental Impact */
.environmental-impact {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.environmental-impact h3 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
    text-align: center;
}

.impact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.impact-card {
    background: var(--light-color);
    border: 2px solid rgba(46, 204, 113, 0.3);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s;
}

.impact-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(46, 204, 113, 0.2);
}

.impact-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.impact-value {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.impact-label {
    font-size: 0.9rem;
    color: var(--text-dark);
}

/* Optimization Tips */
.optimization-tips {
    background: var(--white);
    border: 2px solid rgba(46, 204, 113, 0.3);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.optimization-tips h3 {
    font-size: 1.15rem;
    margin-bottom: 1.5rem;
    color: var(--dark-color);
}

.tip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
}

.tip-card {
    background: var(--light-color);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 8px;
    padding: 1.25rem;
    transition: all 0.3s;
}

.tip-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.15);
}

.tip-card h4 {
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tip-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0.5rem 0;
}

.tip-card p {
    color: var(--text-dark);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ── Recommendations wrap ───────────────────────────────────────── */
.recommendations-wrap {
    position: relative;
}

/* ── Lead capture modal ─────────────────────────────────────────── */
.lead-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.56);
    animation: modalFadeIn 0.25s ease;
}

.lead-modal.open {
    display: flex;
}

.lead-modal-content {
    width: min(100%, 420px);
    background: var(--white);
    color: var(--text-dark);
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    padding: 2rem;
    position: relative;
    animation: modalSlideUp 0.35s ease;
}

.lead-modal-close {
    position: absolute;
    top: 0.9rem;
    right: 1rem;
    border: 0;
    background: transparent;
    color: var(--text-dark);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    opacity: 0.55;
}

.lead-modal-close:hover {
    opacity: 1;
}

.lead-modal-content h2 {
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.lead-modal-content p {
    margin-bottom: 1.25rem;
    color: var(--text-dark);
    opacity: 0.72;
    line-height: 1.6;
}

.lead-modal-content label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.lead-modal-content input {
    width: 100%;
    border: 1.5px solid rgba(0,0,0,0.12);
    border-radius: 10px;
    padding: 0.85rem 0.95rem;
    font-size: 1rem;
    margin-bottom: 0.45rem;
}

.lead-error {
    min-height: 1.2rem;
    display: block;
    color: #dc2626;
    font-size: 0.84rem;
    margin-bottom: 0.9rem;
}

.btn-lead-submit {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: var(--primary-color);
    color: #fff;
    padding: 0.85rem 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
}

.btn-lead-submit:hover {
    background: var(--secondary-color);
    transform: translateY(-1px);
}

/* ── AI analysis section ────────────────────────────────────────── */
.ai-analysis {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1.5rem;
    border: 1px solid rgba(90, 154, 110, 0.2);
    box-shadow: var(--shadow);
    animation: modalSlideUp 0.45s ease;
}

.ai-analysis h3 {
    font-size: 1.2rem;
    color: var(--dark-color);
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-content {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.ai-loading-state {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.ai-loading-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--light-color);
    border-radius: 8px;
    align-items: center;
}

body.dark-mode .ai-loading-row {
    background: rgba(255,255,255,0.05);
}

.ai-loading-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    background: linear-gradient(90deg, rgba(90,154,110,0.15) 25%, rgba(90,154,110,0.3) 50%, rgba(90,154,110,0.15) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.ai-loading-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.ai-loading-line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--light-color) 25%, rgba(90,154,110,0.15) 50%, var(--light-color) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

body.dark-mode .ai-loading-line {
    background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.ai-loading-label {
    text-align: center;
    font-size: 0.88rem;
    color: var(--primary-color);
    opacity: 0.7;
    padding: 0.5rem 0 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.ai-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(90,154,110,0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

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

.ai-error-msg {
    text-align: center;
    color: #ef4444;
    font-size: 0.9rem;
    padding: 1rem;
}

.ai-insight {
    display: flex;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--light-color);
    border-radius: 8px;
    align-items: flex-start;
}

body.dark-mode .ai-insight {
    background: rgba(255,255,255,0.05);
}

.ai-insight-icon {
    font-size: 1.3rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.ai-insight-body strong {
    display: block;
    color: var(--dark-color);
    font-size: 0.92rem;
    margin-bottom: 0.2rem;
}

.ai-insight-body p {
    color: var(--text-dark);
    font-size: 0.87rem;
    line-height: 1.55;
    margin: 0;
    opacity: 0.85;
}

.ai-disclaimer {
    font-size: 0.8rem;
    color: var(--text-dark);
    opacity: 0.6;
    line-height: 1.6;
    border-top: 1px solid rgba(0,0,0,0.07);
    padding-top: 1rem;
    margin: 0;
}

body.dark-mode .ai-disclaimer {
    border-color: rgba(255,255,255,0.08);
}

/* ── Shared modal animations ────────────────────────────────────── */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

/* System Loss info badge (i) */
.tip-info-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0.75rem;
    font-weight: 700;
    font-style: normal;
    border-radius: 50%;
    background: rgba(90, 154, 110, 0.15);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    cursor: help;
    flex-shrink: 0;
    line-height: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .page-header h1 {
        font-size: 1.6rem;
    }

    .calc-card {
        padding: 1.5rem;
    }

    #map {
        height: 300px;
    }

    .result-main {
        font-size: 2.6rem;
    }

    .result-details {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .detail-value {
        font-size: 1.35rem;
    }

    .impact-icon {
        font-size: 2.5rem;
    }

    .tip-grid {
        grid-template-columns: 1fr;
    }
}
