/**
 * Order Wizard - Step-by-step ordering flow
 * Consolidated styles for Products/view, Orders/confirmation, Orders/thank_you
 * Optimized for Bootstrap 5.2.3 - uses BS utilities where possible
 * Brand colors defined in variables.css
 */

/* ========================================
   CSS VARIABLES (Wizard-specific, inherits from variables.css)
   ======================================== */
:root {
    --wizard-primary: var(--brand-primary, #ec101a);
    --wizard-primary-dark: var(--brand-primary-dark, #c9302c);
    --wizard-success: #28a745;
    --wizard-warning: #e65100;
    --wizard-text: #333;
    --wizard-muted: #6c757d;
    --wizard-border: #e9ecef;
    --wizard-light: #f8f9fa;
}

/* ========================================
   PROGRESS INDICATOR
   ======================================== */
.order-wizard-progress {
    background: linear-gradient(135deg, var(--wizard-light) 0%, #fff 100%);
    border-bottom: 1px solid var(--wizard-border);
    padding: 1rem 0;
}

.wizard-steps {
    display: flex;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

/* Connector line between steps */
.wizard-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 18px;
    left: 60%;
    width: 80%;
    height: 3px;
    background: #dee2e6;
    z-index: 0;
}

.wizard-step.completed:not(:last-child)::after,
.wizard-step.active:not(:last-child)::after {
    background: var(--wizard-primary);
}

.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #dee2e6;
    color: var(--wizard-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}

.wizard-step.active .step-number {
    background: var(--wizard-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(236, 16, 26, 0.3);
    transform: scale(1.1);
}

.wizard-step.completed .step-number {
    background: var(--wizard-success);
    color: #fff;
}

.wizard-step.completed .step-number::before {
    content: '\f00c';
    font-family: 'FontAwesome';
}

.wizard-step.completed .step-number span {
    display: none;
}

.step-label {
    margin-top: 8px;
    font-size: 12px;
    color: var(--wizard-muted);
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}

.wizard-step.active .step-label {
    color: var(--wizard-primary);
    font-weight: 600;
}

.wizard-step.completed .step-label {
    color: var(--wizard-success);
}

/* ========================================
   PAGE WRAPPER
   ======================================== */
.order-wizard-page {
    min-height: 60vh;
}

/* ========================================
   WIZARD CARDS
   ======================================== */
.wizard-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.wizard-card-header {
    background: linear-gradient(135deg, var(--wizard-primary) 0%, var(--wizard-primary-dark) 100%);
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.wizard-card-header .fa {
    margin-right: 10px;
}

.wizard-card-body {
    background: #fff;
}

/* ========================================
   PRODUCT HEADER (Products/view.php)
   ======================================== */
.product-header {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.product-header h1 {
    font-family: 'Raleway', sans-serif;
    color: var(--wizard-text);
}

.delivery-badge {
    display: inline-flex;
    align-items: center;
    background: var(--wizard-light);
    border: 1px solid var(--wizard-border);
    border-radius: 8px;
}

/* ========================================
   MENU TABLES & LEGENDS
   ======================================== */
/* Remove Bootstrap default shadows on table bodies */
.inclusives tbody,
.addons-table tbody {
    box-shadow: none;
}

/* Camera icon for menu images */
.img-camera {
    width: 20px;
    vertical-align: middle;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.img-camera:hover {
    opacity: 1;
}

/* Legend bar */
.legend-items {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
}

.icon-description {
    margin-left: 8px;
}

/* Date/Time selects */
.date-select,
.input.time .form-select {
    display: inline-block;
    width: auto;
}

/* ========================================
   PRICE CALCULATOR (Products/view.php)
   ======================================== */
#total_price_calculator {
    background: var(--wizard-light);
    border-radius: 10px;
}

#total_price_calculator tr td {
    border: none;
}

#total_price_calculator .tpc_total td {
    border-top: 2px solid #dee2e6;
    color: var(--wizard-primary);
}

/* ========================================
   SUMMARY TABLES (Orders/confirmation.php)
   ======================================== */
.wizard-summary-table {
    width: 100%;
    margin-bottom: 0;
}

.wizard-summary-table td {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: top;
}

.wizard-summary-table tr:last-child td {
    border-bottom: none;
}

.wizard-summary-table td:first-child {
    color: var(--wizard-muted);
    font-weight: 500;
    width: 35%;
    padding-right: 10px;
}

.wizard-summary-table td:last-child {
    color: var(--wizard-text);
    text-align: left !important;
    word-break: break-word;
}

/* ========================================
   PRICE DISPLAY BOX
   ======================================== */
.wizard-price-box {
    background: linear-gradient(135deg, var(--wizard-light) 0%, #fff 100%);
    border: 2px solid var(--wizard-border);
    border-radius: 10px;
}

.wizard-price-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px dashed #dee2e6;
}

.wizard-price-row:last-child {
    border-bottom: none;
    border-top: 2px solid #dee2e6;
}

.wizard-price-label {
    color: var(--wizard-muted);
}

.wizard-price-value {
    font-weight: 600;
    color: var(--wizard-text);
}

.wizard-price-row.total .wizard-price-label,
.wizard-price-row.total .wizard-price-value {
    color: var(--wizard-primary);
    font-weight: 700;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */
.wizard-form .form-control,
.wizard-form .form-select {
    border: 2px solid var(--wizard-border);
    border-radius: 8px;
    transition: border-color 0.2s ease;
}

.wizard-form .form-control:focus,
.wizard-form .form-select:focus {
    border-color: var(--wizard-primary);
    box-shadow: 0 0 0 3px rgba(236, 16, 26, 0.1);
}

/* Terms checkbox alignment */
.terms-checkbox {
    display: flex;
    align-items: flex-start;
}

.terms-checkbox input {
    margin-top: 3px;
    flex-shrink: 0;
}

.terms-checkbox a {
    color: var(--wizard-primary);
}

/* Radio button groups */
.wizard-form .radio {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    padding: 0.5rem 0;
}

.wizard-form .radio .form-check {
    display: inline-flex;
    align-items: center;
    margin-bottom: 0;
    padding-left: 0;
    padding-right: 0.5rem;
}

.wizard-form .radio .form-check-input {
    margin-right: 0.5rem;
    margin-top: 0;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.wizard-form .radio label {
    margin-bottom: 0;
    cursor: pointer;
    padding: 0.25rem 0;
}

/* Product Remarks */
.product-remarks {
    background: #fff9f0;
    border: 1px solid #ffe0b2;
    color: var(--wizard-warning);
}

.product-remarks:empty {
    display: none;
}

/* ========================================
   PAYMENT OPTIONS
   ======================================== */
.payment-option {
    display: flex;
    align-items: flex-start;
    border: 2px solid var(--wizard-border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

.payment-option:hover,
.payment-option:focus-within,
.payment-option.selected {
    border-color: var(--wizard-primary);
    background: #fff5f5;
}

.payment-option input[type="radio"] {
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: var(--wizard-primary);
    flex-shrink: 0;
    cursor: pointer;
    margin: 28px 12px 0 0;
}

.payment-option-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    color: var(--wizard-primary);
    margin-right: 10px;
    flex-shrink: 0;
}

.payment-option-content {
    flex: 1;
    min-width: 0;
}

.payment-option-title {
    font-weight: 600;
    color: var(--wizard-text);
}

.payment-option-title .fa {
    color: var(--wizard-primary);
}

.payment-option-desc {
    color: var(--wizard-muted);
    margin: 0;
    line-height: 1.4;
}

/* ========================================
   THANK YOU PAGE (Orders/thank_you.php)
   ======================================== */
.wizard-success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--wizard-success) 0%, #20913c 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.3);
}

.wizard-success-icon .fa {
    font-size: 36px;
    color: #fff;
}

/* Step icons for next steps list */
.step-icon-wrapper {
    width: 44px;
    height: 44px;
    min-width: 44px;
    background: linear-gradient(135deg, #fff5f5 0%, #fff 100%);
    border: 2px solid var(--wizard-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.step-icon-wrapper .fa {
    font-size: 18px;
    color: var(--wizard-primary);
}

/* Contact icon */
.contact-icon-wrapper {
    width: 40px;
    height: 40px;
    min-width: 40px;
    background: var(--wizard-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-icon-wrapper .fa {
    font-size: 16px;
    color: #fff;
}

.contact-link:hover {
    color: var(--wizard-primary) !important;
}

/* ========================================
   WIZARD BUTTONS
   ======================================== */
.btn-wizard {
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
}

.btn-wizard-primary {
    background: linear-gradient(135deg, var(--wizard-primary) 0%, var(--wizard-primary-dark) 100%);
    color: #fff;
    border: none;
}

.btn-wizard-primary:hover,
.btn-wizard-primary:focus {
    background: linear-gradient(135deg, var(--wizard-primary-dark) 0%, #a02622 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(236, 16, 26, 0.3);
}

.btn-wizard-secondary {
    background: #fff;
    color: var(--wizard-muted);
    border: 2px solid #dee2e6;
}

.btn-wizard-secondary:hover,
.btn-wizard-secondary:focus {
    background: var(--wizard-light);
    color: var(--wizard-text);
    border-color: #adb5bd;
}

/* ========================================
   SIDEBAR STICKY (Desktop)
   ======================================== */
@media (min-width: 992px) {
    .order-sidebar,
    .payment-card {
        position: sticky;
        top: 20px;
    }
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

/* Small screens */
@media (max-width: 575.98px) {
    .step-label {
        font-size: 10px;
    }

    .step-number {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    /* Ensure buttons are fully visible on mobile */
    .btn-wizard {
        width: 100%;
        padding: 12px 16px;
    }

    /* Summary table responsive adjustments */
    .wizard-summary-table td:first-child {
        width: 30%;
        font-size: 13px;
    }

    .wizard-summary-table td:last-child {
        font-size: 13px;
    }

    .wizard-step:not(:last-child)::after {
        top: 16px;
        width: 60%;
        left: 70%;
    }

    .step-icon-wrapper {
        width: 38px;
        height: 38px;
        min-width: 38px;
    }

    .step-icon-wrapper .fa {
        font-size: 16px;
    }
}

/* iOS form zoom prevention */
@media (max-width: 767.98px) {
    .wizard-form .form-control,
    .wizard-form .form-select {
        font-size: 16px;
    }

    /* Stack date selects on small screens */
    .date-select,
    .input.time .form-select {
        display: block;
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Medium screens and up */
@media (min-width: 768px) {
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .wizard-step:not(:last-child)::after {
        top: 20px;
    }

    .step-label {
        font-size: 13px;
    }

    .wizard-success-icon {
        width: 100px;
        height: 100px;
    }

    .wizard-success-icon .fa {
        font-size: 48px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    .payment-option {
        min-height: 60px;
    }

    .payment-option input[type="radio"] {
        min-width: 24px;
        min-height: 24px;
    }
}

/* ========================================
   FOCUS STATES (Accessibility)
   ======================================== */
.btn-wizard:focus-visible,
.payment-option:focus-visible {
    outline: 3px solid var(--wizard-primary);
    outline-offset: 2px;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
/* Hide lightbox overlay when not in use */
.lightbox {
    display: none;
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .order-wizard-progress {
        background: none;
        border: none;
    }

    .wizard-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .wizard-card-header {
        background: #f0f0f0 !important;
        color: #333 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .btn-wizard {
        display: none;
    }
}
