/*
 * MYAPF frontend styles.
 */

/*
 * Simple product fields layout.
 *
 * Keep MYAPF fields on their own full-width row
 * inside the WooCommerce add-to-cart form.
 */
.single-product form.cart {
    flex-wrap: wrap !important;
}

.single-product form.cart .myapf-simple-fields-row {
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}

/*
 * ==========================================================
 * MYAPF Product Fields
 * ==========================================================
 */

/*
 * Field group card.
 */
.single-product .myapf-product-field-group {
    width: 100%;
    margin: 0 0 30px;
    padding: 28px;

    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 16px;

    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);

    box-sizing: border-box;
}

/*
 * Field group title.
 */
.single-product .myapf-product-field-group-title {
    margin: 0 0 22px;

    font-size: 19px;
    font-weight: 700;
    line-height: 1.3;

    color: #d62828;
}

/*
 * Field hover / focus highlight.
 */
.single-product .myapf-field {
    border-radius: 10px;
    padding: 6px;
    transition:
        background-color 0.2s ease,
        box-shadow 0.2s ease;
}

.single-product .myapf-field:hover {
    background: #fafafa;
    box-shadow: 0 0 0 2px rgba(214, 40, 40, 0.10);
}

/*
 * Keep the field highlighted while an input
 * inside it is active.
 */
.single-product .myapf-field:focus-within {
    background: #fafafa;
    box-shadow: 0 0 0 2px rgba(214, 40, 40, 0.15);
}

/*
 * ==========================================================
 * Field layout
 * ==========================================================
 */

/*
 * Column field grid on desktop.
 */
.single-product .myapf-product-field-group {
    display: grid;
    column-gap: 20px;
    row-gap: 20px;
}

/*
 * One-column Field Group layout.
 */
.single-product .myapf-product-field-group.myapf-layout-1-column {
    grid-template-columns: 1fr;
}

/*
 * Two-column Field Group layout.
 */
.single-product .myapf-product-field-group.myapf-layout-2-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/*
 * Group title always occupies the full row.
 */
.single-product .myapf-product-field-group-title {
    grid-column: 1 / -1;
}

/*
 * Individual fields.
 */
.single-product .myapf-product-field-group > .myapf-field {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/*
 * Text, number and select controls.
 */
.single-product .myapf-text-input,
.single-product .myapf-number-input,
.single-product .myapf-select-input {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/*
 * Mobile: one field per row.
 */
@media (max-width: 768px) {

    .single-product .myapf-product-field-group {
        grid-template-columns: 1fr;
    }

    .single-product .myapf-product-field-group-title {
        grid-column: 1;
    }
}

/*
 * ==========================================================
 * Field instructions
 * ==========================================================
 */

.single-product .myapf-field-instructions {
    margin: 6px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: #777;
}

/*
 * ==========================================================
 * Standard fields
 * Text / Number / Select
 * ==========================================================
 */

/*
 * Labels.
 */
.single-product .myapf-field > label {
    display: block;
    margin: 0 0 6px;

    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;

    color: #333;
}

/*
 * Standard controls.
 */
.single-product .myapf-text-input,
.single-product .myapf-number-input,
.single-product .myapf-select-input {
    width: 100%;
    max-width: 100%;
    min-height: 42px;

    padding: 9px 11px;

    border: 1px solid #d5d5d5;
    border-radius: 8px !important;

    background: #fff;

    font-size: 14px;
    line-height: 1.4;

    box-sizing: border-box;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

/*
 * Focus state.
 */
.single-product .myapf-text-input:focus,
.single-product .myapf-number-input:focus,
.single-product .myapf-select-input:focus {
    border-color: #888;
    background: #fff;

    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.06);

    outline: none;
}

/*
 * ==========================================================
 * Checkboxes / Radio
 * ==========================================================
 */

/*
 * Options container.
 */
.single-product .myapf-checkboxes-options,
.single-product .myapf-radio-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
}

/*
 * Individual option.
 */
.single-product .myapf-checkbox-option,
.single-product .myapf-radio-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;

    margin: 0;

    font-size: 14px;
    line-height: 1.4;

    cursor: pointer;
}

/*
 * Native checkbox / radio controls.
 */
.single-product .myapf-checkbox-input,
.single-product .myapf-radio-input {
    flex: 0 0 auto;

    width: 16px;
    height: 16px;
    margin: 0;

    cursor: pointer;
}

/*
 * Group-style field labels
 * used by Checkboxes / Radio / Swatches.
 */
.single-product .myapf-field-label {
    display: block;
    margin: 0 0 6px;

    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;

    color: #333;
}

/*
 * ==========================================================
 * Image Swatches
 * ==========================================================
 */

/*
 * Swatches container.
 *
 * Compact layout suitable for fields with
 * a larger number of image options.
 */
