/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&family=Source+Serif+Pro:wght@700&display=swap');

/* Core Brand Colors & Typography Variables */
:root {
    --w3w-blue: #0A3049; /* Main what3words blue */
    --w3w-red: #E51D0E;  /* what3words red accent/symbol */
    --w3w-dark-gray: #333333; /* For body text, headlines */
    --w3w-light-gray: #f4f7f6; /* For backgrounds, input fields */
    --w3w-white: #ffffff;
    --w3w-accent-green: #28a745; /* Success/positive emphasis color */

    /* Font Families */
    --font-headline: 'Source Serif Pro', serif;
    --font-body: 'Source Sans Pro', sans-serif;
}

/* General Body Styles */
body {
    font-family: var(--font-body);
    margin: 0;
    padding: 0;
    background-color: var(--w3w-light-gray);
    color: var(--w3w-dark-gray);
    line-height: 1.6;
    font-weight: 400;
}

/* Headlines - Using Source Serif Pro Bold */
h1, h2, h3 {
    font-family: var(--font-headline);
    font-weight: 700;
    color: var(white);
}

/* Header/Hero Section - PADDING REDUCED */
.hero-section {
    background-color: var(--w3w-blue);
    color: var(--w3w-white);
    text-align: center;
    padding: 1.5em 1em; /* PADDING REDUCED */
    position: relative;
    overflow: hidden;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* Logo Styling - ADDED */
.header-logo {
    max-width: 200px; /* Adjust as needed for logo size */
    height: auto;
    margin-bottom: 0.8em; /* Space between logo and headline */
}

.hero-content h1 {
    font-size: 2.8em;
    margin-bottom: 0.5em;
    line-height: 1.2;
    color: var(--w3w-white);
}

.hero-content .sub-headline {
    font-size: 1.3em;
    opacity: 0.9;
}

/* Problem Amplification Section - PADDING REDUCED */
.problem-amplification {
    background-color: var(--w3w-white);
    padding: 1.5em 1em; /* PADDING REDUCED */
    text-align: center;
    border-bottom: 1px solid #eee;
}

.problem-amplification h2 {
    font-size: 2em;
    margin-bottom: 1.5em;
    color: var(--w3w-red);
}

.cost-breakdown {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2em;
    max-width: 1000px;
    margin: 0 auto;
}

.cost-item {
    flex: 1 1 280px;
    background-color: var(--w3w-light-gray);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5em;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    text-align: center;
}

.cost-item h3 {
    font-size: 1.3em;
    color: var(--w3w-dark-gray);
    margin-bottom: 0.5em;
}

.cumulative-text {
    font-size: 1.2em;
    margin-top: 2em; 
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    font-weight: bold;
    color: var(--w3w-dark-gray);
    font-family: var(--font-body);
}


/* Calculator Section */
.calculator-section {
    background-color: var(--w3w-white);
    padding: 1.5em 1em; /* PADDING REDUCED */
    max-width: 960px;
    margin: 2em auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.calculator-section h2 {
    font-size: 2em;
    margin-bottom: 1em;
    text-align: center;
    color: var(--w3w-dark-gray);
}

/* Calculator Intro Paragraph Centering */
.calculator-section .intro-paragraph {
    text-align: center;
    max-width: 700px;
    margin: 0.5em auto 1.5em auto;
}


/* Input Form Layout (New Grid System) */
.calculator-section form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8em 2em; /* Reduced row gap */
    padding: 1em;
}

.calculator-section form > h2:first-child,
.calculator-section form > p.data-reassurance-text,
.calculator-section form > p.helper-text {
    grid-column: 1 / -1;
    text-align: center;
    margin-bottom: 0.5em;
}

/* Data Reassurance Text */
.data-reassurance-text {
    grid-column: 1 / -1;
    background-color: #f0f8ff; /* A very light blue */
    border-left: 4px solid var(--w3w-blue);
    padding: 1.2em 1.5em;
    margin: 1em auto;
    font-size: 0.95em;
    color: var(--w3w-dark-gray);
    border-radius: 4px;
    max-width: 90%;
    line-height: 1.5;
    text-align: left;
}

.data-reassurance-text strong {
    color: var(--w3w-blue);
}

.helper-text-button-container {
    grid-column: 1 / -1; /* Span all columns */
    text-align: center; /* Center content within this paragraph */
    margin-bottom: 1em; /* Space below the button */
}

.calculator-section form div {
    display: flex;
    flex-direction: column;
}

.calculator-section label {
    font-weight: 700;
    margin-bottom: 0.3em;
    color: var(--w3w-dark-gray);
    font-family: var(--font-body);
}

.calculator-section input[type="number"],
.calculator-section input[type="text"],
.calculator-section input[type="email"],
.calculator-section input[type="tel"] {
    padding: 0.8em;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1em;
    font-family: var(--font-body);
    background-color: var(--w3w-light-gray);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.calculator-section input[type="number"]:focus,
.calculator-section input[type="text"]:focus,
.calculator-section input[type="email"]:focus,
.calculator-section input[type="tel"]:focus {
    border-color: var(--w3w-blue);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06), 0 0 0 3px rgba(0, 68, 204, 0.2);
    outline: none;
}

.calculator-section button[type="submit"] {
    background-color: var(--w3w-blue);
    color: var(--w3w-white);
    padding: 1em 1.5em;
    border: none;
    border-radius: 4px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-top: 1em;
    font-family: var(--font-body);
    font-weight: 600;
    grid-column: 1 / -1;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.calculator-section button[type="submit"]:hover {
    background-color: #003399;
}

/* Helper Text (with button) */
.helper-text {
    font-size: 0.95em;
    color: #666;
    margin-bottom: 0.8em;
    font-family: var(--font-body);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
    padding: 0 1em;
    text-align: center;
}

/* Tooltip Styles */
.tooltip-icon {
    cursor: help;
    margin-left: 5px;
    font-weight: bold;
    color: var(--w3w-blue);
    position: relative;
    display: inline-block;
    vertical-align: middle;
}

.tooltip-icon .tooltiptext {
    visibility: hidden;
    width: 280px;
    background-color: var(--w3w-dark-gray);
    color: var(--w3w-white);
    text-align: center;
    border-radius: 6px;
    padding: 8px 12px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -140px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.85em;
    line-height: 1.4;
    font-family: var(--font-body);
    font-weight: 400;
}

.tooltip-icon .tooltiptext::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--w3w-dark-gray) transparent transparent transparent;
}

