/* ==========================================================================
   Cherry Hill Pricing — Frontend Stylesheet
   ==========================================================================
   
   Components:
     1. Postcode Check Form  — [cherry_hill_postcode_check]
     2. Location Status Bar  — auto-shown when postcode is set
     3. Permit Options       — [cherry_hill_permit_options]
   
   Location variants (set via shortcode `location` attribute):
     .ch-location-home      — homepage hero usage
     .ch-location-archive   — shop / archive page
     .ch-location-product   — single product page
     .ch-location-default   — fallback / no location set
   ========================================================================== */


/* ==========================================================================
   0. POSTCODE GATING
   ==========================================================================
   When no postcode cookie is set, the body gets class 'ch-no-postcode'.
   Add class 'ch-postcode-gated' to any element you want hidden until the
   customer enters a valid postcode (e.g. prices, add-to-cart buttons).
   ========================================================================== */

body.ch-no-postcode .ch-postcode-gated {
    display: none !important;
}

/* Hide elements once a postcode IS set (inverse of above) */
body.ch-has-postcode .ch-postcode-ungated {
    display: none !important;
}


/* --------------------------------------------------------------------------
   CSS Custom Properties (Variables)
   --------------------------------------------------------------------------
   Override these on :root or on any parent element to re-theme components.
   -------------------------------------------------------------------------- */

:root {
    /* Brand colours */
    --ch-color-primary: #ef483e;
    --ch-color-primary-hover: #d63c33;

    /* Component sizing */
    --ch-form-height: 60px;
    --ch-btn-width: 60px;
    --ch-color-secondary: #333333;
    --ch-color-accent: #ffffff;

    /* Text */
    --ch-color-text: #333333;
    --ch-color-text-light: #333333;
    --ch-color-text-muted: #333333;

    /* Backgrounds */
    --ch-bg-light: #e8e8e8;
    --ch-bg-dark: #515151;
    --ch-bg-white: #ffffff;
    --ch-bg-input: #ffffff;
    --ch-bg-permit: #f5f5f5;

    /* Borders */
    --ch-border-color: #dddddd;
    --ch-border-color-light: #eeeeee;

    /* Spacing */
    --ch-spacing-xs: 4px;
    --ch-spacing-sm: 8px;
    --ch-spacing-md: 16px;
    --ch-spacing-lg: 24px;
    --ch-spacing-xl: 32px;

    /* Typography */
    --ch-font-family: inherit;
    --ch-font-size-sm: 0.85rem;
    --ch-font-size-base: 1rem;
    --ch-font-size-lg: 1.15rem;
    --ch-font-size-heading: 1.25rem;

    /* Shape */
    --ch-border-radius: 6px;
    --ch-border-radius-lg: 12px;
    --ch-border-radius-pill: 50px;

    /* Transitions */
    --ch-transition-speed: 0.2s;
    --ch-transition-ease: ease-in-out;
}


/* ==========================================================================
   1. POSTCODE CHECK FORM  (.ch-postcode-box)
   ==========================================================================
   Rendered by [cherry_hill_postcode_check] shortcode.
   Wrapper gets a location class: .ch-location-{home|archive|product|default}
   ========================================================================== */

.ch-postcode-box {
    font-family: var(--ch-font-family);
    box-sizing: border-box;
}

.ch-postcode-box *,
.ch-postcode-box *::before,
.ch-postcode-box *::after {
    box-sizing: inherit;
}

/* --- Form layout --- */

.ch-postcode-form {
    width: 100%;
}

.ch-flex-form {
    display: flex;
    align-items: stretch;
    gap: var(--ch-spacing-sm);
    width: 100%;
    height: var(--ch-form-height);
}

/* --- Title & description text --- */

.ch-postcode-text,
.ch-location-prefix,
.ch-permit-options-title {
    font-weight: 700;
    color: var(--ch-color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-family: var(--e-global-typography-6fc7bc0-font-family), Large Body Proxima;

}

.ch-postcode-text p {
    margin: 0 0 var(--ch-spacing-md) 0;
    font-size: var(--ch-font-size-sm);
    color: var(--ch-color-text-light);
}

/* --- Input field --- */

.ch_postcode-input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: var(--ch-spacing-sm) var(--ch-spacing-md);
    font-size: var(--ch-font-size-base);
    font-family: var(--ch-font-family);
    color: var(--ch-color-text);
    background: var(--ch-bg-input);
    border: none;
    border-radius: var(--ch-border-radius);
    outline: none;
    transition: border-color var(--ch-transition-speed) var(--ch-transition-ease),
        box-shadow var(--ch-transition-speed) var(--ch-transition-ease);

    /* Prevent iOS from scrolling this behind the sticky header on focus */
    scroll-margin-top: 150px;
}