.single-product .myapf-image-swatches-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(54px, 64px));
    gap: 8px;
    justify-content: start;
}

/*
 * Individual image swatch.
 */
.single-product .myapf-image-swatch-option {
    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;
    margin: 0;

    overflow: visible;

    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        background-color 0.2s ease;
}

/*
 * Hide the native radio visually.
 *
 * The real radio remains present and functional
 * for selection and validation.
 */
.single-product .myapf-image-swatch-input {
    position: absolute;

    width: 1px;
    height: 1px;

    margin: 0;

    opacity: 0;
    pointer-events: none;
}

/*
 * Image area.
 */
.single-product .myapf-image-swatch-visual {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    aspect-ratio: 1 / 1;

    padding: 5px;

    background: #fafafa;

    box-sizing: border-box;
}

/*
 * Swatch image.
 */
.single-product .myapf-image-swatch-image {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;
}

/*
 * Option label.
 */
.single-product .myapf-image-swatch-label {
    position: absolute;

    left: 50%;
    bottom: calc(100% + 8px);

    z-index: 20;

    padding: 5px 8px;

    background: #333;
    color: #fff;

    border-radius: 5px;

    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;

    white-space: nowrap;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transform: translateX(-50%) translateY(3px);

    transition:
        opacity 0.15s ease,
        visibility 0.15s ease,
        transform 0.15s ease;
}

.single-product .myapf-image-swatch-label::after {
    content: "";

    position: absolute;

    top: 100%;
    left: 50%;

    margin-left: -4px;

    border-width: 4px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.single-product .myapf-image-swatch-option:hover
.myapf-image-swatch-label {
    opacity: 1;
    visibility: visible;

    transform: translateX(-50%) translateY(0);
}

/*
 * Hover state.
 */
.single-product .myapf-image-swatch-option:hover {
    border-color: #aaa;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/*
 * Selected state.
 */
.single-product .myapf-image-swatch-option:has(
    .myapf-image-swatch-input:checked
) {
    border-color: #555;

    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.10);
}

/*
 * Keyboard focus.
 */
.single-product .myapf-image-swatch-option:has(
    .myapf-image-swatch-input:focus-visible
) {
    outline: 2px solid #555;
    outline-offset: 2px;
}



/*
 * ==========================================================
 * Color Swatches
 * ==========================================================
 */

/*
 * Options container.
 * Pune automat cât mai multe culori pe același rând.
 */
.single-product .myapf-color-swatches-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/*
 * Individual color option.
 */
.single-product .myapf-color-swatch-option {
    position: relative;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    margin: 0;

    cursor: pointer;
}

/*
 * Hide native radio visually.
 */
.single-product .myapf-color-swatch-input {
    position: absolute;

    width: 1px;
    height: 1px;

    margin: 0;

    opacity: 0;
    pointer-events: none;
}

/*
 * Color sample.
 */
.single-product .myapf-color-swatch-visual {
    display: block;

    width: 32px;
    height: 32px;

    flex: 0 0 32px;

    border: 1px solid #ccc;
    border-radius: 6px;

    box-sizing: border-box;

    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease;
}

/*
 * Color name used as tooltip.
 */
.single-product .myapf-color-swatch-label {
    position: absolute;

    left: 50%;
    bottom: calc(100% + 8px);

    z-index: 20;

    padding: 5px 8px;

    background: #333;
    color: #fff;

    border-radius: 5px;

    font-size: 12px;
    font-weight: 500;
    line-height: 1.2;

    white-space: nowrap;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transform: translateX(-50%) translateY(3px);

    transition:
        opacity 0.15s ease,
        visibility 0.15s ease,
        transform 0.15s ease;
}

/*
 * Tooltip arrow.
 */
.single-product .myapf-color-swatch-label::after {
    content: "";

    position: absolute;

    top: 100%;
    left: 50%;

    margin-left: -4px;

    border-width: 4px;
    border-style: solid;

    border-color:
        #333
        transparent
        transparent
        transparent;
}

/*
 * Show tooltip on hover.
 */
.single-product .myapf-color-swatch-option:hover
.myapf-color-swatch-label {
    opacity: 1;
    visibility: visible;

    transform: translateX(-50%) translateY(0);
}

/*
 * Hover state.
 */
.single-product .myapf-color-swatch-option:hover
.myapf-color-swatch-visual {
    border-color: #888;
    transform: translateY(-1px);
}

/*
 * Selected state.
 */
.single-product .myapf-color-swatch-option:has(
    .myapf-color-swatch-input:checked
) .myapf-color-swatch-visual {
    border-color: #333;

    box-shadow:
        0 0 0 2px #fff,
        0 0 0 4px #555;
}

/*
 * Keyboard focus.
 */
.single-product .myapf-color-swatch-option:has(
    .myapf-color-swatch-input:focus-visible
) .myapf-color-swatch-visual {
    outline: 2px solid #555;
    outline-offset: 3px;
}

/*
 * ==========================================================
 * File Upload
 * ==========================================================
 */

/*
 * File restrictions.
 */
.single-product .myapf-file-restrictions {
    margin: 8px 0 0;

    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;

    color: #555;
}

.single-product .myapf-file-input {
    width: 100%;
    max-width: 100%;

    font-size: 13px;
    color: #777;
}

.single-product .myapf-file-input::file-selector-button {
    margin-right: 10px;
    padding: 8px 12px;

    border: 1px solid #d5d5d5;
    border-radius: 6px;

    background: #fff;
    color: #333;

    font-size: 13px;
    font-weight: 500;

    cursor: pointer;

    transition:
        border-color 0.2s ease,
        background-color 0.2s ease;
}

.single-product .myapf-file-input::file-selector-button:hover {
    border-color: #aaa;
    background: #fafafa;
}

/*
 * ==========================================================
 * Image Field
 * ==========================================================
 */

/*
 * Image container.
 */
.single-product .myapf-image-field-image {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    max-width: 100%;
    margin: 0;

    padding: 6px;

    background: #fafafa;

    border: 1px solid #e5e5e5;
    border-radius: 8px;

    box-sizing: border-box;
}

/*
 * Informational image.
 */
.single-product .myapf-image-field-img {
    display: block;

    width: auto;
    max-width: 100%;
    height: auto;

    border-radius: 4px;
}

/* ==========================================================
   MYAPF LIVE PRICING SUMMARY
   ========================================================== */

.single-product .myapf-pricing-summary {
    width: 100%;
    margin: 0 0 22px;
    padding: 18px 20px;

    background: #fff;

    border: 1px solid #e3e3e3;
    border-radius: 14px;

    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);

    box-sizing: border-box;
}