.tooltip-icon:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: var(--w3w-white);
    margin: 10% auto;
    padding: 30px;
    border: none;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: var(--w3w-dark-gray);
    text-decoration: none;
}

#stakeholderMessage {
    width: 100%;
    min-height: 250px;
    margin-top: 15px;
    padding: 15px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: var(--font-body);
    font-size: 0.9em;
    background-color: var(--w3w-light-gray);
    font-weight: 400;
}

#copyMessageBtn {
    margin-top: 15px;
    background-color: var(--w3w-accent-green);
    color: var(--w3w-white);
    padding: 0.8em 1.5em;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: var(--font-body);
    font-weight: 600;
}

#copyMessageBtn:hover {
    background-color: #218838;
}

/* Styles for the "Need Help Gathering Data?" button on the main form */
#stakeholderHelpBtn {
    background-color: var(--w3w-blue);
    color: var(--w3w-white);
    padding: 0.8em 1.2em;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: var(--font-body);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5em;
    max-width: 100%;
}

#stakeholderHelpBtn:hover {
    background-color: #002255;
}


/* Result Section Styles (Enhanced for Impact) */
.result-section {
    margin-top: 3em;
    padding-top: 2em;
    border-top: 1px dashed #eee;
    text-align: center;
}

.total-savings {
    background-color: var(--w3w-blue);
    color: var(--w3w-white);
    padding: 1.5em 1em;
    border-radius: 8px;
    margin-bottom: 2em;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.total-savings h3 {
    font-size: 2.8em;
    font-family: var(--font-headline);
    color: var(white); 
    margin: 0;
    line-height: 1.2;
}

.result-section h3 {
    font-size: 1.8em;
    margin-top: 1.5em;
    margin-bottom: 1em;
    color: var(white); 
    font-family: var(--font-headline);
}

.result-section ul {
    list-style: none;
    padding: 0;
    max-width: 600px;
    margin: 1em auto;
    text-align: left;
}

.result-section ul li {
    background-color: var(--w3w-light-gray);
    padding: 1em 1.5em;
    border-radius: 4px;
    margin-bottom: 0.8em;
    border-left: 5px solid var(--w3w-blue);
    font-family: var(--font-body);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    text-align: left;
}

.report-section {
    background-color: #e6f0ff; /* Light blue from solution section */
    padding: 1.5em;
    margin-top: 3em;
    border-radius: 8px;
    border: 1px solid #cceeff;
    text-align: center;
}

.report-section h3 {
    color: var(--w3w-blue);
    margin-bottom: 1em;
}

.report-section form div {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 1em;
    margin-bottom: 0.8em;
}

.report-section button[type="submit"] {
    background-color: var(--w3w-red); /* Set to RED */
    color: var(--w3w-white); /* White text */
    padding: 1em 1.5em; /* Match main submit button padding */
    border: none;
    border-radius: 4px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-family: var(--font-body);
    font-weight: 600;
}

.report-section button[type="submit"]:hover {
    background-color: #bb0000; /* Darker red on hover */
}
}

