/**
 * MBCCF Wizard Styles
 *
 * Professional wizard interface styling that integrates with existing MBCCF card design
 */

/* ==========================================================================
   Wizard Container & Layout
   ========================================================================== */
.mbccf-wizard-container {
    max-width: 700px;
    margin: 0 auto;
    /* padding: 0 20px; */
}

/* ==========================================================================
   Wizard Navigation & Progress
   ========================================================================== */
.mbccf-wizard-navigation {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mbccf-wizard-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
}

.mbccf-wizard-step-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mbccf-wizard-step-nav:not(.completed):not(.active) {
    cursor: default;
    opacity: 0.6;
}

.mbccf-wizard-step-nav.completed {
    cursor: pointer;
}

.mbccf-step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #e9ecef;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
    border: 3px solid transparent;
}

.mbccf-wizard-step-nav.active .mbccf-step-number {
    background: var(--pd);
    color: var(--y);
    border-color: var(--pd);
}

.mbccf-wizard-step-nav.completed .mbccf-step-number {
    background: #28a745;
    color: white;
}

.mbccf-wizard-step-nav.completed .mbccf-step-number::after {
    content: '✓';
    font-size: 16px;
    position: absolute;
}

.mbccf-wizard-step-nav.completed .mbccf-step-number {
    font-size: 0; /* Hide number when showing checkmark */
}

.mbccf-step-title {
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    color: #495057;
    transition: color 0.3s ease;
    max-width: 120px;
}

.mbccf-wizard-step-nav.active .mbccf-step-title {
    color: var(--pd);
}

.mbccf-wizard-step-nav.completed .mbccf-step-title {
    color: #28a745;
}

/* Connection lines between steps */
.mbccf-wizard-steps::before {
    content: '';
    position: absolute;
    top: 24px;
    left: 15%;
    right: 15%;
    height: 2px;
    background: #e9ecef;
    z-index: 0;
}

.mbccf-wizard-step-nav {
    z-index: 1;
}

/* Progress bar */
.mbccf-wizard-progress {
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.mbccf-wizard-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--pm) 0%, var(--pd) 100%);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* ==========================================================================
   Wizard Steps
   ========================================================================== */
/* .mbccf-wizard {
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
} */

.mbccf-wizard-step {
    display: none;
    padding: 0;
}

.mbccf-wizard-step.active {
    display: block;
}

.mbccf-step-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 30px 40px;
    border-bottom: 1px solid #dee2e6;
}

.mbccf-step-header h2 {
    margin: 0 0 10px 0;
    color: #212529;
    font-size: 1.5rem;
    font-weight: 600;
}

.mbccf-step-header p {
    margin: 0;
    color: #6c757d;
    font-size: 16px;
    line-height: 1.5;
}

.mbccf-step-content {
    padding: 40px;
}

/* ==========================================================================
   Wizard Controls & Buttons
   ========================================================================== */
.mbccf-wizard-controls {
    padding: 30px 40px;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px;
    margin-bottom: 50px;
}

.mbccf-wizard-controls .button {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    font-size: 0.9rem !important;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-height: 44px;
    border-radius: 12px !important;
}

.mbccf-wizard-next {
    background: #007cba;
    color: white;
}

.mbccf-wizard-next:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,124,186,0.3);
}

.mbccf-wizard-prev {
    background: #6c757d;
    color: white;
}

.mbccf-wizard-prev:hover {
    background: #5a6268;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(108,117,125,0.3);
}

.mbccf-wizard-arrow {
    font-size: 0.9rem;
    font-weight: bold;
}

/* ==========================================================================
   MBCCF Card Integration
   ========================================================================== */