.single-product .myapf-pricing-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    padding: 7px 0;

    font-size: 13px;
    line-height: 1.4;

    color: #333;
}

.single-product .myapf-pricing-row span {
    font-weight: 500;
}

.single-product .myapf-pricing-row strong {
    font-weight: 600;
    white-space: nowrap;
}

.single-product .myapf-pricing-row-total {
    margin-top: 6px;
    padding-top: 12px;

    border-top: 1px solid #e5e5e5;
}

.single-product .myapf-pricing-row-total span,
.single-product .myapf-pricing-row-total strong {
    font-weight: 700;
}

.single-product .myapf-grand-total {
    font-size: 15px;
}

/* ==========================================================
   MYAPF PRICING TOOLTIP
   ========================================================== */

.myapf-price-tooltip {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-left: 4px;
	width: 15px;
	height: 15px;
	border: 1px solid #999;
	border-radius: 50%;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	color: #666;
	cursor: help;
	vertical-align: middle;
}

.myapf-price-tooltip-content {
	position: absolute;
	left: 50%;
	bottom: calc(100% + 7px);
	z-index: 100;

	padding: 5px 8px;
	border-radius: 4px;

	background: #333;
	color: #fff;

	font-size: 12px;
	font-weight: 400;
	line-height: 1.2;
	white-space: nowrap;

	opacity: 0;
	visibility: hidden;
	pointer-events: none;

	transform: translateX(-50%) translateY(3px);

	transition:
		opacity 0.15s ease,
		transform 0.15s ease,
		visibility 0.15s ease;
}

.myapf-price-tooltip-content::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;

	transform: translateX(-50%);

	border-width: 4px;
	border-style: solid;
	border-color: #333 transparent transparent transparent;
}

.myapf-price-tooltip:hover .myapf-price-tooltip-content,
.myapf-price-tooltip:focus .myapf-price-tooltip-content,
.myapf-price-tooltip:focus-within .myapf-price-tooltip-content {
	opacity: 1;
	visibility: visible;

	transform: translateX(-50%) translateY(0);
}

/* Pricing tooltip alignment - Checkboxes */
.single-product .myapf-checkboxes-options {
    display: inline-grid;
    grid-template-columns: auto;
    row-gap: 6px;
}

.single-product .myapf-checkbox-option {
    display: grid;
    grid-template-columns: 16px minmax(90px, auto) 16px;
    align-items: center;
    column-gap: 4px;
}

.single-product .myapf-checkbox-option .myapf-price-tooltip {
    margin-left: 0;
    justify-self: center;
}

/* Pricing tooltip - Radio */
.single-product .myapf-radio-option .myapf-radio-price-tooltip {
    width: 15px;
    height: 15px;
    margin-left: 3px;

    border-radius: 3px;

    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