/* Responsive Adjustments */
@media (min-width: 768px) {
    .calculator-section form {
        grid-template-columns: 1fr 1fr;
    }
    /* Adjust helper text alignment for larger screens */
    .calculator-section form > p.helper-text {
        text-align: center;
    }
    /* Explicitly center the button within helper-text on larger screens if it's not inline */
    .helper-text #stakeholderHelpBtn {
        margin-left: auto;
        margin-right: auto;
        display: block;
        width: fit-content;
    }
}

@media (max-width: 767px) {
    .hero-content h1 {
        font-size: 2em;
    }
    .hero-content .sub-headline {
        font-size: 1em;
    }
    .cost-breakdown {
        flex-direction: column;
    }
    .cost-item {
        flex: 1 1 100%;
        max-width: 400px;
    }
    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 20px;
    }
    .report-section form div {
        flex-direction: column;
        align-items: flex-start;
    }
    .report-section form label {
        width: auto;
        text-align: left;
        margin-right: 0;
    }
    .report-section form input[type="text"],
    .report-section form input[type="email"],
    .report-section form input[type="tel"] {
        width: 100%;
    }
    .data-reassurance-text {
        text-align: left;
    }
    /* Adjust helper text alignment for mobile */
    .helper-text {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .helper-text #stakeholderHelpBtn {
        margin-left: 0;
        margin-top: 0.5em;
        display: block;
        width: fit-content;
    }
}
/* --- NEW: Checkbox Label Specific Adjustment --- */
/* Target the label specifically within the report section's form divs */
.report-section form div label[for="opt_in"] {
    width: auto; /* Allow the label to take its natural width */
    max-width: calc(100% - 3em); /* Limit max width to prevent overflow, allowing 3em for checkbox + gap */
    text-align: left; /* Ensure it's always left-aligned regardless of screen size */
    margin-right: 0.5em; /* Small margin between checkbox and text */
}

/* Adjust the container div for checkbox specifically to align content */
.report-section form div:has(input[type="checkbox"]) { /* Targets the div containing a checkbox */
    flex-direction: row; /* Keep checkbox and label side-by-side */
    justify-content: center; /* Center the checkbox and label together */
    align-items: center; /* Vertically align them */
    gap: 0.5em; /* Small gap between checkbox and label */
    padding: 0 1em; /* Add some horizontal padding to the row */
    margin-bottom: 1em; /* Ensure good spacing below this row */
}

/* Ensure the checkbox itself has proper sizing */
.report-section input[type="checkbox"] {
    width: 1.2em; /* Standard checkbox size */
    height: 1.2em;
    flex-shrink: 0; /* Prevent checkbox from shrinking */
    margin-right: 0; /* Adjust margin if using gap */
}

/* Override general label alignment for mobile if it was set to flex-start */
@media (max-width: 767px) {
    .report-section form div label[for="opt_in"] {
        text-align: left; /* Ensure left alignment on mobile */
        max-width: calc(100% - 2.5em); /* Adjust max-width for mobile view */
        margin-right: 0.5em;
    }
    .report-section form div:has(input[type="checkbox"]) {
        flex-direction: row; /* Always row for checkbox and label */
        justify-content: flex-start; /* Left align on mobile */
        align-items: center;
        text-align: left; /* Ensure parent text align is left */
    }
}