.ch_postcode-input::placeholder {
    /* color: var(--ch-color-text-muted); */
    /* text-transform: uppercase; */
    /* letter-spacing: 0.05em; */
    /* font-size: var(--ch-font-size-sm); */
    color: var(--ch-color-text);
}

.ch_postcode-input:focus {
    /* border-color: var(--ch-color-primary);
    box-shadow: 0 0 0 3px rgba(239, 72, 62, 0.15); */
    border: none;
}

/* --- Submit button --- */

.ch-submit-btn {
    text-wrap: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--ch-color-primary) !important;
    width: var(--ch-btn-width);
    min-width: var(--ch-btn-width);
    height: 100%;
    padding: 15px 25px !important;
    background: var(--ch-color-primary);
    color: var(--ch-color-accent);
    border: none;
    border-radius: 100vw !important;
    cursor: pointer;
    transition: background var(--ch-transition-speed) var(--ch-transition-ease),
        border-color var(--ch-transition-speed) var(--ch-transition-ease),
        transform var(--ch-transition-speed) var(--ch-transition-ease);
}

.ch-submit-btn:hover,
.ch-submit-btn:focus {
    background: var(--ch-color-primary-hover);
    border-color: var(--ch-color-primary-hover);
    transform: translateX(2px);
}

.ch-submit-btn svg {
    display: block;
    width: 100%;
    height: 100%;
}

.ch-submit-btn svg path {
    fill: var(--ch-color-accent);
}

/* --- Text colour helpers (used in titles) --- */

.ch-red {
    color: var(--ch-color-primary);
}

.ch-black {
    color: var(--ch-color-secondary);
}


/* ==========================================================================
   1a. POSTCODE FORM — Location Variants
   ========================================================================== */

/* --- Home variant ---
   Pill input + circular red arrow button on a clean background.
   ---------------------------------------------------------------- */

.ch-location-home .ch-postcode-text {
    display: none;
}

.ch-location-home .ch-flex-form {
    display: flex;
    align-items: center;
    gap: var(--ch-spacing-lg);
}

.ch-location-home .ch_postcode-input {
    padding: 0 var(--ch-spacing-lg);
    font-size: var(--ch-font-size-base);
    background: var(--ch-bg-light);
    border: none;
    border-radius: var(--ch-border-radius-pill);
    color: var(--ch-color-text-light);
}

.ch-dark-postcode .ch-location-home .ch_postcode-input,
.ch-dark-postcode .ch-location-home .ch_postcode-input::placeholder {
    background: var(--ch-bg-dark);
    color: var(--ch-bg-white);

}

.ch-location-home .ch_postcode-input:focus {
    /* box-shadow: 0 0 0 3px rgba(239, 72, 62, 0.15); */
}

.ch-location-home .ch-submit-btn {
    max-width: 85px;
}

.ch-location-home .ch-submit-btn:hover {
    background: var(--ch-color-primary-hover);
    transform: scale(1.05);
}

/* SVG sizing handled by base .ch-submit-btn svg rule */

/* --- Archive variant ---
   Compact inline form for the shop page.
   ---------------------------------------------------------------- */

.ch-location-archive {
    padding: var(--ch-spacing-md);
}

.ch-location-archive .ch-postcode-text {
    font-size: var(--ch-font-size-sm);

    color: var(--ch-color-text-light);
    margin-bottom: var(--ch-spacing-xs);
}

.ch-location-archive .ch_postcode-input {
    font-size: var(--ch-font-size-sm);
    padding: var(--ch-spacing-sm) var(--ch-spacing-md);
}

/* --- Product variant ---
   On single product pages, sits above add-to-cart.
   ---------------------------------------------------------------- */

/* .woocommerce-error {
    padding: 20px;
} */

.woocommerce-error::before {}

.ch-postcode-box.ch-location-product {}

.ch-location-product .ch-postcode-text,
.ch-location-prefix,
.ch-permit-options-title {
    font-size: var(--e-global-typography-6fc7bc0-font-size);
    font-weight: var(--e-global-typography-6fc7bc0-font-weight);
    text-transform: var(--e-global-typography-6fc7bc0-text-transform);
    font-style: var(--e-global-typography-6fc7bc0-font-style);
    color: var(--e-global-color-text);
}

.ch-location-product .ch-postcode-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ch-location-product .ch-flex-form {
    height: 50px;
    display: flex !important;
    gap: var(--ch-spacing-md);
}

.ch-location-product .ch_postcode-input {
    padding: 0 var(--ch-spacing-lg);
    font-size: var(--ch-font-size-base);
    background: var(--ch-bg-light);
    border: none;
    border-radius: var(--ch-border-radius-pill);
    color: var(--ch-color-text-light);
    flex: 1 1 calc(50% - var(--ch-spacing-md) / 2);
    max-width: calc(50% - var(--ch-spacing-md) / 2);
}

