/**
 * Portallio Sync frontend styles
 *
 * Styles for range product amount selector, preset buttons, and variable swatches.
 *
 * @package Portallio
 * @since 1.0.0
 */

/* =========================================================
   Range Amount Selector Wrapper
   ========================================================= */
.portallio-range-amount-wrapper {
    background: #fdfdfd;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    font-family: inherit;
}
.portallio-range-amount-wrapper label {
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    display: block;
    font-size: 15px;
}

/* =========================================================
   Range Presets (Fixed Denomination Buttons)
   ========================================================= */
.portallio-range-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.portallio-range-preset {
    background: #ffffff;
    border: 1px solid #cbd5e0;
    color: #4a5568;
    padding: 8px 14px;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.portallio-range-preset:hover {
    background: #f7fafc;
    border-color: #a0aec0;
    color: #2d3748;
}
.portallio-range-preset.active {
    background: #3182ce;
    border-color: #3182ce;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.4);
}
.portallio-range-preset:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #edf2f7;
    border-color: #e2e8f0;
    color: #a0aec0;
}

/* =========================================================
   Custom Amount Input Box (Range Products)
   ========================================================= */
.portallio-range-amount-input-wrapper {
    margin-top: 10px;
}
.portallio-range-amount-input-wrapper input {
    border: 1px solid #cbd5e0;
    padding: 10px 14px;
    border-radius: 8px;
    width: 100%;
    font-size: 15px;
    box-sizing: border-box;
}
.portallio-range-amount-input-wrapper input:focus {
    border-color: #3182ce;
    outline: none;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
}
.portallio-range-amount-preview {
    font-weight: 600;
    color: #2d3748;
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.5;
    background: #ebf8ff;
    border-left: 4px solid #3182ce;
    border-radius: 6px;
    padding: 10px 14px;
    overflow-wrap: anywhere;
}
.portallio-range-amount-preview[hidden] {
    display: none;
}
.portallio-range-amount-preview.is-error {
    background: #fff5f5;
    border-left-color: #c53030;
    color: #9b2c2c;
}

.portallio-input-container {
    margin-bottom: 10px;
}
.portallio-range-amount .portallio-range-amount-input {
    font-size: 16px;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #cbd5e0;
    width: 100%;
    max-width: 300px;
    box-sizing: border-box;
    transition: all 0.2s ease-in-out;
    font-weight: 600;
    color: #2d3748;
    background-color: #ffffff;
}
.portallio-range-amount .portallio-range-amount-input:focus {
    border-color: #3182ce;
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.35);
}
.portallio-range-amount .portallio-range-amount-input[aria-invalid="true"] {
    border-color: #c53030;
}
.portallio-range-amount .portallio-range-amount-input:disabled {
    background-color: #edf2f7;
    color: #a0aec0;
    cursor: not-allowed;
}
.portallio-range-preset:focus-visible {
    outline: 2px solid #3182ce;
    outline-offset: 2px;
}

.portallio-range-help {
    display: block;
    color: #4a5568;
    font-size: 13px;
    line-height: 1.4;
}

.portallio-range-unavailable {
    margin: 0 0 15px;
}

@media (max-width: 480px) {
    .portallio-range-amount-wrapper {
        padding: 14px;
    }
    .portallio-range-presets {
        gap: 6px;
    }
    .portallio-range-preset {
        padding: 8px 10px;
        font-size: 13px;
    }
    .portallio-range-amount .portallio-range-amount-input {
        max-width: none;
    }
}
.portallio-range-note {
    font-weight: 500;
    display: block;
    margin-top: 4px;
}

/* =========================================================
   Variable Product Swatches
   ========================================================= */
select[data-portallio-swatch-source] {
    display: none !important;
}
.portallio-swatch-help {
    display: block;
    color: #718096;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 8px;
    font-weight: 500;
}
.portallio-variable-swatch-wrapper.portallio-range-amount-wrapper {
    background: #fdfdfd;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-top: 10px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    font-family: inherit;
}
.portallio-variable-swatch-wrapper .portallio-range-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}
.portallio-variable-swatch-wrapper .portallio-range-preset {
    background: #ffffff;
    border: 1px solid #cbd5e0;
    color: #4a5568;
    padding: 8px 14px;
    font-size: 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.portallio-variable-swatch-wrapper .portallio-range-preset:hover:not(:disabled) {
    background: #f7fafc;
    border-color: #a0aec0;
    color: #2d3748;
}
.portallio-variable-swatch-wrapper .portallio-range-preset.active:not(:disabled) {
    background: #3182ce;
    border-color: #3182ce;
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.4);
}
.portallio-variable-swatch-wrapper .portallio-range-preset:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #edf2f7;
    border-color: #e2e8f0;
    color: #a0aec0;
}

/* Stack variations layout vertically for clean card rendering */
.woocommerce div.product form.cart .variations tr,
.woocommerce-page div.product form.cart .variations tr,
.variations tr {
    display: block !important;
    margin-bottom: 15px !important;
    clear: both !important;
}
.woocommerce div.product form.cart .variations td,
.woocommerce-page div.product form.cart .variations td,
.variations td {
    display: block !important;
    width: 100% !important;
    padding: 0 !important;
    float: none !important;
    clear: both !important;
}
.woocommerce div.product form.cart .variations td.label,
.variations td.label {
    margin-bottom: 8px !important;
}
.variations td.label label,
.variations label,
.variations_form label,
label[for="pa_face-value"],
label[for="face-value"] {
    color: #1a202c !important;
    font-weight: 700 !important;
    font-size: 15px !important;
    display: inline-block !important;
    margin-bottom: 8px !important;
}

.portallio-selected-variation-info {
    font-size: 15px;
    font-weight: 700;
    color: #1a202c;
    background: #e6fffa;
    border-left: 4px solid #0b4f49;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    text-shadow: none;
    box-shadow: none;
}
.portallio-selected-variation-sep {
    color: #cbd5e0;
}
