/**
 * Estilos do Frontend - Vime Custom Product Builder
 */

/* ===== ESTILOS PARA OPÇÕES CUSTOMIZADAS ===== */
.vcpb-custom-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Estilo para opções com quantidade - igual aos produtos */
.vcpb-options-with-quantity {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

.vcpb-option-item {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 60px;
    padding: 10px 20px;
    border: 1px solid #ccc;
    border-radius: 50px;
    transition: all 0.3s ease;
}

/* Estilo específico para opções com quantidade - igual aos produtos */
.vcpb-option-quantity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
    padding: 5px;
    border-radius: 3px;
    border: none;
    min-height: auto;
}

.vcpb-option-quantity-item .vcpb-option-info {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.vcpb-option-quantity-item .vcpb-option-name {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    color: #4D4D4D;
    white-space: normal;
    word-wrap: break-word;
}

.vcpb-option-quantity-item .vcpb-option-price {
    margin-top: 5px;
    font-size: 0.9em;
    color: #666;
    font-weight: normal;
}

.vcpb-option-quantity-item .vcpb-option-price-unit {
    font-size: 0.85em;
    color: #999;
}

/* Container de quantidade para opções */
.vcpb-option-quantity {
    flex-shrink: 0;
    text-align: center;
    justify-items: center;
}

/* Botões de quantidade para opções */
.vcpb-option-quantity .vcpb-quantity-controls {
    display: flex;
    align-items: center;
    border-radius: 50px;
    border: 1px solid #ccc;
    padding: 2px;
    transition: all 0.3s ease;
}

.vcpb-option-quantity .vcpb-quantity-controls.has-value {
    border-color: #dc3545;
}

/* Input de quantidade para opções personalizadas */
.vcpb-option-quantity .vcpb-option-quantity-input {
    width: 45px !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    color: #333 !important;
    border: none !important;
    background: transparent !important;
    outline: none !important;
    padding: 0 !important;
    margin: 0 !important;
    -moz-appearance: textfield !important;
    box-shadow: none !important;
}

.vcpb-option-quantity .vcpb-option-quantity-input::-webkit-outer-spin-button,
.vcpb-option-quantity .vcpb-option-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
}

.vcpb-option-item:has(.vcpb-option-input:checked) {
    border-color: #dc3545;
}

.vcpb-option-label {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    gap: 15px;
}

.vcpb-option-label:hover .vcpb-option-name {
    color: #dc3545;
}

.vcpb-option-item:hover {
    border-color: #dc3545;
}

/* Container para o controle de seleção */
.vcpb-option-control {
    flex-shrink: 0;
    width: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vcpb-option-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #dc3545;
}

/* Estilo para radio buttons */
.vcpb-option-input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Estilo para checkboxes */
.vcpb-option-input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Informações da opção */
.vcpb-option-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
}

.vcpb-option-name {
    margin: 0;
    font-size: 0.95em;
    font-weight: 500;
    color: #4D4D4D;
    line-height: 1.2;
    white-space: normal;
    word-wrap: break-word;
    transition: color 0.3s ease;
}

/* Quando a opção está selecionada */
.vcpb-option-input:checked ~ .vcpb-option-info .vcpb-option-name {
    color: #dc3545;
    font-weight: 600;
}

.vcpb-option-price {
    margin-top: 2px;
    font-size: 0.85em;
    color: #666;
    font-weight: normal;
}

/* Responsivo para opções */
@media (max-width: 768px) {
    .vcpb-custom-options {
        grid-template-columns: 1fr;
    }

    .vcpb-options-with-quantity {
        grid-template-columns: 1fr;
    }

    .vcpb-option-item {
        min-width: 0;
    }

    .vcpb-option-quantity-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
        min-width: 0;
    }

    .vcpb-option-quantity {
        width: 100%;
    }

    .vcpb-option-quantity .vcpb-quantity-controls {
        max-width: 200px;
        margin: 0 auto;
    }
}

