/**
 * calculator.css
 * Victorian Greens Rent Calculator — front end styles
 */

/* =============================================================================
   SCROLL OFFSET
   Controls how far above #calculator the page scrolls on each step change.
   Positive value = scroll to that many px above the top of #calculator.
   Useful if your theme has a sticky header — set this to the header height.
   0 = scroll to the very top of #calculator.
============================================================================= */

:root {
    --grc-scroll-offset: 24px;
}


/* =============================================================================
   FONTS — local fallback hints; Google Fonts loaded via PHP
============================================================================= */

@font-face {
    font-family: 'Anton';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Anton'), local('Anton-Regular');
}

@font-face {
    font-family: 'Roboto Condensed';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: local('Roboto Condensed'), local('RobotoCondensed-Regular');
}

@font-face {
    font-family: 'Roboto Condensed';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: local('Roboto Condensed Bold'), local('RobotoCondensed-Bold');
}


/* =============================================================================
   CALCULATOR CONTAINER — height transition
   JS measures the incoming step's height and sets it explicitly so CSS can
   animate between values. After the transition, height is released to auto.
============================================================================= */

#calculator {
    /* overflow must NOT be hidden — the suburb dropdown uses position:fixed  */
    /* to escape any clipping ancestor, but we still need height transitions. */
    transition: height 0.2s ease;
    /* height is set and released by grcShowStep() in rent-calculator.js */
}


/* =============================================================================
   CALCULATOR INNER CLIP WRAPPER
   #calculator transitions height but can't use overflow:hidden (would clip
   the fixed-position suburb dropdown). Instead, a .grc-inner wrapper handles
   the visual clipping during height transitions.
============================================================================= */

#calculator .grc-inner {
    overflow: hidden;
}


/* =============================================================================
   STEPS
============================================================================= */

.grc-step {
    display: none;
}


/* =============================================================================
   FIELDS
============================================================================= */

.grc-field-wrap {
    margin-bottom: 1.5rem;
    max-width: 420px;
    position: relative;
}

.grc-field-wrap label {
    display: block;
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 6px;
    color: #222;
}

.grc-field-wrap input[type="text"],
.grc-field-wrap input[type="number"] {
    display: block;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 14px;
    font-size: 1rem;
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    color: #222;
    background: #fff;
    border: 2px solid #ccc;
    border-radius: 6px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.grc-field-wrap input:focus {
    outline: none;
    border-color: #2c6e2f;
    box-shadow: 0 0 0 3px rgba(44, 110, 47, 0.12);
}

/* Square the bottom corners of the input when suggestions are showing */
.grc-field-wrap.grc-has-suggestions input[type="text"] {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: #e0e0e0;
    border-color: #2c6e2f;
}


/* =============================================================================
   SUBURB AUTOCOMPLETE
============================================================================= */

.grc-suburb-suggestions {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    /* position, top, left, width set by JS using getBoundingClientRect()
       so the dropdown escapes overflow:hidden ancestors cleanly */
    border: 2px solid #2c6e2f;
    border-top: none;
    border-radius: 0 0 6px 6px;
    background: #fff;
    max-height: 240px;
    overflow-y: auto;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
}

.grc-suburb-suggestions.grc-suggestions-visible {
    display: block;
}

.grc-suburb-suggestions li {
    padding: 10px 14px;
    cursor: pointer;
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    font-size: 1rem;
    color: #222;
    border-bottom: 1px solid #f0f0f0;
    list-style: none;
}

.grc-suburb-suggestions li:last-child {
    border-bottom: none;
}

.grc-suburb-suggestions li:hover {
    background: #f0f7f0;
    color: #1a5c2a;
}


/* =============================================================================
   VALIDATION ERRORS
============================================================================= */

.grc-field-error {
    display: block;
    color: #c0392b;
    font-size: 0.85rem;
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    margin-top: 6px;
}


/* =============================================================================
   SAVINGS OUTPUT
============================================================================= */

.grc-output-wrap {
    margin: 1rem 0;
}

.grc-savings-output {
    display: inline-block;
    font-family: 'Anton', Impact, sans-serif;
    font-size: 3.5rem;
    color: #1a5c2a;
}


/* =============================================================================
   CANVAS WRAP
============================================================================= */

.grc-canvas-wrap {
    margin: 1.5rem 0;
    max-width: 100%;
    overflow: hidden;
}

.grc-canvas-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.grc-toggle-btn {
    padding: 8px 20px;
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    border: 2px solid #2c6e2f;
    border-radius: 4px;
    background: #fff;
    color: #2c6e2f;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.grc-toggle-btn.active,
.grc-toggle-btn:hover {
    background: #2c6e2f;
    color: #fff;
}

/* Canvas renders at full resolution but displays responsively */
.grc-canvas {
    display: block;
    width: 100%;
    max-width: 400px; /* sensible preview size — full res preserved for download */
    height: auto;
    border-radius: 6px;
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

.grc-canvas-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.grc-canvas-btn {
    padding: 11px 24px;
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 4px;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.grc-canvas-btn:hover {
    opacity: 0.85;
}

.grc-btn-download {
    background: #2c6e2f;
    color: #fff;
    border: 2px solid #2c6e2f;
}

.grc-btn-share {
    background: #fff;
    color: #2c6e2f;
    border: 2px solid #2c6e2f;
}


/* =============================================================================
   MATHS BREAKDOWN (step 4)
============================================================================= */

.grc-maths {
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #333;
    max-width: 680px;
}

.grc-maths h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 1.5rem 0 0.4rem;
    color: #1a5c2a;
}

.grc-maths p {
    margin: 0 0 0.75rem;
}

.grc-maths-table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 0.5rem 0 1.25rem;
    font-size: 0.9rem;
}

.grc-maths-table th,
.grc-maths-table td {
    padding: 7px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.grc-maths-table thead th {
    font-weight: 700;
    background: #f5f5f5;
}

.grc-maths-total td {
    border-top: 2px solid #ccc;
    border-bottom: none;
}

.grc-maths-saving {
    color: #1a5c2a;
    font-size: 1.1em;
}

.grc-maths-note {
    font-size: 0.8rem;
    color: #777;
    border-top: 1px solid #e0e0e0;
    padding-top: 0.75rem;
    margin-top: 1rem;
}


/* =============================================================================
   CALCULATE BUTTON — disabled state
   Button is disabled until both weekly rent and suburb are filled.
============================================================================= */

.grc-btn-calculate a[disabled],
.grc-btn-calculate button[disabled],
.grc-btn-calculate a.grc-btn-disabled,
.grc-btn-calculate button.grc-btn-disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

p:has(span.wpcf7-form-control-wrap[data-name="postcode"]),
p:has(.wpcf7-form-control.wpcf7-submit.has-spinner){
display: none;
}

.grc-btn-step3-calculate a[disabled], .grc-btn-step3-calculate button[disabled]  {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}


/* =============================================================================
   BACK LINK
============================================================================= */

.grc-back-link {
    margin-top: 1rem;
}

.grc-btn-back {
    display: inline-block;
    font-family: 'Roboto Condensed', 'Arial Narrow', Arial, sans-serif;
    font-size: 0.9rem;
    color: #555;
    text-decoration: none;
    padding: 4px 0;
    transition: color 0.15s ease;
}

.grc-btn-back:hover {
    color: #1a5c2a;
    text-decoration: underline;
}


/* =============================================================================
   KEYBOARD-HIGHLIGHTED SUGGESTION
============================================================================= */

.grc-suburb-suggestions li.grc-suggestion-active {
    background: #f0f7f0;
    color: #1a5c2a;
    font-weight: 700;
}
