/* ============================================
   Cabins Product Options – Frontend Styles
   ============================================ */

/* --- Sales message banner --- */
.cpo-sales-message {
    margin: 0 0 20px;
    padding: 14px 18px;
    background: #fff8e1;
    border: 2px solid #f9a825;
    border-left-width: 6px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 1.05em;
    color: #5d4037;
    line-height: 1.5;
}

/* --- Options section on single product --- */
.cpo-product-options {
    margin: 30px 0;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
}

.cpo-product-options h3 {
    margin: 0 0 8px;
    font-size: 1.2em;
    font-weight: 600;
}

.cpo-intro-text {
    margin: 0 0 20px;
    font-size: 0.95em;
    color: #444;
    line-height: 1.6;
}

.cpo-option-group {
    margin-bottom: 5px;
    padding-bottom: 5px;
    /*border-bottom: 1px solid #e0e0e0;*/
}

.cpo-option-group:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.cpo-option-group h4 {
    margin: 0 0 10px;
    font-size: 1.5em;
    font-weight: 600;
    color: #333;
}

.cpo-option-description {
    margin: -4px 0 12px;
    font-size: 0.9em;
    color: #666;
}

.cpo-option-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
}

/* Several radio sets under one heading (e.g. Add Double Glazing & Floor Option) */
.cpo-option-subgroup + .cpo-option-subgroup {
    margin-top: 20px;
}

.cpo-option-subheading {
    margin: 0 0 10px;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #333;
}

.cpo-option-item {
    position: relative;
    display: flex;
    width: calc(33.333% - 7px);
    box-sizing: border-box;
}

.cpo-option-item input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cpo-option-item label {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 20px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
    text-align: center;
    width: 100%;
    font-size: 0.95em;
    white-space: normal;
    word-break: break-word;
}

.cpo-option-item label:hover {
    border-color: #999;
}

.cpo-option-item input[type="radio"]:checked + label {
    border-color: #d13636 !important;
    background-color: #e8f5e9;
    border: dashed;
    background-color: #e8f5e9;
    font-weight: 600;
}

.cpo-option-price {
    display: block;
    font-size: 1em;
    color: #666;
    margin-top: 4px;
}

.cpo-option-price del {
    color: #999;
    margin-right: 4px;
}

.cpo-option-price ins {
    color: #c0392b;
    font-weight: 700;
    text-decoration: none;
}

