/**
 * Bulbasoft One Click Frontend Styles
 * Styles for the "Buy in 1 Click" lightbox and form
 */

/* Loading spinner */
.bsftoclick-loading {
    text-align: center;
    padding: 40px 20px;
}

.bsftoclick-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: bsftoclick-spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes bsftoclick-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Order form */
.bsftoclick-order-form {
    max-width: 500px;
    margin: 0 auto;
}

.bsftoclick-product-info {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.bsftoclick-product-info h3 {
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
    color: #333;
    line-height: 1.4;
}

.bsftoclick-price {
    font-size: 18px;
    font-weight: 600;
    color: #27ae60;
    margin-bottom: 20px;
}

.bsftoclick-price .woocommerce-Price-amount {
    font-size: inherit;
}

.bsftoclick-quantity-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bsftoclick-quantity-wrapper label {
    font-weight: 500;
    color: #333;
    min-width: 90px;
}

.bsftoclick-quantity-controls {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.bsftoclick-qty-minus,
.bsftoclick-qty-plus {
    width: 36px;
    height: 36px;
    border: none;
    background: #f8f9fa;
    color: #333;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bsftoclick-qty-minus:hover,
.bsftoclick-qty-plus:hover {
    background: #e9ecef;
}

.bsftoclick-quantity {
    width: 60px;
    height: 36px;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    text-align: center;
    font-size: 14px;
    outline: none;
}

/* Customer info */
.bsftoclick-customer-info {
    margin-bottom: 30px;
}

.bsftoclick-field {
    margin-bottom: 20px;
}

.bsftoclick-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.bsftoclick-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.bsftoclick-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.bsftoclick-input:invalid {
    border-color: #e74c3c;
}

.bsftoclick-input::placeholder {
    color: #999;
}

/* Phone field with country selector */
.bsftoclick-phone-wrapper {
    display: flex;
    align-items: stretch;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.bsftoclick-phone-wrapper:focus-within {
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.bsftoclick-country-select {
    min-width: 90px;
    border: none;
    background: #f8f9fa;
    padding: 12px 8px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    outline: none;
    border-right: 1px solid #ddd;
    font-family: inherit;
}

.bsftoclick-country-select:focus {
    background: #e9ecef;
}

.bsftoclick-phone-input {
    flex: 1;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    background: white;
    box-sizing: border-box;
}

.bsftoclick-phone-input::placeholder {
    color: #999;
}

.bsftoclick-country-static {
    width: auto;
    padding: 12px 8px;
    font-size: 14px;
    color: #333;
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    display: flex;
    align-items: center;
    font-family: inherit;
}

/* Main One Click button (outside modal) */
.bsftoclick-button {
    background-color: #28a745;
    color: white;
    border: none;

    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bsftoclick-button[disabled],
.bsftoclick-button.bsftoclick-disabled {
    background-color: #b8c2cc;
    color: #ffffff;
    cursor: not-allowed !important;
    opacity: 0.4;
    pointer-events: auto !important; /* allow JS to catch click for notice */
}

.bsftoclick-button[disabled]:hover,
.bsftoclick-button.bsftoclick-disabled:hover {
    background-color: #b8c2cc;
    color: #ffffff;
    opacity: 0.4;
}

/* Enforce forbidden cursor on single product page for disabled One Click button */
.single-product .bsftoclick-wrapper .bsftoclick-button[aria-disabled="true"],
.single-product .bsftoclick-wrapper .bsftoclick-button.bsftoclick-disabled,
.woocommerce.single-product .bsftoclick-wrapper .bsftoclick-button[aria-disabled="true"],
.woocommerce.single-product .bsftoclick-wrapper .bsftoclick-button.bsftoclick-disabled {
    cursor: not-allowed !important;
}

.single-product .bsftoclick-wrapper .bsftoclick-button[aria-disabled="true"]:hover,
.single-product .bsftoclick-wrapper .bsftoclick-button.bsftoclick-disabled:hover,
.woocommerce.single-product .bsftoclick-wrapper .bsftoclick-button[aria-disabled="true"]:hover,
.woocommerce.single-product .bsftoclick-wrapper .bsftoclick-button.bsftoclick-disabled:hover {
    cursor: not-allowed !important;
}

.bsftoclick-button:hover {
    background-color: #218838;
    color: white;
    text-decoration: none;
}

.bsftoclick-button:focus {
    outline: 2px solid #004085;
    outline-offset: 2px;
}

.bsftoclick-wrapper {
    display: inline-block;
}

/* Actions in modal */
.bsftoclick-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.bsftoclick-submit-order,
.bsftoclick-cancel {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.bsftoclick-submit-order {
    background: #1be462;
    color: white;
}

.bsftoclick-submit-order:hover {
    background: #15ca55;
    transform: translateY(-1px);
}

.bsftoclick-cancel {
    background: #95a5a6;
    color: white;
}

.bsftoclick-cancel:hover {
    background: #7f8c8d;
}

/* Success message */
.bsftoclick-success {
    text-align: center;
    padding: 40px 20px;
}

.bsftoclick-success-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #27ae60;
    color: white;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.bsftoclick-success h3 {
    margin: 0 0 15px 0;
    color: #27ae60;
    font-size: 22px;
}

.bsftoclick-success p {
    margin: 0 0 10px 0;
    color: #555;
    line-height: 1.6;
}

.bsftoclick-close-success {
    margin-top: 20px;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.bsftoclick-close-success:hover {
    background: #2980b9;
}

/* Error message */
.bsftoclick-error {
    text-align: center;
    padding: 40px 20px;
}

.bsftoclick-error-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #e74c3c;
    color: white;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.bsftoclick-error h3 {
    margin: 0 0 15px 0;
    color: #e74c3c;
    font-size: 22px;
}

.bsftoclick-error p {
    margin: 0 0 20px 0;
    color: #555;
    line-height: 1.6;
}

.bsftoclick-close-error {
    padding: 10px 20px;
    background: #95a5a6;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
}

.bsftoclick-close-error:hover {
    background: #7f8c8d;
}

.bsftoclick-retry-order {
    padding: 10px 20px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    margin-right: 10px;
}

.bsftoclick-retry-order:hover {
    background: #2980b9;
}

.bsftoclick_modal_product .flex_header.wf100 {
	padding: 0;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .bsftoclick-quantity-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .bsftoclick-quantity-wrapper label {
        min-width: auto;
    }
    
    .bsftoclick-country-select {
        min-width: 80px;
        padding: 10px 6px;
        font-size: 13px;
    }
    
    .bsftoclick-country-static {
 
        padding: 10px 6px;
        font-size: 13px;
    }
    
    .bsftoclick-phone-input {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .bsftoclick-actions {
        flex-direction: column;
    }
    
    .bsftoclick-submit-order,
    .bsftoclick-cancel {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .bsftoclick-order-form {
        padding: 0 10px;
    }
    
    .bsftoclick-product-info h3 {
        font-size: 18px;
    }
    
    .bsftoclick-price {
        font-size: 16px;
    }
}

/* Lightbox-specific fixes: hide native number spinners and ensure our controls are visible */
#bsftui-root .bsftoclick-order-form .bsftoclick-quantity::-webkit-outer-spin-button,
#bsftui-root .bsftoclick-order-form .bsftoclick-quantity::-webkit-inner-spin-button {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: none !important;
    margin: 0 !important;
}

#bsftui-root .bsftoclick-order-form .bsftoclick-quantity[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

#bsftui-root .bsftoclick-order-form .bsftoclick-quantity {
    width: 60px !important;
    height: 36px !important;
    border-left: 1px solid #ddd !important;
    border-right: 1px solid #ddd !important;
    -webkit-appearance: none !important;
    -moz-appearance: textfield !important;
    appearance: none !important;
}

#bsftui-root .bsftoclick-order-form .bsftoclick-quantity-controls .bsftoclick-qty-minus,
#bsftui-root .bsftoclick-order-form .bsftoclick-quantity-controls .bsftoclick-qty-plus {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.bsftoclick-product-media {
	margin-bottom: 15px;
	display: flex;
	align-items: center;
	justify-content: flex-start;
}

.bsftoclick-product-image {
	width: 72px;
	height: 72px;
	border-radius: 6px;
	object-fit: cover;
	border: 1px solid #eee;
	background: #fafafa;
	margin-right: 12px;
}

/* New product layout styles */
.bsftoclick_modal_product {
    margin-bottom: 15px;
    padding-bottom: 0px;
    border-bottom: 1px solid #eee;
}

.bsftoclick_modal_product .flex_header {
    margin: 0 0 10px 0;
    font-size: 22px;
    font-weight: 600;
    color: #333;
    text-align: left;
}

.bsftoclick_modal_product .flex_block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 10px;
}

.bsftoclick_modal_product .flex_block:first-child {
    align-items: center;
    justify-content: center;
}

.bsftoclick_modal_product .flex_block h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

.bsftoclick_modal_product .bsftoclick-modal-product-main-col {
    align-items: flex-start;
    text-align: left;
}

.bsftoclick-no-image {
    width: 80px;
    height: 80px;
    border: 2px dashed #ddd;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    color: #999;
    font-size: 12px;
    text-align: center;
    line-height: 1.2;
}

/* Override product image size in new layout */
.bsftoclick_modal_product .bsftoclick-product-image {
    width: 80px;
    height: 80px;
    margin: 0;
}

/* Price in product modal */
.bsftoclick_modal_product_price {
    margin-top: 8px;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: inherit;
    color: inherit;
    transition: opacity 0.3s ease;
}

.bsftoclick_modal_product_price .woocommerce-Price-amount {
    font-size: inherit;
}

/* Loading animation for missing data in One Click form */
.bsftoclick-loading-price {
    color: #666;
    font-style: italic;
    font-weight: normal;
    position: relative;
    display: inline-block;
    min-width: 120px;
}

.bsftoclick-loading-price::after {
    content: '...';
    animation: bsftoclick-dots 1.5s infinite;
    position: absolute;
    margin-left: 3px;
}

@keyframes bsftoclick-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Smooth transitions for form updates */
.bsftoclick-order-form h3 {
    transition: opacity 0.3s ease;
}

.bsftoclick-order-form .bsftoclick-product-image {
    transition: opacity 0.3s ease;
}

/* Field validation errors */
.bsftoclick-field-error {
    display: none;
    color: #e74c3c;
    font-size: 13px;
    margin-top: 5px;
    padding: 5px 0;
    line-height: 1.3;
}

.bsftoclick-field-error-input {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}

.bsftoclick-phone-wrapper .bsftoclick-field-error-input {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}

/* Mobile adjustments for new layout */
@media (max-width: 768px) {
    .bsftoclick_modal_product .flex_block {
        margin-bottom: 10px;
        text-align: left;
    }
    
    .bsftoclick_modal_product .flex_block h3 {
        font-size: 15px;
    }
    
    .bsftoclick-no-image {
        width: 60px;
        height: 60px;
        font-size: 11px;
    }
    
    .bsftoclick_modal_product .bsftoclick-product-image {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 550px) {
    .bsftoclick_modal_product .bsftoclick-modal-product-image-col {
        align-items: flex-start;
        justify-content: flex-start;
    }

    .bsftoclick_modal_product .bsftoclick-modal-product-main-col {
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
    }

    .bsftoclick_modal_product .bsftoclick-modal-product-main-col h3 {
        width: 100%;
    }

    .bsftoclick_modal_product .bsftoclick-quantity-wrapper {
        width: 100%;
        justify-content: flex-start;
    }
}
