/**
 * Checkout Accordion Styles
 * Styles for continue buttons in accordion checkout
 */

.mb-accordion-continue-button-wrapper {
    margin: 1rem 0;
    padding: 1rem;
    text-align: right;
    border-top: 1px solid #e0e0e0;
}

.mb-accordion-continue-button-wrapper .mb-accordion-continue-button {
    background-color: var(--primary-color);
    color: white;
    opacity: 1;
    border-radius: 0.6em;
    border: 1px solid;
    padding: 1em 1.5em;
    min-height: 0;
    flex: none;
    display: inline-block;
    text-transform: uppercase;
    font-size: 0.9em;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.mb-accordion-continue-button:hover {
    background-color: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.mb-accordion-continue-button-wrapper .mb-accordion-continue-button:active {
    transform: translateY(0);
}

.mb-accordion-continue-button-wrapper .mb-accordion-continue-button:focus {
    outline: 2px solid var(--wp--preset--color--primary, #0073aa);
    outline-offset: 2px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .mb-accordion-continue-button-wrapper {
        text-align: center;
        margin: 0.75rem 0;
        padding: 0.75rem;
    }
    
    .mb-accordion-continue-button-wrapper .mb-accordion-continue-button {
        width: 100%;
        padding: 1rem;
    }
}

/* Integration with existing checkout styles */
.wc-block-components-checkout-step .mb-accordion-continue-button-wrapper {
    margin-top: 1.5rem;
    margin-bottom: 0;
}

/* Ensure buttons don't interfere with WooCommerce validation */
.mb-accordion-continue-button-wrapper .mb-accordion-continue-button[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Layout Fixes for Checkout Columns */
.wc-block-components-sidebar-layout .wc-block-components-main {
    box-sizing: border-box;
    margin: 0;
    padding-right: 4.5283018868%;
    width: 65%;
}

.wp-block-woocommerce-checkout .wc-block-checkout__sidebar {
    /* Order summary now appears after checkout fields in DOM */
}

.wc-block-checkout__return-to-cart-wrapper .wc-block-components-checkout-return-to-cart-button {
    color: #302927;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    padding-left: 3rem;
}

.wc-block-checkout__return-to-cart-wrapper .wc-block-components-checkout-return-to-cart-button::before {
    content: '';
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24' aria-hidden='true' focusable='false'%3E%3Cpath d='M20 11.2H6.8l3.7-3.7-1-1L3.9 12l5.6 5.5 1-1-3.7-3.7H20z' fill='%23302927'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.wc-block-checkout__return-to-cart-wrapper .wc-block-components-checkout-return-to-cart-button:hover {
    background: var(--wp--preset--color--secondary-dark, #5a6268);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.wc-block-checkout__return-to-cart-wrapper .wc-block-components-checkout-return-to-cart-button:active {
    transform: translateY(0);
}

.wc-block-checkout__return-to-cart-wrapper .wc-block-components-checkout-return-to-cart-button:focus {
    outline: 2px solid var(--wp--preset--color--secondary, #6c757d);
    outline-offset: 2px;
}

.wc-block-checkout__return-to-cart-wrapper .wc-block-components-checkout-return-to-cart-button svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}
.wc-block-components-order-summary .wc-block-components-order-summary-item__description .wc-block-components-product-metadata {
    max-width: 100%;
}

.wp-block-woocommerce-checkout .wc-block-components-product-metadata__description + ul li.wc-block-components-product-details__mpn {
    display: none;
}
/* Responsive adjustments for return to cart */
@media (max-width: 768px) {
    .wc-block-checkout__return-to-cart-wrapper {
        text-align: center;
        margin: 0.75rem 0;
        padding: 0.75rem;
    }
    
    .wc-block-checkout__return-to-cart-wrapper .wc-block-components-checkout-return-to-cart-button {
        width: 100%;
        padding: 1rem;
        justify-content: center;
    }
}

/* Validation Error Styles */
.mb-validation-errors-container {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #721c24;
    animation: slideInDown 0.3s ease-out;
}

.mb-validation-errors-container h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
}

.mb-validation-errors-container ul {
    margin: 0;
    padding-left: 1.5rem;
}

.mb-validation-errors-container li {
    margin: 0.25rem 0;
    line-height: 1.4;
}

/* General Error Notification */
.mb-general-error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 9999;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.mb-general-error-notification button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.mb-general-error-notification button:hover {
    background-color: rgba(255,255,255,0.2);
}

/* Sections with validation errors */
.wc-block-components-checkout-step.has-validation-errors {
    border-left: 4px solid #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

.wc-block-components-checkout-step.has-validation-errors .wc-block-components-checkout-step__heading {
    color: #dc3545;
}

.wc-block-components-checkout-step.has-validation-errors .wc-block-components-checkout-step__heading::before {
    content: "⚠️ ";
    margin-right: 0.5rem;
}

/* Error field highlighting */
.wc-block-components-checkout-step.has-validation-errors input[aria-invalid="true"],
.wc-block-components-checkout-step.has-validation-errors select[aria-invalid="true"],
.wc-block-components-checkout-step.has-validation-errors textarea[aria-invalid="true"] {
    border-color: #dc3545;
    box-shadow: 0 0 0 1px #dc3545;
}

/* Individual field error states */
input.has-error,
select.has-error,
textarea.has-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 1px #dc3545 !important;
    background-color: #fff5f5;
}

input.has-error:focus,
select.has-error:focus,
textarea.has-error:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25) !important;
}

/* Error field labels */
.wc-block-components-checkout-step.has-validation-errors label {
    color: #dc3545;
    font-weight: 600;
}

/* Error field descriptions */
.wc-block-components-checkout-step.has-validation-errors .wc-block-components-text-input__description {
    color: #dc3545;
}

/* Success state for fields */
input:valid:not(:placeholder-shown),
select:valid:not([value=""]),
textarea:valid:not(:placeholder-shown) {
    border-color: #28a745;
    background-color: #f8fff9;
}

/* Transition effects for field states */
input, select, textarea {
    transition: all 0.2s ease;
}

/* Error count badge */
.mb-validation-errors-container::before {
    content: attr(data-error-count) " error(s)";
    display: inline-block;
    background: #dc3545;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

/* Animation keyframes */
@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive error notification */
@media (max-width: 768px) {
    .mb-general-error-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .mb-validation-errors-container {
        margin: 0.75rem 0;
        padding: 0.75rem;
    }
}

/* Focus styles for accessibility */
.mb-validation-errors-container:focus-within,
.mb-general-error-notification:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mb-validation-errors-container {
        border-width: 2px;
        background: #ffffff;
        color: #000000;
    }
    
    .mb-general-error-notification {
        border: 2px solid #ffffff;
        background: #000000;
        color: #ffffff;
    }
}

/* Enhanced Stripe Payment Validation Styles */

/* Payment section validation error states */
.wc-block-components-checkout-step.has-stripe-validation-error {
    border-left: 4px solid #dc3545;
    background-color: #fff5f5;
}

.wc-block-components-checkout-step.has-stripe-validation-error .wc-block-components-checkout-step__title {
    color: #dc3545;
}

/* Place order button validation state */
.wc-block-components-checkout-place-order-button[data-mb-validation="active"] {
    position: relative;
}

.wc-block-components-checkout-place-order-button[data-mb-validation="active"]::after {
    content: "✓";
    position: absolute;
    top: -5px;
    right: -5px;
    background: #28a745;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Stripe validation error indicators */
.stripe-validation-error-indicator {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    animation: fadeIn 0.3s ease-in;
}

.stripe-validation-error-indicator::before {
    content: "⚠️ ";
    margin-right: 0.5rem;
}

/* Stripe field error container */
.stripe-field-error-container {
    margin: 1rem 0;
    padding: 1rem;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    animation: slideDown 0.3s ease-out;
}

.stripe-field-error-container h4 {
    margin: 0 0 0.5rem 0;
    color: #721c24;
    font-size: 1rem;
    font-weight: 600;
}

.stripe-field-error-item {
    color: #dc3545;
    font-size: 0.875rem;
    margin: 0.25rem 0;
    padding: 0.25rem 0;
    border-bottom: 1px solid #f5c6cb;
}

.stripe-field-error-item:last-child {
    border-bottom: none;
}

/* Stripe validation notification */
.stripe-validation-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #dc3545;
    color: white;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 9999;
    max-width: 400px;
    animation: slideInRight 0.3s ease-out;
}

.stripe-validation-notification button {
    position: absolute;
    top: 5px;
    right: 5px;
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s ease;
}

.stripe-validation-notification button:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Stripe iframe validation states */
iframe[data-stripe-validation="true"] {
    transition: border-color 0.3s ease;
}

iframe[data-stripe-validation="true"][data-validation-state="error"] {
    border: 2px solid #dc3545;
    border-radius: 4px;
}

iframe[data-stripe-validation="true"][data-validation-state="valid"] {
    border: 2px solid #28a745;
    border-radius: 4px;
}

iframe[data-stripe-validation="true"][data-validation-state="unknown"] {
    border: 2px solid #ffc107;
    border-radius: 4px;
}

/* Stripe element validation states */
[data-stripe-validation="true"] {
    transition: border-color 0.3s ease;
}

[data-stripe-validation="true"][data-validation-state="error"] {
    border: 2px solid #dc3545;
    border-radius: 4px;
}

[data-stripe-validation="true"][data-validation-state="valid"] {
    border: 2px solid #28a745;
    border-radius: 4px;
}

[data-stripe-validation="true"][data-validation-state="unknown"] {
    border: 2px solid #ffc107;
    border-radius: 4px;
}

/* Payment method validation error state */
.wc-block-components-checkout-payment-method.has-stripe-validation-error {
    background-color: #fff5f5;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 1rem;
    margin: 0.5rem 0;
}

/* Debug indicators */
[data-validation-initialized="true"] {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

[data-mb-validation="active"] {
    outline: 2px solid #28a745;
    outline-offset: 2px;
}

/* Animation keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stripe-validation-notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .stripe-field-error-container {
        margin: 0.5rem 0;
        padding: 0.75rem;
    }
    
    .stripe-validation-error-indicator {
        margin-top: 0.25rem;
        padding: 0.75rem;
        font-size: 0.8rem;
    }
}

/* Focus states for accessibility */
.stripe-validation-error-indicator:focus,
.stripe-field-error-container:focus,
.stripe-validation-notification:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stripe-validation-error-indicator,
    .stripe-field-error-container {
        border-width: 2px;
    }
    
    .stripe-validation-notification {
        border: 2px solid #000;
    }
}

/* Signature Validation Error Styling */
.mb-signature-validation-error {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    background-color: #fef7f7;
    border: 1px solid #e53e3e;
    color: #c53030;
    font-size: 0.875rem;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    position: relative;
    z-index: 10;
}

.mb-signature-validation-error svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
    fill: currentColor;
}

.mb-signature-validation-error .wc-block-components-notice-banner__content {
    flex: 1;
}

.mb-signature-validation-error .wc-block-components-notice-banner__content > div {
    margin: 0;
    font-weight: 500;
}

/* Ensure error is visible in collapsed accordion sections */
.wc-block-components-checkout-step:not(.is-active) .mb-signature-validation-error {
    display: block !important;
    margin: 0.5rem 0;
    background-color: #fef7f7;
    border: 1px solid #e53e3e;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Position the error properly after the signature checkbox */
.components-base-control + .mb-signature-validation-error {
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}

/* Responsive design for smaller screens */
@media (max-width: 768px) {
    .mb-signature-validation-error {
        margin: 0.75rem 0;
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .mb-signature-validation-error svg {
        width: 20px;
        height: 20px;
    }
}

/* Animation for error appearance */
.mb-signature-validation-error {
    animation: fadeInError 0.3s ease-in-out;
}

@keyframes fadeInError {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure order notes are properly displayed */
.wc-block-checkout__order-notes .wc-block-checkout__add-note {
    margin-bottom: 1rem;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox {
    margin-bottom: 1rem;
}

/* Ensure the order notes textarea appears when checkbox is checked */
.wc-block-checkout__order-notes .wc-block-components-textarea {
    margin-top: 1rem;
    width: 100%;
    min-height: 100px;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
}

.wc-block-checkout__order-notes .wc-block-components-textarea:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 1px #007cba;
}

/* Ensure the order notes section is visible */
.wc-block-checkout__order-notes {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.wc-block-checkout__order-notes .wc-block-components-checkout-step__container {
    display: block !important;
}

.wc-block-checkout__order-notes .wc-block-components-checkout-step__content {
    display: block !important;
}

/* Additional fixes for order notes visibility */
.wc-block-checkout__order-notes .wc-block-checkout__order-notes-container {
    display: block !important;
}

.wc-block-checkout__order-notes .wc-block-checkout__order-notes-content {
    display: block !important;
}

/* Ensure the order notes checkbox is properly styled */
.wc-block-checkout__order-notes .wc-block-components-checkbox__label {
    font-weight: 500;
    color: #333;
    cursor: pointer;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input:checked + .wc-block-components-checkbox__label .wc-block-components-checkbox__mark {
    background-color: #007cba;
    border-color: #007cba;
}

/* Ensure proper checkbox styling */
.wc-block-checkout__order-notes .wc-block-components-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input {
    margin-right: 0.5rem;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input:checked {
    accent-color: #007cba;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input:hover {
    border-color: #007cba;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__mark {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background: white;
    position: relative;
    margin-right: 0.5rem;
}

.wc-block-checkout__order-notes label.is-checked .wc-block-components-checkbox__mark {
    background-color: #007cba;
    border-color: #007cba;
}

.wc-block-checkout__order-notes label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

/* Ensure proper spacing in the order notes section */
.wc-block-checkout__order-notes > div {
    margin-bottom: 0.5rem;
}

.wc-block-checkout__order-notes > div:last-child {
    margin-bottom: 0;
}

/* Override any inline display:none styles for order notes */
.wc-block-checkout__order-notes [style*="display: none"] {
    display: block !important;
}

.wc-block-checkout__order-notes [style*="display:none"] {
    display: block !important;
}

/* Ensure the order notes section is always visible regardless of inline styles */
.wc-block-checkout__order-notes,
.wc-block-checkout__order-notes * {
    visibility: visible !important;
}

/* Ensure the order notes checkbox and its elements are always visible */
.wc-block-checkout__order-notes .wc-block-components-checkbox,
.wc-block-checkout__order-notes .wc-block-components-checkbox * {
    visibility: visible !important;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__label {
    visibility: visible !important;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input {
    visibility: visible !important;
}

/* Ensure the order notes checkbox is properly interactive */
.wc-block-checkout__order-notes .wc-block-components-checkbox__input:checked {
    background-color: #007cba;
    border-color: #007cba;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__input:hover {
    border-color: #007cba;
}

.wc-block-checkout__order-notes .wc-block-components-checkbox__mark {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-radius: 3px;
    background: white;
    position: relative;
    margin-right: 0.5rem;
}

.wc-block-checkout__order-notes label.is-checked .wc-block-components-checkbox__mark {
    background-color: #007cba;
    border-color: #007cba;
}

.wc-block-checkout__order-notes label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

/* Ensure order notes containers are always visible */
.wc-block-checkout__order-notes-container,
.wc-block-checkout__order-notes-content {
    display: block !important;
}

/* Override accordion display:none for order notes specifically */
.wc-block-checkout__order-notes .wc-block-checkout__order-notes-container[style*="display: none"],
.wc-block-checkout__order-notes .wc-block-checkout__order-notes-content[style*="display: none"] {
    display: block !important;
}

/* Ensure order notes section is never hidden by accordion functionality */
.wc-block-checkout__order-notes,
.wc-block-checkout__order-notes .wc-block-checkout__order-notes-container,
.wc-block-checkout__order-notes .wc-block-checkout__order-notes-content {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

/* Override any WooCommerce block display:none for order notes */
.wc-block-checkout__order-notes[style*="display: none"],
.wc-block-checkout__order-notes [style*="display: none"] {
    display: block !important;
}

/* Ensure the order notes section maintains its structure */
.wc-block-checkout__order-notes {
    position: relative;
    z-index: 1;
}

/* Fix for WooCommerce Blocks order notes visibility */
.wc-block-components-checkout-order-notes__content {
    display: none;  /* Hide by default */
}

.wc-block-components-checkout-order-notes__content.visible {  /* Class toggled by WooCommerce */
    display: block;
}