/* Ensure MBCCF cards work well within wizard */
.mbccf-wizard-step .mbccf-checkout-section {
    margin-bottom: 30px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.mbccf-wizard-step .mbccf-section-header {
    /* background: linear-gradient(135deg, #007cba 0%, #005a87 100%); */
    color: white;
    padding: 20px 25px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.mbccf-wizard-step .mbccf-section-header .mbccf-icon {
    width: 40px;
    height: 40px;
    /* background: rgba(255,255,255,0.2); */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

.mbccf-wizard-step .mbccf-section-title {
    margin: 0 0 5px 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.mbccf-wizard-step .mbccf-section-subtitle {
    margin: 0;
    font-size: 14px;
    color: rgba(255,255,255,0.9);
    opacity: 0.9;
}

.mbccf-wizard-step .mbccf-section-content {
    padding: 30px 25px;
    background: white;
}

/* ==========================================================================
   Form Field Enhancements
   ========================================================================== */
.mbccf-wizard-step .form-row {
    margin-bottom: 20px;
}

.mbccf-wizard-step .form-row label {
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
    display: block;
}

.mbccf-wizard-step .form-row input,
.mbccf-wizard-step .form-row select,
.mbccf-wizard-step .form-row textarea {
    border: 2px solid #e9ecef;
    border-radius: 12px !important;
    padding: 12px 15px;
    font-size: 16px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    width: 100%;
}


.mbccf-wizard-step .form-row input[type="checkbox"] {
    width: auto;
}

.mbccf-wizard-step .form-row input:focus,
.mbccf-wizard-step .form-row select:focus,
.mbccf-wizard-step .form-row textarea:focus {
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0,124,186,0.1);
    outline: none;
}

/* Validation states */
.mbccf-wizard-invalid,
.mbccf-wizard-step .woocommerce-invalid input,
.mbccf-wizard-step .woocommerce-invalid select,
.mbccf-wizard-step .woocommerce-invalid textarea {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.1) !important;
}

/* Focus states for validation feedback */
.mbccf-wizard-step .woocommerce-invalid input:focus,
.mbccf-wizard-step .woocommerce-invalid select:focus,
.mbccf-wizard-step .woocommerce-invalid textarea:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.25) !important;
    outline: none;
}

/* Field error messages */
.field-error-message {
    color: #dc3545;
    font-size: 0.875em;
    margin-top: 0.25rem;
    display: block;
    font-weight: 500;
}

/* Required field focus enhancement */
input[required]:focus,
select[required]:focus,
textarea[required]:focus,
input[data-required="true"]:focus,
select[data-required="true"]:focus,
textarea[data-required="true"]:focus {
    border-color: #ffc107 !important;
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.15) !important;
    outline: none;
}

/* Focus state override for invalid required fields */
.mbccf-wizard-step .woocommerce-invalid input[required]:focus,
.mbccf-wizard-step .woocommerce-invalid select[required]:focus,
.mbccf-wizard-step .woocommerce-invalid textarea[required]:focus,
.mbccf-wizard-step .woocommerce-invalid input[data-required="true"]:focus,
.mbccf-wizard-step .woocommerce-invalid select[data-required="true"]:focus,
.mbccf-wizard-step .woocommerce-invalid textarea[data-required="true"]:focus {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220,53,69,0.25) !important;
}

/* ==========================================================================
   Customer Type Radio Buttons
   ========================================================================== */
.mbccf-wizard-step .mbccf-customer-type-options {
    display: flex;
    gap: 20px;
    margin-top: 15px;
}

.mbccf-wizard-step .mbccf-customer-type-option {
    flex: 1;
    /* border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 20px; */
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.mbccf-wizard-step .mbccf-customer-type-option:hover {
    border-color: #007cba;
    background: rgba(0,124,186,0.05);
}

.mbccf-wizard-step .mbccf-customer-type-option.selected {
    border-color: #007cba;
    background: rgba(0,124,186,0.1);
}

.mbccf-wizard-step .mbccf-customer-type-option input[type="radio"] {
    margin-bottom: 10px;
    transform: scale(1.2);
}

/* ==========================================================================
   Error Messages
   ========================================================================== */
.mbccf-wizard-step .woocommerce-NoticeGroup-checkout {
    margin: 0 0 20px 0;
}

.mbccf-wizard-step .woocommerce-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 12px;
    /* margin-bottom: 20px; */
}

.mbccf-wizard-step .woocommerce-error ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.mbccf-wizard-step .woocommerce-error li {
    margin: 15px 0;
    line-height: normal;
    padding-left: 20px;
    position: relative;
}

.mbccf-wizard-step .woocommerce-error li:before {
    content: '⚠️';
    margin-right: 8px;
    /* position: absolute;
    left: 0;
    top: 0; */
}

/* .mbccf-wizard-step .woocommerce-error li:last-child {
    margin-bottom: 0;
} */

/* ==========================================================================
   Order Review (Step 3)
   ========================================================================== */
/* .mbccf-order-review-wrapper {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    overflow: hidden;
} */

.mbccf-order-review-wrapper .woocommerce-checkout-review-order-table {
    margin: 0;
}

.mbccf-order-review-wrapper .shop_table {
    border: none;
    border-collapse: collapse;
    width: 100%;
}