.cpo-sale-badge {
    display: inline-block;
    background: #c0392b;
    color: #fff;
    font-size: 0.72em;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cpo-option-item.cpo-option-on-sale label {
    border-color: #e8b4b0;
    background-color: #fdf5f4;
}

.cpo-option-item.cpo-option-on-sale input[type="radio"]:checked + label {
    border-color: #c0392b;
    background-color: #fdecea;
}

.cpo-option-group--info {
    background: #f0f4ff;
    border: 1px solid #c5cfe8;
    border-radius: 6px;
    padding: 16px 20px;
}

.cpo-option-group--info h4 {
    color: #1a3a6b;
}

.cpo-option-group--info .cpo-option-description {
    font-style: normal;
    color: #333;
    font-size: 0.95em;
    margin-bottom: 0;
}

/* --- Conditionally hidden groups --- */
.cpo-option-group.cpo-group-hidden {
    display: none;
}

/* --- "None" / no-selection option --- */
.cpo-option-item.cpo-option-none label {
    background: #fff;
    border-style: dashed;
}

/* --- Inline totals box --- */
.cpo-inline-totals {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 24px;
    padding: 16px 20px;
    background: #1a3a6b;
    border-radius: 6px;
    color: #fff;
}

.cpo-inline-totals__breakdown {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.cpo-inline-totals__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cpo-inline-totals__row-label {
    font-size: 0.9em;
    opacity: 0.85;
}

.cpo-inline-totals__row-value {
    font-size: 0.9em;
    font-weight: 600;
    opacity: 0.85;
}

.cpo-inline-totals__row-value .woocommerce-Price-amount {
    color: #fff;
}

.cpo-inline-totals__final {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cpo-inline-totals__label {
    font-size: 1.1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.cpo-inline-totals__value {
    font-size: 1.4em;
    font-weight: 700;
}

.cpo-inline-totals__value .woocommerce-Price-amount {
    color: #fff;
}

/* --- Payment choice (full / deposit) --- */
.cpo-payment-choice {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.cpo-payment-choice__option {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2em;
}

.cpo-payment-choice__option input[type="radio"] {
    width: 22px;
    height: 22px;
    margin: 0;
    flex-shrink: 0;
    accent-color: #fff;
    cursor: pointer;
}

.cpo-payment-choice__option label {
    margin: 0;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.cpo-payment-choice__option .cpo-info-icon {
    width: 22px;
    height: 22px;
    font-size: 0.75em;
}

.cpo-payment-choice__option label .woocommerce-Price-amount {
    color: #fff;
}

.cpo-payment-choice__option.is-disabled label {
    opacity: 0.5;
    cursor: not-allowed;
}

.cpo-payment-choice .cpo-info-icon {
    background: #fff;
    color: #1a3a6b;
}

.cpo-payment-choice .cpo-info-icon:focus {
    outline-color: #fff;
}

/* --- Sticky totals box --- */
.cpo-sticky-totals {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 99999999999;
    background: #1a3a6b;
    border: none;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 20px 24px;
    min-width: 260px;
    max-width: 340px;
    font-size: 0.95em;
    transition: opacity 0.3s, transform 0.3s;
    display: none;
    color: #fff;
}

.cpo-sticky-totals h4 {
    margin: 0 0 12px;
    font-size: 0.8em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    padding-bottom: 8px;
    color: rgba(255, 255, 255, 0.75);
}

.cpo-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    color: rgba(255, 255, 255, 0.8);
}

.cpo-totals-row.cpo-totals-final {
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    margin-top: 10px;
    padding-top: 10px;
    font-weight: 700;
    font-size: 1.15em;
    color: #fff;
}

.cpo-sticky-totals .woocommerce-Price-amount,
.cpo-sticky-totals .woocommerce-Price-currencySymbol {
    color: inherit;
}

/* --- Cart option meta --- */
.cpo-cart-options {
    margin-top: 6px;
    font-size: 0.88em;
    color: #555;
}

.cpo-cart-options dt {
    font-weight: 600;
    display: inline;
}

.cpo-cart-options dd {
    display: inline;
    margin: 0 0 0 4px;
}

.cpo-cart-options dd::after {
    content: '';
    display: block;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .cpo-option-item {
        width: calc(50% - 5px);
    }
}

@media (max-width: 600px) {
    .cpo-sticky-totals {
        left: 10px;
        right: 10px;
        max-width: none;
        bottom: 10px;
    }

    .cpo-option-list {
        flex-direction: column;
    }

    .cpo-option-item {
        width: 100%;
    }

    .cpo-option-item label {
        min-width: auto;
    }
}

/* --- Option image thumbnails --- */
.cpo-option-item.cpo-has-image label {
    padding: 10px 14px 12px;
}

/* --- Select / dropdown groups --- */
.cpo-select-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cpo-select-image-wrap {
    flex: 0 0 auto;
    position: relative;
}

.cpo-select-image-wrap .cpo-option-thumb-zoom {
    top: 8px;
    right: 8px;
}

.cpo-select-image {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    border-radius: 4px;
}

.cpo-select-input-wrap {
    display: flex;
    align-items: center;
}

.cpo-option-select {
    font-size: 1em;
    padding: 8px 36px 8px 12px;
    border: 2px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    background-color: #fff;
    appearance: auto;
}

.cpo-option-select:focus {
    outline: none;
    border-color: #333;
}

.cpo-option-thumb-wrap {
    display: block;
    margin-bottom: 8px;
    line-height: 0;
}

.cpo-option-thumb {
    width: 160px;
    height: 160px;
    object-fit: cover;
    border-radius: 3px;
    display: block;
}

.cpo-option-thumb-zoom {
    position: absolute;
    top: 18px;
    right: 42px;
    z-index: 2;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: background-color 0.15s;
}

.cpo-option-thumb-zoom:hover {
    background: rgba(0, 0, 0, 0.8);
}

.cpo-option-thumb-zoom svg {
    width: 13px;
    height: 13px;
    fill: #fff;
    display: block;
}

/* --- Lightbox modal --- */
.cpo-lightbox {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.cpo-lightbox.is-open {
    display: flex;
}

.cpo-lightbox__backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.82);
}

.cpo-lightbox__content {
    position: relative;
    z-index: 1;
    max-width: 90vw;
    max-height: 90vh;
}

.cpo-lightbox__img {
    display: block;
    max-width: 100%;
    max-height: 90vh;
    border-radius: 4px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.cpo-lightbox__close {
    position: absolute;
    top: -14px;
    right: -14px;
    width: 30px;
    height: 30px;
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #333;
    transition: background-color 0.15s;
}

.cpo-lightbox__close:hover {
    background: #eee;
}

/* --- Checkbox option groups (e.g. Sauna Options) --- */
.cpo-option-group--checkbox .cpo-checkbox-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Sub-headed section inside a checkbox group (e.g. Garage Options).
   Each section is a single grid cell, so sections sit side by side. */
.cpo-checkbox-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.cpo-checkbox-section .cpo-checkbox-item {
    flex: 1;
}

.cpo-checkbox-subheading {
    margin: 0;
    font-size: 1em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: #333;
}

.cpo-checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0;
    background: #fff;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 14px 16px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.cpo-checkbox-item:has(input:checked) {
    border-color: #d13636;
    border-style: dashed;
    background-color: #e8f5e9;
}

.cpo-checkbox-item input[type="checkbox"],
.cpo-checkbox-item input[type="radio"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: #d13636;
    margin: 2px 12px 0 0;
}

.cpo-checkbox-item label {
    display: flex;
    flex-direction: column;
    gap: 0px;
    cursor: pointer;
    font-size: 0.95em;
    margin: 0;
    flex: 1;
    line-height: 1.4;
}

.cpo-checkbox-item .cpo-label-price {
    display: block;
}

.cpo-checkbox-item--select {
    align-items: stretch;
}

.cpo-checkbox-item__select-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cpo-checkbox-item__select-header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cpo-checkbox-item__select-header .cpo-checkbox-label-text {
    font-size: 0.95em;
    line-height: 1.4;
    cursor: default;
}

.cpo-checkbox-item--select select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.95em;
    cursor: pointer;
}

/* --- Quantity stepper item --- */
.cpo-checkbox-item--quantity {
    align-items: stretch;
}

/* Full-width row (spanning all three option columns) with a large image */
.cpo-qty-has-image {
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    align-items: center;
}

.cpo-qty-thumb {
    position: relative;
    flex: 0 0 auto;
    width: calc(33.333% - 7px);
    line-height: 0;
}

.cpo-qty-thumb .cpo-option-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    cursor: zoom-in;
}

.cpo-qty-heading {
    margin: 0 0 2px;
}

.cpo-qty-has-image .cpo-qty-unit-price {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
}

.cpo-qty-has-image .cpo-qty-price-display {
    font-size: 1.1em;
    font-weight: 700;
}

/* Keep the -/+ counter compact rather than stretching across the wide row */
.cpo-qty-has-image .cpo-qty-controls {
    width: auto;
}

.cpo-qty-has-image .cpo-qty-input {
    flex: 0 0 52px;
    width: 52px;
    max-width: 52px;
}

@media (max-width: 600px) {
    .cpo-qty-has-image {
        flex-direction: column;
        align-items: stretch;
    }

    .cpo-qty-thumb {
        width: 100%;
    }
}

.cpo-qty-thumb .cpo-option-thumb-zoom {
    top: 6px;
    right: 6px;
}

.cpo-qty-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.cpo-qty-label-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.cpo-qty-controls {
    display: flex;
    align-items: center;
    gap: 0;
    width: 40%;
}

.cpo-qty-btn {
    width: 34px;
    height: 34px;
    background: #1a3a6b;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1.2em;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cpo-qty-btn:hover {
    background: #d13636;
}

.cpo-qty-input {
    width: 52px;
    height: 34px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 0;
    font-size: 1em;
    padding: 0;
    -moz-appearance: textfield;
}

.cpo-qty-input::-webkit-outer-spin-button,
.cpo-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cpo-qty-price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.cpo-qty-unit-price {
    font-size: 0.82em;
    color: #888;
}

.cpo-qty-price-display.is-hidden {
    display: none;
}

.cpo-qty-price-display {
    font-size: 0.9em;
    color: #1a3a6b;
    font-weight: 600;
}

/* --- Rich tooltip modal --- */
.cpo-rich-modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 99999;
    align-items: center;
    justify-content: center;
}

.cpo-rich-modal.is-open {
    display: flex;
}

.cpo-rich-modal__backdrop {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.78);
}

