/**
 * Multi-Page Checkout Enhancement CSS
 * Version: 3.0
 * Enhanced User Experience for VirtueMart Multi-Page Checkout
 */

/* === CHECKOUT PROGRESS INDICATOR === */
.vm-checkout-progress {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 0;
    margin-bottom: 40px;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.vm-progress-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.vm-progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.vm-progress-steps::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255,255,255,0.3);
    z-index: 1;
    transform: translateY(-50%);
}

.vm-progress-steps::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #28a745, #20c997);
    z-index: 2;
    transform: translateY(-50%);
    transition: width 0.6s ease;
}

/* Progress line width based on current step */
.vm-step-1 .vm-progress-steps::after { width: 0%; }
.vm-step-2 .vm-progress-steps::after { width: 33.33%; }
.vm-step-3 .vm-progress-steps::after { width: 66.66%; }
.vm-step-4 .vm-progress-steps::after { width: 100%; }

.vm-progress-step {
    position: relative;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    min-width: 120px;
}

.vm-step-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    border: 3px solid rgba(255,255,255,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 12px;
    transition: all 0.4s ease;
    position: relative;
}

.vm-step-circle i {
    font-size: 28px;
}

.vm-progress-step.active .vm-step-circle {
    background: #28a745;
    border-color: #28a745;
    transform: scale(1.1);
    box-shadow: 0 0 0 8px rgba(40, 167, 69, 0.2);
}

.vm-progress-step.completed .vm-step-circle {
    background: #20c997;
    border-color: #20c997;
}

.vm-progress-step.completed .vm-step-circle::after {
    content: '✓';
    position: absolute;
    font-size: 20px;
    color: white;
}

.vm-step-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.vm-progress-step.active .vm-step-title {
    opacity: 1;
    color: #28a745;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

/* === ENHANCED STEP LAYOUT === */
.vm-checkout-container {
    margin: 0 auto;
    padding: 0 20px;
}

.vm-checkout-main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}

.vm-checkout-content {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
}

.vm-checkout-sidebar {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    height: fit-content;
    position: sticky;
    top: 20px;
    border: 1px solid #e9ecef;
}

/* === STEP HEADERS === */
.vm-step-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

.vm-step-header h1 {
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
}

.vm-step-subtitle {
    color: #6c757d;
    font-size: 16px;
    margin: 0;
}

/* === FORM ENHANCEMENTS === */
.vm-shipment-select,
.vm-payment-select {
    margin: 0;
    border: none;
    padding: 0;
}

.vm-shipment-plugin-single,
.vm-payment-plugin-single {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.vm-shipment-plugin-single:hover,
.vm-payment-plugin-single:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,123,255,0.15);
}

.vm-shipment-plugin-single.selected,
.vm-payment-plugin-single.selected {
    border-color: #28a745;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.vm-shipment-plugin-single.selected label,
.vm-payment-plugin-single.selected label,
.vm-shipment-plugin-single.selected .form-check-label,
.vm-payment-plugin-single.selected .form-check-label {
    color: white !important;
}

/* === BUTTON ENHANCEMENTS === */
.vm-checkout-buttons {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e9ecef;
}

.vm-btn-back {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.vm-btn-back:hover {
    background: #5a6268;
    transform: translateY(-2px);
    color: white;
    text-decoration: none;
}

.vm-btn-continue {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,123,255,0.3);
}

.vm-btn-continue:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.4);
}

.vm-btn-continue:active {
    transform: translateY(0);
}

/* === ORDER SUMMARY SIDEBAR === */
.vm-order-summary {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border: 1px solid #e9ecef;
}

.vm-order-summary h3 {
    color: #2c3e50;
    font-size: 18px;
    margin-bottom: 15px;
    font-weight: 700;
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 10px;
}

.vm-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