@media (max-width: 480px) {
    .vcpb-options-with-quantity {
        grid-template-columns: 1fr;
    }

    .vcpb-option-quantity-item {
        min-width: 0;
    }
}

/* Layout consistente para todos os tipos de seleção */
.vcpb-group[data-selection-type="single"] .vcpb-custom-options,
.vcpb-group[data-selection-type="multiple"] .vcpb-custom-options {
    grid-template-columns: repeat(2, 1fr);
}

@media (max-width: 768px) {
    .vcpb-group[data-selection-type="single"] .vcpb-custom-options,
    .vcpb-group[data-selection-type="multiple"] .vcpb-custom-options {
        grid-template-columns: 1fr;
    }
}


.vcpb-header {
    margin-bottom: 25px;
    text-align: left;
}

.vcpb-title {
    margin: 0 0 10px 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #333;
}

.vcpb-description {
    margin: 0;
    color: #666;
    font-size: 0.95em;
    line-height: 1.4;
}

.vcpb-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

/* Ajuste quando contém opções customizadas */
.vcpb-items:has(.vcpb-custom-options) {
    display: block;
    padding: 0;
    margin-bottom: 20px;
}

.vcpb-item {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 250px;
    padding: 5px;
}

.vcpb-item-image {
    flex-shrink: 0;
    width: 60px;
}

.vcpb-item-image img {
    width: 100%;
    height: auto;
    border-radius: 3px;
}

.vcpb-item-info {
    flex-grow: 1;
    min-width: 0;
    overflow: hidden;
}

.vcpb-item-name {
    margin: 0;
    font-size: 1em;
    font-weight: 600;
    color: #4D4D4D;
    white-space: normal;
    word-wrap: break-word;
}

.vcpb-item-description {
    margin: 5px 0 0 0;
    font-size: 0.85em;
    color: #666;
}

.vcpb-item-price {
    margin-top: 5px;
    font-size: 0.9em;
    color: #4D4D4D;
}

.vcpb-item-quantity {
    flex-shrink: 0;
    text-align: center;
    justify-items: center;
}

.vcpb-quantity-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
}

.vcpb-quantity-controls {
    display: flex;
    align-items: center;
    border-radius: 50px;
    border: 1px solid #ccc;
    padding: 2px;
    transition: all 0.3s ease;
}

/* Borda colorida apenas para opções, não para produtos */
.vcpb-option-quantity .vcpb-quantity-controls.has-value {
    border-color: #dc3545;
}

.vcpb-quantity-btn {
    background: none;
    border: none;
    padding: 10px!important;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #333;
    line-height: 12px;

}

button.vcpb-quantity-btn {
    border: none;
    background: none;
    color: #4D4D4D;
}

button.vcpb-quantity-btn:hover, button.vcpb-quantity-btn:focus {
    scale: 1.2;
    background: none;
    color: #4D4D4D;
}

/* Input de quantidade editável */
.vcpb-quantity-input,
.vcpb-product-builder .vcpb-quantity-input,
.vcpb-product-builder input[type="number"].vcpb-quantity-input {
    width: 45px !important;
    text-align: center !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    border: none !important;
    background: transparent !important;
    color: #333 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    min-height: auto !important;
    height: auto !important;
    min-width: auto !important;
    max-width: none !important;
}

.vcpb-quantity-input:focus,
.vcpb-product-builder .vcpb-quantity-input:focus {
    outline: none !important;
    background: rgba(220, 53, 69, 0.05) !important;
    border-radius: 4px !important;
    border: none !important;
    box-shadow: none !important;
}

/* Remover setas do input number */
.vcpb-quantity-input::-webkit-outer-spin-button,
.vcpb-quantity-input::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