.cpo-rich-modal__content {
    position: relative;
    z-index: 1;
    width: min(90vw, 680px);
    max-height: 85vh;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
    overflow-y: auto;
    padding: 36px 40px 32px;
}

.cpo-rich-modal__close {
    position: absolute;
    top: 12px;
    right: 14px;
    width: 32px;
    height: 32px;
    background: #f0f0f0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #333;
    transition: background-color 0.15s;
}

.cpo-rich-modal__close:hover {
    background: #ddd;
}

.cpo-rich-modal__body {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cpo-rich-modal__item {
    padding: 18px 0;
    border-bottom: 1px solid #e8e8e8;
}

.cpo-rich-modal__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cpo-rich-modal__item:first-child {
    padding-top: 0;
}

.cpo-rich-modal__item-title {
    font-size: 1em;
    font-weight: 700;
    color: #1a3a6b;
    margin: 0 0 6px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cpo-rich-modal__item-desc {
    font-size: 0.95em;
    color: #444;
    line-height: 1.6;
    margin: 0;
}

.cpo-rich-modal__item-list {
    margin: 10px 0 0;
    padding-left: 1.25em;
    font-size: 0.95em;
    color: #444;
    line-height: 1.6;
}

.cpo-rich-modal__item-list li {
    margin-bottom: 6px;
}

.cpo-rich-modal__item-list a,
.cpo-rich-modal__item-note a {
    color: #1a3a6b;
    font-weight: 600;
    text-decoration: underline;
}

.cpo-rich-modal__item-note a {
    color: #fff;
}

.cpo-rich-modal__item-note {
    margin: 18px 0 0;
    padding: 14px 18px;
    background: #1a3a6b;
    border-radius: 6px;
    font-size: 1.15em;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

@media (max-width: 600px) {
    .cpo-option-group--checkbox .cpo-checkbox-list {
        grid-template-columns: 1fr;
    }
}

/* --- Info icon --- */
.cpo-info-icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1a3a6b;
    color: #fff;
    font-size: 0.72em;
    font-style: italic;
    font-weight: 700;
    font-family: Georgia, serif;
    cursor: pointer;
    flex-shrink: 0;
    user-select: none;
    line-height: 1;
}

.cpo-info-icon:focus {
    outline: 2px solid #1a3a6b;
    outline-offset: 2px;
}

/* --- Tooltip --- */
.cpo-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 260px;
    background: #222;
    color: #fff;
    font-size: 1.1rem;
    font-style: normal;
    font-weight: 400;
    line-height: 1.5;
    padding: 10px 12px;
    border-radius: 5px;
    z-index: 999;
    white-space: normal;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    pointer-events: none;
}

.cpo-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #222;
}