.mbccf-order-review-wrapper .shop_table th,
.mbccf-order-review-wrapper .shop_table td {
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    text-align: left;
}

.mbccf-order-review-wrapper .shop_table thead th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.mbccf-order-review-wrapper .order-total {
    background: rgba(0,124,186,0.05);
    font-weight: 600;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    /* .mbccf-wizard-container {
        padding: 0 15px;
    } */

    .mbccf-wizard-step-nav:not(.active) {
        display: none;
    }

    .mbccf-wizard-navigation {
        padding: 20px 15px;
    }

    .mbccf-wizard-steps {
        flex-direction: column;
        gap: 15px;
    }

    .mbccf-wizard-steps::before {
        display: none;
    }

    .mbccf-step-header,
    .mbccf-step-content,
    .mbccf-wizard-controls {
        padding: 20px 15px;
    }

    .mbccf-wizard-controls {
        flex-direction: column;
        gap: 10px;
    }

    .mbccf-wizard-controls .button {
        width: 100%;
        justify-content: center;
    }

    .mbccf-wizard-step .mbccf-customer-type-options {
        flex-direction: column;
    }

    .mbccf-step-title {
        max-width: none;
        font-size: 16px;
    }
}

/* ==========================================================================
   Loading States & Transitions
   ========================================================================== */
.mbccf-wizard-step {
    animation: fadeIn 0.3s ease-in-out;
}

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

.mbccf-wizard-loading {
    pointer-events: none;
    opacity: 0.7;
}

.mbccf-wizard-loading .mbccf-wizard-controls .button {
    position: relative;
    color: transparent;
}

.mbccf-wizard-loading .mbccf-wizard-controls .button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: rgba(255,255,255,0.8);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================================================
   Hidden Fields Container
   ========================================================================== */
.mbccf-hidden-fields {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
}

.mbccf-pec-actions .mbccf-pec-check-button {
    border-radius: 12px !important;
    font-size: 0.9rem !important;
}

/* ==========================================================================
   Address Copy Checkbox (BREAKING CHANGE)
   ========================================================================== */
.mbccf-address-copy-wrapper {
    background: linear-gradient(135deg, #e3f2fd 0%, #f1f8e9 100%);
    border: 1px solid #2196f3;
    border-radius: 12px;
    padding: 20px 25px;
    margin-bottom: 25px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.mbccf-address-copy-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #2196f3 0%, #4caf50 100%);
}

.mbccf-address-copy-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    cursor: pointer;
    margin: 0;
}

.mbccf-address-copy-checkbox input[type="checkbox"] {
    margin: 0;
    transform: scale(1.2);
    accent-color: #2196f3;
    flex-shrink: 0;
    margin-top: 2px;
}

.mbccf-address-copy-label {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.mbccf-address-copy-label strong {
    font-size: 16px;
    font-weight: 600;
    color: #1976d2;
    line-height: 1.4;
}

.mbccf-address-copy-label span {
    font-size: 14px;
    color: #666;
    line-height: 1.4;
}

/* Checkbox hover effect */
.mbccf-address-copy-checkbox:hover {
    transform: translateY(-1px);
}

.mbccf-address-copy-wrapper:hover {
    border-color: #1976d2;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.15);
}

/* Active copy feedback animation */
.mbccf-address-copy-wrapper.mbccf-copy-active {
    background: linear-gradient(135deg, #e8f5e8 0%, #f3e5f5 100%);
    border-color: #4caf50;
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.25);
}

.mbccf-address-copy-wrapper.mbccf-copy-active::before {
    background: linear-gradient(90deg, #4caf50 0%, #8bc34a 100%);
}

.mbccf-address-copy-wrapper.mbccf-copy-active .mbccf-address-copy-label strong {
    color: #388e3c;
}

/* Read-only billing name fields (pre-filled from Step 1) */
.mbccf-readonly-field input[type="text"] {
    background-color: #f5f5f5;
    color: #555;
    cursor: not-allowed;
    border-color: #ddd;
}

.mbccf-billing-personal-fields .mbccf-subsection-title {
    margin-top: 0;
    margin-bottom: 12px;
}

/* Responsive design for checkbox */
@media (max-width: 768px) {
    .mbccf-address-copy-wrapper {
        padding: 15px 20px;
        margin-bottom: 20px;
    }

    .mbccf-address-copy-checkbox {
        gap: 12px;
    }

    .mbccf-address-copy-label strong {
        font-size: 15px;
    }

    .mbccf-address-copy-label span {
        font-size: 13px;
    }
}