/**
* 2007-2022 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
*
* Don't forget to prefix your containers with your own identifier
* to avoid any conflicts with others containers.
*/

.img_customer_logo_header { margin: 0 1rem; }

/* Ensure the header user area is a flex container so we can reorder elements visually */
.header-user-btn, .header-user-btn-w { display: flex; align-items: center; }

/* Wrapper to scope styling */
.opencrm-customer-logo-wrapper { display: flex; align-items: center; }

/* Force max size while keeping aspect ratio */
.img_customer_logo_header {
    max-width: 250px;
    max-height: 60px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
    margin-left: 0.5rem;
}

/* When the logo is rendered inside the header user buttons flex container,
   force it to appear before the other items (icons/buttons). */
.header-user-btn > .img_customer_logo_header,
.header-user-btn-w > .img_customer_logo_header {
    order: -2;
    margin-left: 0;
    margin-right: 0.75rem;
}

@media(max-width: 991px) {
    .img_customer_logo_header { display: block; margin: 0 auto 0.8rem auto; max-width: 100px; max-height: 50px; }
    /* On small screens, restore normal flow so the image stacks above buttons */
    .header-user-btn > .img_customer_logo_header,
    .header-user-btn-w > .img_customer_logo_header { order: 0; margin: 0 auto 0.8rem auto; }
}

.row.no-gutters.justify-content-end > .opencrm-customer-logo-col {
    order: -3;
    margin-left: 0; /* ensure spacing is handled to the right */
    margin-right: 0.75rem;
}
.row.no-gutters.justify-content-end > .header-user-btn-w {
    order: -2;
}
.row.no-gutters.justify-content-end > #ps-shoppingcart-wrapper {
    order: -1;
}

@media(max-width: 991px) {
    /* On small screens, keep natural DOM order so elements stack vertically */
    .row.no-gutters.justify-content-end > .opencrm-customer-logo-col,
    .row.no-gutters.justify-content-end > .header-user-btn-w,
    .row.no-gutters.justify-content-end > #ps-shoppingcart-wrapper { order: 0; }
}