.cpo-info-icon.is-open .cpo-tooltip {
    display: block;
}

/* --- Accordion toggle --- */
.cpo-group-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;

    border-radius: 4px;
    padding: 12px 16px;
    font-size: 1.05em;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    text-align: left;
    transition: background-color 0.2s, border-color 0.2s;
    line-height: 1.3;
}

.cpo-group-toggle:hover {
    background: #e2e5ec;
    border-color: #b0b6c8;
}

.cpo-group-toggle__title {
    flex: 1;
}

.cpo-group-toggle__arrow {
    flex-shrink: 0;
    width: 9px;
    height: 9px;
    border-right: 2px solid #555;
    border-bottom: 2px solid #555;
    transform: rotate(45deg);
    transition: transform 0.25s ease;
    margin-left: 14px;
    margin-bottom: 3px;
}

.cpo-group-accordion.is-open .cpo-group-toggle__arrow {
    transform: rotate(-135deg);
    margin-bottom: -3px;
}

.cpo-group-accordion.is-open .cpo-group-toggle {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom-color: transparent;
}

.cpo-group-body {
    display: none;
    padding: 16px 0 0;
}

.cpo-group-accordion.is-open .cpo-group-body {
    display: block;
}

/* --- Extension add-on pricing table --- */
.cpo-extension-pricing-table {
    margin-top: 16px;
}

.cpo-extension-pricing-table.is-hidden {
    display: none;
}

.cpo-option-price--extension {
    color: #D51616;
}

.cpo-option-group[data-group="cpo_grid_base"] .cpo-option-price {
    color: #D51616;
}

.cpo-extension-pricing-table__desc {
    font-size: 0.88em;
    color: #555;
    margin: 12px 0 10px;
    line-height: 1.5;
}

.cpo-extension-pricing-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
}

.cpo-extension-pricing-table th,
.cpo-extension-pricing-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.cpo-extension-pricing-table thead th {
    background: #f4f6fa;
    font-weight: 600;
    color: #1a3a6b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.82em;
}

.cpo-extension-pricing-table tbody tr:last-child td {
    border-bottom: none;
}

.cpo-extension-pricing-table tbody td:last-child {
    text-align: right;
    font-weight: 600;
    color: #1a3a6b;
}