.vcpb-quantity-input[type=number] {
    -moz-appearance: textfield !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

.vcpb-summary {
    padding: 32px;
    background: #F1DBD1;
    border: 2px solid #000;
    border-radius: 32px;
    margin-bottom: 20px;
    box-shadow: 4px 4px 0 0 #000;
}

.vcpb-total-quantity,
.vcpb-package-info,
.vcpb-extra-info,
.vcpb-total-price {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 0.95em;
}

.vcpb-total-price {
    font-weight: 700;
    font-size: 1.2em;
    border-top: 2px solid #e1e1e1;
    padding-top: 12px;
    margin-top: 12px;
    color: #2c5aa0;
}

.vcpb-label {
    color: #333;
    font-weight: 500;
}

.vcpb-value {
    font-weight: 700;
    color: #D53D3D;
}

.vcpb-validation-messages {
    margin-top: 15px;
}

.vcpb-validation-messages ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.vcpb-error,
.vcpb-warning,
.vcpb-validation-messages .woocommerce-error,
.vcpb-validation-messages .woocommerce-info {
    font-size: 0.9em;
    font-weight: 600;
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 8px;
    line-height: 1.4;
    list-style: none !important;
}

.vcpb-error,
.vcpb-validation-messages .woocommerce-error {
    color: #e74c3c;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
}

.vcpb-warning,
.vcpb-validation-messages .woocommerce-info {
    color: #856404;
    background: #fff3cd;
    border: 1px solid #ffeeba;
}

/* Remove todos os pseudo-elementos que possam estar causando conflito */
.vcpb-product-builder .vcpb-error::before,
.vcpb-product-builder .vcpb-warning::before,
.vcpb-product-builder .vcpb-validation-messages .woocommerce-error::before,
.vcpb-product-builder .vcpb-validation-messages .woocommerce-info::before,
.vcpb-product-builder .vcpb-error::after,
.vcpb-product-builder .vcpb-warning::after,
.vcpb-product-builder .vcpb-validation-messages .woocommerce-error::after,
.vcpb-product-builder .vcpb-validation-messages .woocommerce-info::after,
.woocommerce .vcpb-validation-messages .woocommerce-error::before,
.woocommerce .vcpb-validation-messages .woocommerce-info::before {
    display: none !important;
    content: none !important;
    position: static !important;
}

.vcpb-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.vcpb-add-to-cart {
    flex-grow: 1;
    padding: 12px 24px;
    font-size: 1em;
    font-weight: 600;
    border-radius: 4px;
    transition: all 0.2s ease;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vcpb-add-to-cart:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.vcpb-reset {
    padding: 12px 20px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vcpb-reset:hover {
    background: #5a6268;
}

/* Estados de loading */
.vcpb-loading {
    opacity: 0.7;
    pointer-events: none;
}

.vcpb-loading .vcpb-quantity-btn,
.vcpb-loading .vcpb-add-to-cart {
    cursor: wait;
}

/* Animações */
.vcpb-price-update {
    animation: vcpb-highlight 0.3s ease;
}

@keyframes vcpb-highlight {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}

/* Responsividade */
@media (max-width: 768px) {
    .vcpb-product-builder {
        margin: 15px 0;
        padding: 15px;
    }
    
    .vcpb-item {
        flex-direction: column;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }
    
    .vcpb-item-image {
        width: 100px;
        height: 100px;
    }
    
    .vcpb-item-quantity {
        min-width: auto;
        width: 100%;
    }
    
    .vcpb-quantity-controls {
        max-width: 200px;
        margin: 0 auto;
    }
    
    .vcpb-actions {
        flex-direction: column;
    }
    
    .vcpb-add-to-cart {
        width: 100%;
    }
    
    .vcpb-total-quantity,
    .vcpb-package-info,
    .vcpb-extra-info,
    .vcpb-total-price {
        font-size: 0.9em;
    }
    
    .vcpb-total-price {
        font-size: 1.1em;
    }
}

@media (max-width: 480px) {
    .vcpb-items {
        grid-template-columns: 1fr;
    }
    
    .vcpb-item {
        min-width: 0;
    }
    
    .vcpb-item-image {
        width: 80px;
        height: 80px;
    }
    
    .vcpb-item-name {
        font-size: 1em;
    }
    
    .vcpb-summary {
        padding: 15px;
    }
    
    .vcpb-quantity-input {
        width: 50px;
    }
    
    .vcpb-quantity-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
}

/* Tema escuro (opcional) */
@media (prefers-color-scheme: dark) {
    .vcpb-product-builder {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    .vcpb-item {
        background: #333;
        border-color: #444;
    }
    
    .vcpb-summary {
        background: #333;
        border-color: #444;
    }
    
    .vcpb-title,
    .vcpb-item-name,
    .vcpb-label {
        color: #e0e0e0;
    }
    
    .vcpb-quantity-btn {
        background: #444;
        color: #e0e0e0;
    }
    
    .vcpb-quantity-btn:hover:not(:disabled) {
        background: #555;
    }
    
    .vcpb-quantity-input {
        background: #444;
        color: #e0e0e0;
        border-color: #555;
    }
}

.vcpb-summary.vcpb-price-loading {
    opacity: 0.6;
    cursor: wait;
    transition: opacity 0.2s ease-in-out;
}

.vcpb-unit-price-info {
    margin: 10px 0;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.vcpb-unit-price-info .vcpb-label {
    font-size: 0.9em;
    color: #666;
}

.vcpb-unit-price-info .vcpb-value {
    font-weight: bold;
    margin-left: 5px;
}

.vcpb-product-builder {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.vcpb-progress {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-bottom: 30px;
    gap: 15px;
}

.vcpb-group-header .vcpb-progress {
    margin-bottom: 20px;
}

.vcpb-progress-circle {
    width: 60px;
    height: 60px;
    position: relative;
    flex-shrink: 0;
}

.vcpb-progress-ring {
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}

.vcpb-progress-ring path {
    stroke-width: 4;
}

.vcpb-progress-ring-value {
    stroke-dasharray: 100;
    stroke-dashoffset: 100; /* 100 - porcentagem */
    transition: stroke-dashoffset 0.3s ease, stroke 0.3s ease;
    stroke: #dc3545;
}

.vcpb-progress-text {
    font-size: 24px;
    font-weight: 600;
    color: #4D4D4D;
}

.vcpb-progress-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.vcpb-progress-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.vcpb-group-counter {
    color: #dc3545;
    font-weight: 700;
    font-size: 16px;
}

.vcpb-group-counter .vcpb-group-current,
.vcpb-group-counter .vcpb-group-included {
    margin: 0;
    padding: 0;
}

.vcpb-group-name {
    margin: 0;
    display: inline;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.vcpb-progress-description {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Seletor de quantidade de kits - inline com botões */
.vcpb-kit-quantity-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Altura igual ao botão de adicionar ao carrinho */
.vcpb-kit-quantity-controls.vcpb-quantity-controls {
    margin: 0;
    height: 48px;
}

.vcpb-kit-quantity-controls .vcpb-quantity-btn {
    width: 36px;
    height: 36px;
    padding: 8px !important;
}

/* Input de quantidade de kits */
.vcpb-kit-quantity-input.vcpb-quantity-input {
    width: 40px;
    height: 36px;
    font-size: 18px;
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

/* Ajustes para o layout de actions com seletor de quantidade */
.vcpb-actions:has(.vcpb-kit-quantity-wrapper) {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.vcpb-actions .vcpb-add-to-cart {
    flex-grow: 1;
    min-width: 200px;
}

.vcpb-actions .vcpb-reset {
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .vcpb-kit-quantity-wrapper {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .vcpb-actions:has(.vcpb-kit-quantity-wrapper) {
        flex-direction: column;
    }

    .vcpb-actions .vcpb-add-to-cart,
    .vcpb-actions .vcpb-reset {
        width: 100%;
    }
}