.vm-summary-item:last-child {
    border-bottom: none;
    font-weight: 700;
    color: #28a745;
    font-size: 16px;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 768px) {
    .vm-checkout-main {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .vm-progress-steps {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .vm-step-circle {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .vm-step-title {
        font-size: 12px;
    }
    
    .vm-checkout-buttons {
        flex-direction: column;
        gap: 15px;
    }
    
    .vm-btn-back,
    .vm-btn-continue {
        width: 100%;
        justify-content: center;
    }
}

/* === ANIMATIONS === */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.vm-checkout-content {
    animation: slideInUp 0.6s ease;
}

/* === LOADING STATES === */
.vm-loading {
    position: relative;
    pointer-events: none;
}

.vm-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
}

.vm-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

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

/* === SUCCESS INDICATORS === */
.vm-success-message {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInUp 0.6s ease;
}

.vm-success-message i {
    font-size: 20px;
}

@keyframes checkmark {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Enhanced Headers for Shipment/Payment Pages */
.vm-shipment-header-select,
.vm-shipment-header-selected,
.vm-payment-header-select,
.vm-payment-header-selected {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 25px;
    margin: 0 0 30px 0;
    text-align: center;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,123,255,0.2);
    font-size: 20px;
}

.vm-shipment-header-selected,
.vm-payment-header-selected {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    box-shadow: 0 4px 15px rgba(40,167,69,0.2);
}

.vm-shipment-header-select::before {
    content: '🚚';
    margin-right: 10px;
}

.vm-payment-header-select::before {
    content: '💳';
    margin-right: 10px;
}

/* Form Container Enhancement */
#shipmentForm,
#paymentForm {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid #e9ecef;
    margin: 20px 0;
}

/* Enhanced Button Styling for Shipment/Payment */
.vm-button-correct,
button[name="updatecart"] {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40,167,69,0.2);
    margin: 10px 5px;
}

.vm-button-correct:hover,
button[name="updatecart"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40,167,69,0.3);
}

/* Page-specific body classes */
body.view-cart[class*="layout-select_shipment"],
body.view-cart[class*="shipment"] {
    background: #f8f9fa;
}

body.view-cart[class*="layout-select_payment"],
body.view-cart[class*="payment"] {
    background: #f8f9fa;
}

/* Radio button enhancement - Updated for Bootstrap 5 structure */
.vm-shipment-plugin-single input[type="radio"],
.vm-payment-plugin-single input[type="radio"],
.vm-shipment-plugin-single .form-check-input,
.vm-payment-plugin-single .form-check-input {
    position: relative;
    opacity: 1;
    pointer-events: auto;
    margin-right: 8px;
    margin-bottom: 0;
    width: 18px;
    height: 18px;
    accent-color: #28a745;
    cursor: pointer;
    vertical-align: middle;
    top: -1px;
    flex-shrink: 0;
}

.vm-shipment-plugin-single input[type="radio"] + label,
.vm-payment-plugin-single input[type="radio"] + label,
.vm-shipment-plugin-single .form-check-input + .form-check-label,
.vm-payment-plugin-single .form-check-input + .form-check-label,
.vm-shipment-plugin-single .form-check-label,
.vm-payment-plugin-single .form-check-label {
    display: inline !important;
    cursor: pointer;
    font-weight: 500;
    color: #495057;
    margin-left: 0;
    line-height: 1.4;
    vertical-align: middle;
    flex: 1;
}

.vm-shipment-plugin-single input[type="radio"]:checked + label,
.vm-payment-plugin-single input[type="radio"]:checked + label,
.vm-shipment-plugin-single .form-check-input:checked + .form-check-label,
.vm-payment-plugin-single .form-check-input:checked + .form-check-label {
    color: #28a745;
    font-weight: 600;
}

/* Override Bootstrap flexbox for proper inline display */
.vm-shipment-plugin-single.d-flex,
.vm-payment-plugin-single.d-flex {
    align-items: center !important;
    flex-direction: row !important;
}

/* Ensure radio buttons are clickable within the card */
.vm-shipment-plugin-single .vm-radio-wrapper,
.vm-payment-plugin-single .vm-radio-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    position: relative;
    z-index: 10;
    width: 100%;
}

/* Force inline layout for radio button and label together */
.vm-shipment-plugin-single .vm-radio-wrapper *,
.vm-payment-plugin-single .vm-radio-wrapper * {
    display: inline !important;
    vertical-align: middle !important;
}

.vm-shipment-plugin-single .vm-radio-wrapper input[type="radio"],
.vm-payment-plugin-single .vm-radio-wrapper input[type="radio"] {
    margin-right: 8px !important;
    margin-bottom: 0 !important;
}

/* Radio button enhancement - Force inline display */
.vm-shipment-plugin-single,
.vm-payment-plugin-single {
    background: #fff;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    
    /* Force all content to be inline */
    display: block !important;
    line-height: 1.5;
}

.vm-shipment-plugin-single * {
    display: inline !important;
    vertical-align: middle !important;
    margin-bottom: 0 !important;
    line-height: 1.4 !important;
}

