/**
 * Advanced Product Customizer - Frontend Custom CSS
 */

.advprodcustom-configurator {
    margin: 24px 0;
}

body.advprodcustom-active .js-product-customization,
body.advprodcustom-active section.product-customization {
    display: none !important;
}

.advprodcustom-fields-wrapper {
    padding: 24px;
    background: linear-gradient(180deg, #fffdf7 0%, #f6f8fb 100%);
    border: 1px solid #e4e8ef;
    border-radius: 18px;
    box-shadow: 0 20px 45px rgba(33, 48, 74, 0.08);
}

.advprodcustom-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 18px;
}

.advprodcustom-kicker,
.advprodcustom-preview-kicker {
    margin: 0 0 6px;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6b7280;
}

.product-customization-title {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #172033;
}

.advprodcustom-progress {
    height: 10px;
    margin-bottom: 18px;
    background: #e9edf3;
    border-radius: 999px;
    overflow: hidden;
}

.advprodcustom-progress-bar {
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--advprodcustom-start), var(--advprodcustom-end));
    transition: width 0.3s ease;
}

.advprodcustom-withdrawal-notice {
    margin-bottom: 18px;
    padding: 12px 14px;
    border-left: 4px solid #d97706;
    background: #fff7ed;
    color: #9a3412;
    border-radius: 8px;
}

.advprodcustom-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.9fr);
    gap: 24px;
}

.advprodcustom-layout:not(.has-floating-preview) {
    grid-template-columns: 1fr;
}

.advprodcustom-layout-fields_then_preview,
.advprodcustom-layout-preview_then_fields {
    grid-template-columns: 1fr;
}

.advprodcustom-layout-fields_then_preview .advprodcustom-fields {
    order: 1;
}

.advprodcustom-layout-fields_then_preview .advprodcustom-preview {
    order: 2;
}

.advprodcustom-layout-preview_then_fields .advprodcustom-preview {
    order: 1;
}

.advprodcustom-layout-preview_then_fields .advprodcustom-fields {
    order: 2;
}

.product-custom-field {
    margin-bottom: 16px;
    padding: 18px;
    background: #ffffff;
    border: 1px solid #e7ebf1;
    border-radius: 14px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.product-custom-field[hidden] {
    display: none !important;
}

.product-custom-field.is-locked {
    opacity: 0.55;
}

.product-custom-field.is-invalid {
    border-color: #cf1322;
    box-shadow: 0 0 0 3px rgba(207, 19, 34, 0.08);
}

.product-custom-field:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(28, 40, 63, 0.07);
}

.advprodcustom-step-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    margin-bottom: 12px;
}

.advprodcustom-step-meta {
    min-width: 0;
}

.advprodcustom-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 5px 10px;
    background: #172033;
    color: #fff;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 8px;
}

.product-custom-field label {
    text-align: left;
    display: block;
    margin: 0;
    font-weight: 600;
    color: #182235;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.product-custom-field .required {
    color: #cf1322;
}

.product-custom-field .form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid #d5dce7;
    border-radius: 10px;
    background: #fcfdff;
}

.product-custom-field .form-control:focus {
    border-color: #0f766e;
    outline: none;
    box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.product-custom-field.is-invalid .form-control,
.product-custom-field.is-invalid .advprodcustom-datepicker,
.product-custom-field.is-invalid .checkbox-options-container {
    border-color: #cf1322;
}

.advprodcustom-validation-feedback {
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid #f3b3ba;
    border-radius: 12px;
    background: #fff1f0;
    color: #a8071a;
    font-size: 14px;
    line-height: 1.45;
}

.checkbox-options-container {
    display: grid;
    gap: 10px;
}

.checkbox-option {
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #dbe4ef;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.checkbox-option:hover {
    border-color: #0f766e;
    background: #f0fdfa;
}

.checkbox-option label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
}

.checkbox-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    margin-top: 4px;
}

.checkbox-label {
    flex: 1;
    display: block;
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
    gap: 4px;
}

.checkbox-price {
    display: block;
    color: #0f766e;
    font-weight: 700;
}

.advprodcustom-child-option label {
    align-items: center;
}