.ch-location-product .ch-submit-btn {}




/* ==========================================================================
   2. LOCATION STATUS BAR  (.ch-location-bar)
   ==========================================================================
   Shown when the user has already entered a postcode.
   Gets state classes: .ch-location-state-{archive|product|default}
   Plus style classes:  .ch-style-archive, .ch-style-product
   ========================================================================== */

.ch-location-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    /* flex-wrap: wrap;
    gap: var(--ch-spacing-sm);
    padding: var(--ch-spacing-md);

    font-family: var(--ch-font-family);
    font-size: var(--ch-font-size-sm);
    margin-bottom: var(--ch-spacing-lg); */
}

/* --- Prefix text --- */

/* .ch-location-prefix {
    color: var(--ch-color-text-light);
    text-transform: uppercase;

    font-size: var(--ch-font-size-sm);
} */

.ch-location-postcode {
    color: var(--ch-color-primary);
    font-weight: 700;
}

/* --- Change location link --- */

.ch-change-location-btn {
    text-wrap: nowrap;
    display: inline-flex;
    align-items: center;
    font-size: var(--ch-font-size-base);
    font-weight: 600;
    color: var(--ch-color-accent) !important;
    text-decoration: none;
    text-transform: uppercase;
    text-wrap: nowrap;
    border: none;
    border-radius: 100vw !important;
    padding: 15px 25px;
    background: var(--ch-color-primary) !important;
    transition: background var(--ch-transition-speed) var(--ch-transition-ease),
        color var(--ch-transition-speed) var(--ch-transition-ease);
}


.ch-change-location-btn:hover,
.ch-change-location-btn:focus {
    background: var(--ch-color-primary);
    color: var(--ch-color-accent);
    text-decoration: none;
}

.ch-location-product .ch-change-location-btn {
    padding: 5px 15px;
    font-family: var(--e-global-typography-6fc7bc0-font-family), Large Body Proxima;
    font-style: italic;
}

/* --- Archive style variant --- */

.ch-location-bar.ch-style-archive {
    /* background: var(--ch-bg-white);
    border-color: var(--ch-border-color); */
}

/* --- Product style variant --- */

.ch-location-bar.ch-style-product {
    /* background: var(--ch-bg-light);
    border-left: 3px solid var(--ch-color-primary); */
    width: fit-content;
    display: flex;
    flex-direction: row;
    gap: 20px;
}


/* ==========================================================================
   3. PERMIT OPTIONS  (.ch-permit-options)
   ==========================================================================
   Rendered by [cherry_hill_permit_options] shortcode.
   Card-style radio selection for Private Land vs On Road.
   ========================================================================== */

.ch-permit-options {
    margin-bottom: var(--ch-spacing-lg);
}

/* .ch-permit-options-title {
    font-weight: 700;
    text-transform: uppercase;
    color: var(--ch-color-secondary);
    margin: 0 0 var(--ch-spacing-md) 0;
} */

/* --- Card grid --- */

.ch-permit-cards {
    display: flex;
    flex-direction: column;
    gap: var(--ch-spacing-md);
}

/* --- Individual card --- */

.ch-permit-card {
    flex: 1;
    position: relative;
    cursor: pointer;
    margin: 0 !important;
    padding: 0 !important;
}

/* Hide the actual radio button */
.ch-permit-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ch-permit-card-inner {
    display: flex;
    align-items: center;
    gap: var(--ch-spacing-md);
    padding: var(--ch-spacing-md);
    border: 2px solid var(--ch-border-color);
    border-radius: 25px;
    transition: border-color var(--ch-transition-speed) var(--ch-transition-ease);
    height: 100%;
    background: var(--ch-bg-white);
}

/* Selected state — red border */
.ch-permit-card input[type="radio"]:checked~.ch-permit-card-inner {
    border-color: var(--ch-color-primary);
}

.ch-permit-card:hover .ch-permit-card-inner {
    border-color: #555;
}

/* Card image */
.ch-permit-card-inner img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Card label */
.ch-permit-card-label {
    font-weight: 600;
    color: var(--ch-color-secondary);
    font-size: var(--ch-font-size-base);
    line-height: 1.4;
}

.ch-permit-card-meta {
    font-weight: 400;
    font-size: var(--ch-font-size-sm);
    color: var(--ch-color-text-light);
}

/* --- Disclaimer (shown via JS when road is selected) --- */

.ch-permit-disclaimer {
    margin-top: var(--ch-spacing-md);
    font-size: var(--ch-font-size-base);
    color: var(--ch-color-text-light);
}

