/**
 * Universal Custom Fields (UCF) - General Styles
 */

/* ========================================
   Product Add-ons (Frontend)
   ======================================== */

.ucf-product-addons {
    margin: 20px 0;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.ucf-addon-field {
    margin-bottom: 15px;
}

.ucf-addon-field:last-child {
    margin-bottom: 0;
}

.ucf-addon-field label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.ucf-addon-field label .required {
    color: #e74c3c;
    text-decoration: none;
    font-weight: bold;
}

.ucf-addon-field select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 14px;
    background-color: #fff;
    transition: border-color 0.2s ease;
}

.ucf-addon-field select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.ucf-addon-field select:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    opacity: 0.6;
}

/* WooCommerce integration */
.single-product .ucf-product-addons {
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .ucf-product-addons {
        padding: 12px;
    }

    .ucf-addon-field select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ========================================
   Admin Table Columns (Backend)
   ======================================== */

/* UCF Columns in WP Admin Tables (Users, Orders, Products) */
.wp-list-table [class*="column-ucf_"] {
    width: auto;
    max-width: 150px;
    min-width: 80px;
}

/* Ensure text wraps properly in narrow columns */
.wp-list-table [class*="column-ucf_"] {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Truncate long text with ellipsis */
.wp-list-table [class*="column-ucf_"] {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Allow wrapping for multi-term displays */
.wp-list-table [class*="column-ucf_"] a {
    display: inline;
    white-space: normal;
}

/* Ensure proper alignment */
.wp-list-table [class*="column-ucf_"] {
    vertical-align: middle;
}

/* Empty cell indicator (matches WordPress default) */
.wp-list-table [class*="column-ucf_"] .na,
.wp-list-table [class*="column-ucf_"] span[aria-hidden="true"] {
    color: #a0a5aa;
    font-weight: 400;
}

/* ========================================
   UCF Admin Page - Option rows
   ========================================

   MOVED to assets/css/ucf-admin.css.

   This file is enqueued on the FRONTEND as well as in admin, under three
   separate handles, so admin-editor rules were being shipped to every
   checkout and account page that loaded it. A second, partially-overriding
   copy of the same selectors also lived at the end of this file; both are
   now in one place.
   ======================================== */

/* ========================================
   UCF Radio field - column layout
   ======================================== */

/* Top-level field label only (not the per-option labels inside the wrapper). */
.ucf-radio-field > label {
    display: block;
    margin: 0 0 7.5px;
    cursor: pointer;
}

/* Admin contexts wrap each radio + text in span.ucf-radio-row so they stay
   on one row regardless of theme defaults. */
.ucf-radio-field .ucf-radio-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ucf-radio-field input[type="radio"] {
    vertical-align: middle;
}

/* WooCommerce sometimes wraps radio fields in <ul>; normalize the list. */
.ucf-radio-field ul,
p.ucf-radio-field ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ucf-radio-field ul li {
    margin: 0 0 4px;
    list-style: none;
}

/* Checkout markup: WooCommerce renders each radio as <input> + <label class="radio">
   directly inside <span class="woocommerce-input-wrapper">. A 2-column grid
   (radio | label) with dense auto-flow pairs each input with its following
   label on one row, then stacks rows — input + label side-by-side, not stacked. */
.ucf-radio-field span.woocommerce-input-wrapper {
    display: grid;
    grid: auto-flow dense / 25px 1fr;
    grid-gap: 5px 0;
    align-items: center;
}

.ucf-radio-field span.woocommerce-input-wrapper > input[type=radio] {
    width: 15px;
}

.ucf-radio-field span.woocommerce-input-wrapper > label.radio {
    cursor: pointer;
}

/* Required radios: woocommerce_form_field() appends the required asterisk
   (<span class="required">*</span>) to EVERY label, including each per-option
   label.radio. Keep the asterisk on the field's main label, but hide the
   redundant ones on the individual radio option labels. */
.ucf-radio-field span.woocommerce-input-wrapper > label.radio .required {
    display: none;
}
