/* Product Advanced Field - Frontend Styles */

.wcek-field-group {
    margin: 20px 0;
}

.wcek-group-title {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
}

.wcek-group-description {
    margin: 0 0 15px;
    color: #666;
}

/* Field Layout */
.wcek-fields {
    display: grid;
    gap: 15px;
}

.wcek-columns-1 {
    grid-template-columns: 1fr;
}

.wcek-columns-2 {
    grid-template-columns: repeat(2, 1fr);
}

.wcek-columns-3 {
    grid-template-columns: repeat(3, 1fr);
}

.wcek-columns-4 {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 768px) {

    .wcek-columns-2,
    .wcek-columns-3,
    .wcek-columns-4 {
        grid-template-columns: 1fr;
    }
}

/* Field Styles */
.wcek-field {
    display: flex;
    flex-direction: column;
}

.wcek-label-left .wcek-field,
.wcek-label-right .wcek-field {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.wcek-label-left .wcek-field-label {
    min-width: 120px;
}

.wcek-label-right .wcek-field {
    flex-direction: row-reverse;
}

.wcek-field-label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.wcek-field-label .required {
    color: #dc3232;
}

.wcek-field-input {
    flex: 1;
}

/* Input Styles */
.wcek-input,
.wcek-textarea,
.wcek-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.wcek-input:focus,
.wcek-textarea:focus,
.wcek-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.wcek-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Checkbox and Radio */
.wcek-checkbox-group,
.wcek-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wcek-checkbox-label,
.wcek-radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.wcek-checkbox,
.wcek-radio {
    margin: 0;
}

/* Radio as buttons - matches WoodMart variation swatches (text style) */
.wcek-field-buttons {
    /* Flatsome primary color, WoodMart swatch blue otherwise */
    --wcek-btn-active: var(--primary-color, #1e73be);
}

/* Font/colon are copied from the theme's attribute labels in JS (matchThemeLabels) */
.wcek-field-buttons .wcek-field-label {
    margin-bottom: 10px;
    font-weight: 600;
}

.wcek-field-buttons .wcek-label-text[data-suffix]::after {
    content: attr(data-suffix);
}

/* A default option is always pre-selected, the asterisk is just noise */
.wcek-field-buttons .wcek-label-text .required {
    display: none;
}

.wcek-radio-group.wcek-radio-buttons {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px 15px;
}

.wcek-radio-buttons .wcek-radio-label {
    position: relative;
    gap: 0;
    margin: 0;
}

.wcek-field-input .wcek-radio-buttons .wcek-radio {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
    pointer-events: none;
}

.wcek-radio-buttons .wcek-radio + span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 35px;
    height: 35px;
    padding: 0 7px;
    border: 1px solid rgba(0, 0, 0, 0.075);
    border-radius: 5px;
    background-color: transparent;
    color: #242424;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.wcek-radio-buttons .wcek-radio-label:hover .wcek-radio + span {
    border-color: rgba(0, 0, 0, 0.2);
}

.wcek-radio-buttons .wcek-radio:checked + span {
    background-color: var(--wcek-btn-active);
    border-color: var(--wcek-btn-active);
    color: #fff;
}

.wcek-radio-buttons .wcek-radio:focus-visible + span {
    outline: 2px solid var(--wcek-btn-active);
    outline-offset: 2px;
}

.wcek-field.error .wcek-radio-buttons .wcek-radio + span {
    border-color: #dc3232;
}

/* Fields shown after a variation attribute */
.wcek-variation-row .wcek-field-group,
.wcek-after-attribute .wcek-field-group {
    margin: 0;
}

.wcek-after-attribute {
    margin-top: 15px;
}

.wcek-variation-row .wcek-after-attribute {
    margin-top: 0;
}

/* Themes (e.g. WoodMart) add ":" after every label in table.variations */
table.variations .wcek-variation-row label::after,
table.variations .wcek-after-attribute label::after {
    content: none;
}

/* Field Description */
.wcek-field-description {
    margin: 5px 0 0;
    font-size: 12px;
    color: #666;
    font-style: italic;
}

/* Required Field */
.wcek-required .wcek-field-label {
    position: relative;
}

/* Error State */
.wcek-field.error .wcek-input,
.wcek-field.error .wcek-textarea,
.wcek-field.error .wcek-select {
    border-color: #dc3232;
}

.wcek-field-error {
    color: #dc3232;
    font-size: 12px;
    margin-top: 5px;
}