/**
 * Frontend Styles – Woo Custom Weight Input
 * Version: 1.3.0
 * 
 * FIXES:
 * - Button now renders in correct position (no flexbox reordering needed)
 * - Proper spacing and visual hierarchy
 */

/* ==============================================================
 * GENERIC UTILITIES
 * ============================================================== */
.wcwi-hidden {
    display: none !important;
}

.wcwi-variants-hidden {
    display: none !important;
}

/* Hide WC's default button when it's wrapped in our hidden container */
.wcwi-hidden-default-button {
    display: none !important;
}

/* ==============================================================
 * CUSTOM WEIGHT WRAPPER
 * ============================================================== */
.wcwi-custom-weight-wrapper {
    margin: 15px 0;
    padding: 0;
    background: transparent;
    border: none;
}

/* ==============================================================
 * CHECKBOX ROW
 * ============================================================== */
.wcwi-checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.wcwi-checkbox-wrapper input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #0073aa;
}

.wcwi-checkbox-wrapper label {
    display: inline-block;
    font-size: 15px;
    font-weight: 400;
    color: #555;
    cursor: pointer;
    margin: 0;
    transition: color 0.2s;
}

.wcwi-checkbox-wrapper input[type="checkbox"]:checked + label {
    color: #333;
    font-weight: 600;
}

/* ==============================================================
 * SLIDING PANEL
 * ============================================================== */
.wcwi-weight-input-wrapper {
    margin-top: 14px;
    padding: 16px;
    background: #f7f9fb;
    border: 1px solid #dde2e7;
    border-radius: 6px;
}

/* ==============================================================
 * WEIGHT INPUT
 * ============================================================== */
.wcwi-input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcwi-input-row {
    display: flex;
    align-items: stretch;
    gap: 0;
}

.wcwi-weight-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 18px;
    font-weight: 600;
    border: 2px solid #cdd4db;
    border-radius: 6px 0 0 6px;
    background: #fff;
    color: #222;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -moz-appearance: textfield;
}

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

.wcwi-weight-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.wcwi-unit-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    background: #0073aa;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    border-radius: 0 6px 6px 0;
    white-space: nowrap;
}

/* ==============================================================
 * PRICE DISPLAY
 * ============================================================== */
.wcwi-price-display {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #dde2e7;
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.wcwi-price-label {
    font-size: 13px;
    color: #666;
    white-space: nowrap;
}

.wcwi-calculated-price {
    font-size: 22px;
    font-weight: 700;
    color: #0073aa;
    transition: color 0.2s;
}

.wcwi-calculated-price .woocommerce-Price-amount {
    color: inherit;
}

/* ==============================================================
 * PACKING OPTIONS
 * ============================================================== */
.wcwi-packing-group {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #dde2e7;
}

.wcwi-packing-group > label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcwi-packing-option-item {
    margin-bottom: 10px;
}

.wcwi-packing-option-item label {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: color 0.2s;
}

.wcwi-packing-option-item label:hover {
    color: #0073aa;
}

.wcwi-packing-radio {
    margin-right: 8px;
    cursor: pointer;
}

.wcwi-custom-packing-input {
    margin-left: 24px;
}

.wcwi-packing-text-input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #333;
    background: #fff;
    border: 2px solid #cdd4db;
    border-radius: 6px;
    resize: vertical;
    min-height: 60px;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wcwi-packing-text-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.15);
}

.wcwi-packing-text-input::placeholder {
    color: #999;
}

/* ==============================================================
 * CUTTING STYLES
 * ============================================================== */
.wcwi-cutting-group {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #dde2e7;
}

.wcwi-cutting-group > label {
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcwi-cutting-option-item {
    margin-bottom: 10px;
}

.wcwi-cutting-option-item label {
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: color 0.2s;
}

.wcwi-cutting-option-item label:hover {
    color: #0073aa;
}

.wcwi-cutting-radio {
    margin-right: 8px;
    cursor: pointer;
}

/* ==============================================================
 * SUGGESTION MESSAGE
 * ============================================================== */
.wcwi-suggestion-message {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #fff8dc;
    border: 1px solid #f0e68c;
    border-radius: 4px;
    color: #856404;
    font-size: 13px;
    line-height: 1.5;
}

.wcwi-suggestion-icon {
    font-size: 18px;
    margin-right: 8px;
    flex-shrink: 0;
}

.wcwi-suggestion-text {
    flex: 1;
}

/* ==============================================================
 * FIX: ADD TO CART BUTTON - PROPER POSITIONING
 * 
 * The button now renders in the correct position in the DOM
 * (after packing notes), so we just need proper spacing.
 * No flexbox reordering needed.
 * ============================================================== */
.wcwi-button-container {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid #dde2e7;
}

.wcwi-custom-add-to-cart {
    width: 100%;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
}

.wcwi-custom-add-to-cart:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 115, 170, 0.3);
}

.wcwi-custom-add-to-cart:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 115, 170, 0.2);
}

.wcwi-custom-add-to-cart:disabled,
.wcwi-custom-add-to-cart.disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.wcwi-custom-add-to-cart:disabled:hover,
.wcwi-custom-add-to-cart.disabled:hover {
    background: #ccc;
    transform: none;
}

/* ==============================================================
 * VALIDATION STATE
 * ============================================================== */
.wcwi-weight-input:invalid {
    border-color: #d63638;
}

.wcwi-checkbox-wrapper input[type="checkbox"]:focus-visible {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* ==============================================================
 * RESPONSIVE
 * ============================================================== */
@media (max-width: 600px) {
    .wcwi-weight-input-wrapper {
        padding: 12px;
    }
    .wcwi-calculated-price {
        font-size: 18px;
    }
    .wcwi-custom-add-to-cart {
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* ==============================================================
 * ADMIN ORDER META
 * ============================================================== */
.wcwi-order-meta {
    padding: 15px;
    background: #f9fafb;
    border: 1px solid #0073aa;
    border-radius: 6px;
    margin-top: 12px;
}

.wcwi-order-meta h4 {
    margin: 0 0 10px 0;
    padding: 0 0 8px 0;
    color: #0073aa;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #0073aa;
}

.wcwi-details-table {
    width: 100%;
    margin: 0;
    border-collapse: collapse;
    background: #fff;
    border-radius: 4px;
    overflow: hidden;
}

.wcwi-details-table tr {
    border-bottom: 1px solid #e5e5e5;
}

.wcwi-details-table tr:last-child {
    border-bottom: none;
}

.wcwi-details-table td {
    padding: 10px 14px;
    font-size: 14px;
}

.wcwi-details-table td:first-child {
    font-weight: 600;
    color: #555;
    width: 40%;
    background: #f0f4f8;
}

.wcwi-details-table td:last-child {
    color: #333;
    font-weight: 500;
}

/* ==============================================================
 * CART DISPLAY
 * ============================================================== */
.woocommerce-cart-form__cart-item dl.variation {
    margin-top: 6px;
}

.woocommerce-cart-form__cart-item dl.variation dt,
.woocommerce-cart-form__cart-item dl.variation dd {
    display: inline;
    margin: 0 4px 4px 0;
}

.woocommerce-cart-form__cart-item dl.variation dt {
    font-weight: 600;
}

/* Fixed quantity display in cart for custom weight items */
.wcwi-quantity-fixed {
    display: inline-block;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 3px;
    font-weight: 600;
}