.ch-permit-disclaimer p {
    margin: 0 0 var(--ch-spacing-sm) 0;
}

.ch-permit-disclaimer ul {
    margin: 0;
    padding-left: var(--ch-spacing-lg);
}

.ch-permit-disclaimer li {
    margin-bottom: var(--ch-spacing-xs);
}

/* --- Responsive: stack cards on small screens --- */

@media (max-width: 480px) {
    .ch-permit-cards {
        flex-direction: column;
    }
}


/* ==========================================================================
   4. BOOKING FORM (.ch-booking-form)
   ==========================================================================
   Rendered by [cherry_hill_booking_form] shortcode.
   Unified product page form: permits, dates, waste types, terms.
   ========================================================================== */

.ch-booking-form {
    margin-bottom: var(--ch-spacing-lg);
}

/* --- Sections --- */

.ch-booking-section {
    margin-bottom: 40px;
}

.ch-booking-section-title {
    font-family: var(--e-global-typography-6fc7bc0-font-family), Large Body Proxima;
    font-size: var(--e-global-typography-6fc7bc0-font-size);
    font-weight: var(--e-global-typography-6fc7bc0-font-weight);
    text-transform: var(--e-global-typography-6fc7bc0-text-transform);
    font-style: var(--e-global-typography-6fc7bc0-font-style);
    color: var(--e-global-color-text);

    margin: 0 0 var(--ch-spacing-sm) 0;
    display: block;
}

.ch-required {
    color: var(--ch-color-primary);
}

/* --- Date pickers row --- */

.ch-date-row {
    display: flex;
    gap: var(--ch-spacing-md);
}

.ch-date-field {
    flex: 1;
    position: relative;
}

.ch-date-field::after {
    content: '';
    position: absolute;
    right: 20px;
    bottom: 15px;
    width: 20px;
    height: 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
}

.ch-date-field input {
    width: 100% !important;
    height: 50px !important;
    padding: 0 var(--ch-spacing-lg) !important;
    background: var(--ch-bg-light) !important;
    border: none !important;
    border-radius: var(--ch-border-radius-pill) !important;
    font-size: var(--ch-font-size-base) !important;
    font-family: inherit !important;
    color: var(--ch-color-text-light) !important;
    cursor: pointer !important;
    box-shadow: none !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.ch-date-field input:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* Hire days display */

.ch-hire-days {
    margin: var(--ch-spacing-sm) 0 0 0;
    font-size: var(--ch-font-size-sm);
    color: var(--ch-color-text-light);
}

.ch-hire-days span {
    font-weight: 700;
    color: var(--ch-color-primary);
}

/* --- Waste type cards (match permit card layout) --- */

.ch-waste-cards {
    display: flex;
    flex-direction: column;
    gap: var(--ch-spacing-md);
}

.ch-waste-card {
    position: relative;
    cursor: pointer;
    margin: 0 !important;
    padding: 0 !important;
}

.ch-waste-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.ch-waste-card .ch-permit-card-inner {
    padding: var(--ch-spacing-sm) var(--ch-spacing-md);
    gap: var(--ch-spacing-sm);
}

.ch-waste-card .ch-permit-card-inner img {
    width: 120px;
    height: 90px;
}

.ch-waste-card input[type="radio"]:checked~.ch-permit-card-inner {
    border-color: var(--ch-color-primary);
}

.ch-waste-card:hover .ch-permit-card-inner {
    border-color: #555;
}

/* --- Terms --- */

.ch-terms-label {
    display: flex !important;
    align-items: flex-start;
    gap: var(--ch-spacing-sm);
    cursor: pointer;
    font-size: var(--ch-font-size-base);
    color: var(--ch-color-text);
    line-height: 1.5;
    margin: 0 !important;
    padding: 0 !important;
}

.ch-terms-label input[type="checkbox"] {
    accent-color: var(--ch-color-primary);
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Flatpickr theme overrides */

.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: var(--ch-color-primary) !important;
    border-color: var(--ch-color-primary) !important;
}

.flatpickr-day.today {
    border-color: var(--ch-color-primary) !important;
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 600px) {

    /* Stack form on small screens when there's a title */
    .ch-location-archive .ch-flex-form,
    .ch-location-product .ch-flex-form {}

    .ch-location-archive .ch-submit-btn,
    .ch-location-product .ch-submit-btn {
        /* width: 100%; */
    }

    /* Stack location bar */
    .ch-location-bar {

        text-align: center;
    }

    /* Stack date pickers */
    .ch-date-row {
        flex-direction: column;
    }

    /* Stack permit & waste cards */
    .ch-permit-cards,
    .ch-waste-cards {
        flex-direction: column;
    }

    .ch-waste-card {
        max-width: 100%;
    }
}