/**
 * Ekoinstal Energy Widgets v2
 * Contract-based PVGIS + NASA POWER sections.
 */

.ekoinstal-solar-widget,
.ekoinstal-wind-widget,
.ekoinstal-energy-cta,
.ekoinstal-gmina-intro {
    box-sizing: border-box;
    font-family: var(--eko-font-family, 'Lato', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
}

.ekoinstal-solar-widget *,
.ekoinstal-wind-widget *,
.ekoinstal-energy-cta *,
.ekoinstal-gmina-intro * {
    box-sizing: border-box;
}

.eiw-card {
    --eiw-accent: var(--eko-green, #70b221);
    --eiw-accent-dark: var(--eko-green-dark, #5a9a18);
    --eiw-soft: var(--eko-green-light, #f0fdf4);
    --eiw-text: var(--eko-text-primary, #1e293b);
    --eiw-muted: var(--eko-text-muted, #64748b);
    margin: 32px 0;
    overflow: hidden;
    border: 1px solid var(--eko-border, #e5e7eb);
    border-radius: 8px;
    background: var(--eko-bg-primary, #fff);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
    color: var(--eiw-text);
}

.eiw-card--solar {
    --eiw-accent: #d97706;
    --eiw-accent-dark: #92400e;
    --eiw-soft: #fffbeb;
    --eiw-bar: #f4b43f;
    --eiw-bar-current: #d97706;
    --eiw-grid: #f3dfb8;
}

.eiw-card--wind {
    --eiw-accent: #0f7a8a;
    --eiw-accent-dark: #155e68;
    --eiw-soft: #ecfeff;
    --eiw-bar: #67c8d7;
    --eiw-bar-current: #0f7a8a;
    --eiw-grid: #c8edf2;
}

.eiw-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 22px;
    border-bottom: 1px solid color-mix(in srgb, var(--eiw-accent) 22%, #fff);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--eiw-soft) 80%, #fff), #fff 58%),
        var(--eiw-soft);
}

.eiw-kicker {
    margin: 0 0 4px;
    color: var(--eiw-accent-dark);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.eiw-header h3 {
    margin: 0;
    color: var(--eiw-text);
    font-size: 21px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0;
}

.eiw-source-pill {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 7px 11px;
    border: 1px solid color-mix(in srgb, var(--eiw-accent) 30%, #fff);
    border-radius: 999px;
    background: #fff;
    color: var(--eiw-accent-dark);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.eiw-body {
    display: grid;
    gap: 20px;
    padding: 22px;
}

.eiw-copy {
    max-width: 860px;
}

.eiw-copy h4,
.eiw-chart-head h4 {
    margin: 0 0 6px;
    color: var(--eiw-accent-dark);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: 0;
}

.eiw-copy p {
    margin: 0;
    max-width: 74ch;
    color: var(--eko-text-secondary, #475569);
    font-size: 15px;
    line-height: 1.7;
}

.eiw-copy strong {
    color: var(--eiw-text);
    font-weight: 800;
}

.eiw-note {
    margin-top: 10px !important;
    padding-left: 12px;
    border-left: 3px solid var(--eiw-accent);
}

.eiw-metrics {
    display: grid;
    gap: 12px;
}

.eiw-metrics--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.eiw-metric {
    min-width: 0;
    padding: 16px;
    border: 1px solid color-mix(in srgb, var(--eiw-accent) 18%, #fff);
    border-radius: 8px;
    background: var(--eiw-soft);
}

.eiw-metric span,
.eiw-summary span {
    display: block;
    color: var(--eiw-accent-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .03em;
    line-height: 1.25;
    text-transform: uppercase;
}

.eiw-metric strong {
    display: block;
    margin-top: 5px;
    color: var(--eiw-text);
    font-size: 28px;
    font-weight: 850;
    line-height: 1.05;
    letter-spacing: 0;
}

.eiw-metric small {
    display: block;
    margin-top: 4px;
    color: var(--eiw-muted);
    font-size: 12px;
    line-height: 1.35;
}

.eiw-chart-wrap {
    padding: 16px;
    border: 1px solid var(--eko-border, #e5e7eb);
    border-radius: 8px;
    background: #fff;
}

.eiw-chart-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.eiw-chart-head span {
    color: var(--eiw-muted);
    font-size: 12px;
    white-space: nowrap;
}

.eiw-chart {
    display: block;
    width: 100%;
    height: auto;
}

.eiw-grid {
    stroke: var(--eiw-grid);
    stroke-dasharray: 2 4;
}

.eiw-axis {
    stroke: color-mix(in srgb, var(--eiw-accent) 45%, #fff);
}

.eiw-axis-label,
.eiw-bar-label,
.eiw-month-label {
    fill: var(--eiw-accent-dark);
    font-size: 10px;
}

.eiw-bar {
    fill: var(--eiw-bar);
}

.eiw-bar--current {
    fill: var(--eiw-bar-current);
}

.eiw-bar-label {
    font-weight: 700;
}

.eiw-month-label {
    font-weight: 500;
}

.eiw-month-label--current {
    fill: var(--eiw-bar-current);
    font-weight: 800;
}

.eiw-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.eiw-summary div {
    padding: 14px 0 0;
    border-top: 1px solid var(--eko-border, #e5e7eb);
}

.eiw-summary strong {
    display: block;
    margin-top: 5px;
    color: var(--eiw-text);
    font-size: 15px;
    line-height: 1.35;
}

.eiw-footer {
    padding: 11px 22px;
    border-top: 1px solid var(--eko-border, #e5e7eb);
    background: var(--eko-bg-secondary, #f8fafc);
    color: var(--eiw-muted);
    font-size: 12px;
    line-height: 1.45;
    text-align: right;
}

/* Contact Form 7 integration */
.ekoinstal-cta-form .wpcf7 {
    margin: 0;
}

.ekoinstal-cta-form .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ekoinstal-cta-form .wpcf7-form p {
    margin: 0;
}

.ekoinstal-cta-form .wpcf7-form-control:not([type="submit"]) {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ekoinstal-cta-form .wpcf7-form-control:not([type="submit"]):focus {
    border-color: var(--eko-green, #70B221);
    box-shadow: 0 0 0 3px rgba(112, 178, 33, 0.15);
    outline: none;
}

.ekoinstal-cta-form .wpcf7-submit {
    min-height: 44px;
    padding: 14px 28px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--eko-green, #70B221), var(--eko-green-dark, #5a9a18));
    color: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ekoinstal-cta-form .wpcf7-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(112, 178, 33, 0.3);
}

.ekoinstal-cta-form .wpcf7-submit:active {
    transform: translateY(0);
}

.ekoinstal-cta-form .wpcf7-not-valid {
    border-color: var(--eko-error, #ef4444) !important;
}

.ekoinstal-cta-form .wpcf7-not-valid-tip {
    margin-top: 4px;
    color: var(--eko-error, #ef4444);
    font-size: 13px;
}

.ekoinstal-cta-form .wpcf7-response-output {
    margin: 16px 0 0 !important;
    padding: 12px 16px !important;
    border-radius: 8px !important;
}

@media (max-width: 768px) {
    .eiw-header,
    .eiw-chart-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .eiw-metrics--three,
    .eiw-summary {
        grid-template-columns: 1fr;
    }

    .eiw-metric strong {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .eiw-card {
        margin: 24px 0;
        border-radius: 8px;
    }

    .eiw-header,
    .eiw-body,
    .eiw-footer {
        padding-right: 16px;
        padding-left: 16px;
    }

    .eiw-header h3 {
        font-size: 18px;
    }

    .eiw-copy p {
        font-size: 14px;
    }

    .eiw-axis-label,
    .eiw-bar-label,
    .eiw-month-label {
        font-size: 12px;
    }
}

@media print {
    .ekoinstal-solar-widget,
    .ekoinstal-wind-widget {
        break-inside: avoid;
        box-shadow: none;
    }

    .ekoinstal-energy-cta {
        display: none !important;
    }
}