.advprodcustom-child-option-media {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    border: 1px solid #dce4ee;
    background: #fff;
    overflow: hidden;
    flex: 0 0 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.advprodcustom-child-option-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.advprodcustom-child-products-block {
    margin-top: 18px;
    padding: 18px;
    border: 1px solid #e7ebf1;
    border-radius: 14px;
    background: #ffffff;
}

.advprodcustom-child-products-block h4 {
    margin: 0 0 12px;
    font-size: 1.2rem;
    font-weight: 700;
    color: #172033;
}

.advprodcustom-preview {
    position: static;
    top: auto;
    align-self: start;
    padding: 18px;
    background: var(--advprodcustom-preview-bg, #172033);
    color: var(--advprodcustom-preview-color, #f4f7fb);
    border-radius: 16px;
}

.advprodcustom-layout.has-floating-preview:not(.advprodcustom-layout-fields_then_preview):not(.advprodcustom-layout-preview_then_fields) .advprodcustom-preview {
    position: sticky;
    top: 24px;
}

.advprodcustom-preview.is-inline {
    position: static;
}

.advprodcustom-preview h4 {
    margin: 0 0 14px;
    font-size: 1.25rem;
    color: var(--advprodcustom-preview-color, #fff);
}

.advprodcustom-preview-empty {
    color: color-mix(in srgb, var(--advprodcustom-preview-color, #f4f7fb) 72%, transparent);
    font-size: 14px;
}

.advprodcustom-preview-items {
    display: grid;
    gap: 10px;
}

.advprodcustom-preview-item {
    display: grid;
    gap: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 10px;
}

.advprodcustom-preview-item.is-empty {
    opacity: 0.55;
}

.advprodcustom-preview-name {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--advprodcustom-preview-color, #f4f7fb) 75%, transparent);
}

.advprodcustom-hide-preview-names .advprodcustom-preview-name {
    display: none;
}

.advprodcustom-preview-value {
    font-weight: 600;
}

.advprodcustom-preview-price {
    color: #f7c873;
    font-size: 14px;
    font-weight: 700;
}

.advprodcustom-preview-total {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid color-mix(in srgb, var(--advprodcustom-preview-color, #f4f7fb) 16%, transparent);
}

.advprodcustom-preview-total > span {
    flex: 0 1 100%;
    min-width: 0;
}

.advprodcustom-preview-total-value {
    flex: 0 0 auto;
    white-space: nowrap;
    text-align: right;
}

.advprodcustom-preview-unit-price {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-top: 10px;
    color: color-mix(in srgb, var(--advprodcustom-preview-color, #f4f7fb) 82%, transparent);
    font-size: 14px;
}

.custom-price-impact {
    margin-top: 8px;
    color: #0f766e;
    font-size: 14px;
    font-weight: 700;
}

.advprodcustom-datepicker {
    cursor: pointer;
    background-color: #fff;
}

.ui-datepicker {
    z-index: 9999 !important;
    padding: 0;
    border: none !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15) !important;
    border-radius: 8px !important;
    width: auto !important;
    max-width: 350px !important;
    overflow: hidden !important;
}

.ui-datepicker .ui-datepicker-header {
    background: linear-gradient(135deg, var(--advprodcustom-start) 0%, var(--advprodcustom-end) 100%) !important;
    border: none !important;
    border-radius: 8px 8px 0 0 !important;
    padding: 15px 10px !important;
    color: white !important;
}

.ui-datepicker .ui-datepicker-title,
.ui-datepicker th {
    color: white !important;
}

.ui-datepicker td a:hover,
.ui-datepicker td .ui-state-active,
.ui-datepicker td .ui-state-highlight {
    background: var(--advprodcustom-start) !important;
    color: white !important;
}

.product-custom-field .advprodcustom-datepicker {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="%230f766e" viewBox="0 0 16 16"><path d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 18px;
    padding-right: 40px !important;
}

@media (max-width: 991px) {
    .advprodcustom-layout {
        grid-template-columns: 1fr;
    }

    .advprodcustom-preview {
        position: static;
    }

    .advprodcustom-header {
        flex-direction: column;
    }
}