.vm-payment-plugin-single * {
    display: inline !important;
    vertical-align: middle !important;
    margin-bottom: 0 !important;
    line-height: 1.4 !important;
}

.vm-shipment-plugin-single input[type="radio"],
.vm-payment-plugin-single input[type="radio"],
.vm-shipment-plugin-single .form-check-input,
.vm-payment-plugin-single .form-check-input {
    opacity: 1 !important;
    pointer-events: auto !important;
    margin-right: 8px !important;
    margin-bottom: 0 !important;
    margin-top: 0 !important;
    width: 18px !important;
    height: 18px !important;
    accent-color: #28a745;
    cursor: pointer !important;
    vertical-align: middle !important;
    position: relative !important;
    top: -2px !important;
    display: inline !important;
}

.vm-shipment-plugin-single label,
.vm-payment-plugin-single label,
.vm-shipment-plugin-single .form-check-label,
.vm-payment-plugin-single .form-check-label {
    color: #495057 !important;
    font-weight: 500 !important;
    font-size: 16px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: inline !important;
    cursor: pointer !important;
    vertical-align: middle !important;
    line-height: 1.4 !important;
}

.vm-shipment-plugin-single:hover,
.vm-payment-plugin-single:hover {
    border-color: #007bff;
    box-shadow: 0 4px 15px rgba(0,123,255,0.1);
    transform: translateY(-2px);
}

/* Selected state - triggered by radio button checked */
.vm-shipment-plugin-single:has(input[type="radio"]:checked),
.vm-payment-plugin-single:has(input[type="radio"]:checked) {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    box-shadow: 0 4px 15px rgba(40,167,69,0.2);
}

/* Fallback for browsers that don't support :has() */
.vm-shipment-plugin-single.selected,
.vm-payment-plugin-single.selected {
    border-color: #28a745;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
    box-shadow: 0 4px 15px rgba(40,167,69,0.2);
}

.vm-shipment-plugin-single:has(input[type="radio"]:checked)::after,
.vm-payment-plugin-single:has(input[type="radio"]:checked)::after,
.vm-shipment-plugin-single.selected::after,
.vm-payment-plugin-single.selected::after {
    content: '✓';
    position: absolute;
    top: 15px;
    right: 15px;
    background: #28a745;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    animation: checkmark 0.3s ease;
}

/* Description text styling */
.vm-shipment-plugin-single .vm-shipment-description,
.vm-payment-plugin-single .vm-payment-description {
    font-size: 14px;
    color: #6c757d;
    margin-top: 8px;
    line-height: 1.4;
}

/* Price display enhancement */
.vm-shipment-plugin-single .vm-price,
.vm-payment-plugin-single .vm-price {
    font-weight: 600;
    color: #007bff;
    font-size: 16px;
    margin-top: 8px;
}

/* Mobile enhancements for shipment/payment pages */
@media (max-width: 768px) {
    .vm-shipment-plugin-single,
    .vm-payment-plugin-single {
        padding: 15px;
        margin-bottom: 12px;
    }
    
    .vm-shipment-header-select,
    .vm-shipment-header-selected,
    .vm-payment-header-select,
    .vm-payment-header-selected {
        padding: 20px 15px;
        font-size: 18px;
        margin: 0 0 20px 0;
    }
    
    #shipmentForm,
    #paymentForm {
        padding: 20px 15px;
        margin: 15px 0;
    }
}

/* === BOX NOW WIDGET STYLING === */
#boxnow-widget-container {
    animation: slideInUp 0.6s ease;
    box-shadow: 0 4px 15px rgba(40,167,69,0.1);
    transition: all 0.3s ease;
}

#boxnow-widget-container h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.boxnow-map-widget-button {
    transition: all 0.3s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.boxnow-map-widget-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40,167,69,0.3);
    text-decoration: none;
    color: white;
}

#boxnow-widget-container input[readonly] {
    cursor: not-allowed;
    font-size: 14px;
}

#boxnow-widget-container label {
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* BOX NOW widget responsive design */
@media (max-width: 768px) {
    #boxnow-widget-container {
        margin: 15px 0;
        padding: 15px;
    }
    
    #boxnow-widget-container > div:last-child {
        grid-template-columns: 1fr;
    }
    
    .boxnow-map-widget-button {
        width: 100%;
        justify-content: center;
        padding: 15px 20px;
    }
}
