/* ========================================
   mg_combinationview - Main styles
   ======================================== */
#mg-product-combination-view {
  scroll-margin-top: 140px; /* hauteur du header */
}

#mg-product-combination-view-container {
    margin: 80px auto;
    max-width: 1230px;
    padding: 0 30px;
}

/* Hide native number spinners */
.mg-combination-cards input[type=number]::-webkit-inner-spin-button,
.mg-combination-cards input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}
.mg-combination-cards input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ========================================
   Header row: text left, image right
   ======================================== */
.mg-header-row {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    align-items: stretch;
}

.mg-header-left {
    flex: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 10px 20px 0 20px;
}

.mg-header-left h3 {
    margin: 0 0 10px 0;
    font-size: 20px;
    font-weight: 600;
    color: var(--navy);
}

.mg-header-left p {
    margin: 0;
    font-size: 14px;
    color: var(--navy);
}
.mg-header-left .btn-secondary-cta{
    display: block;
    text-align: center;
    margin-top: 1.35rem;
}
.mg-header-left .btn-secondary-cta a.btn{
    width: auto;
}

.mg-header-right {
    flex: 3;
    padding: 15px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.mg-header-right img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 6px;
}

@media (max-width: 1024px) {
    .mg-header-row {
        flex-direction: column;
    }
    .mg-header-left {
        padding: 0 20px;
    }
}

/* ========================================
   Color images (per-attribute header images)
   ======================================== */
.mg-color-images {
    flex-shrink: 0;
}

.mg-color-image-item img {
    max-width: 55px;
    max-height: 55px;
    display: block;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    object-fit: contain;
    cursor: pointer;
}

/* Color image lightbox */
.mg-color-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    z-index: 2147483647;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.mg-color-lightbox img {
    min-width: 60vh;
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

/* ========================================
   Color custom dropdown
   ======================================== */
.mg-color-dropdown {
    position: relative;
    width: 100%;
}

.mg-color-dropdown-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.mg-color-dropdown-selected span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mg-color-dropdown-selected img {
    max-height: 32px;
    width: auto;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

.mg-color-dropdown-selected.form-control.form-control-select {
    display: inline-flex;
    background: url("data:image/svg+xml;utf8,<svg viewBox='0 0 140 140' width='12' height='12' xmlns='http://www.w3.org/2000/svg'><g><path d='m121.3,34.6c-1.6-1.6-4.2-1.6-5.8,0l-51,51.1-51.1-51.1c-1.6-1.6-4.2-1.6-5.8,0-1.6,1.6-1.6,4.2 0,5.8l53.9,53.9c0.8,0.8 1.8,1.2 2.9,1.2 1,0 2.1-0.4 2.9-1.2l53.9-53.9c1.7-1.6 1.7-4.2 0.1-5.8z' style='fill:black;stroke:black;stroke-width:3'/></g></svg>") no-repeat;
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 13px;
    background-color: #fff;
    padding-right: 40px;
}

.mg-color-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    z-index: 1000;
    max-height: 250px;
    overflow-y: auto;
    margin-top: 2px;
}

.mg-color-dropdown-list.open {
    display: block;
}

.mg-color-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.mg-color-dropdown-item:hover {
    background: #f8f9fa;
}

.mg-color-dropdown-item span {
    flex: 1;
    font-size: 14px;
}

.mg-color-dropdown-item img {
    max-height: 32px;
    width: auto;
    border-radius: 3px;
    object-fit: contain;
    flex-shrink: 0;
}

/* ========================================
   Header
   ======================================== */
.mg-combination-header {
    background: var(--ciel);
    border: 1px solid var(--blue);
    border-radius: 6px;
    padding: 12px 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.mg-combination-header-filters {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    flex: 1;
}

.mg-combination-header-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mg-combination-header-label {
    color: var(--navy);
    font-size: 14px;
}

.mg-combination-header-value {
    font-weight: 600;
    color: var(--navy);
    font-size: 15px;
}

.mg-combination-header-actions {
    flex-shrink: 0;
}

.mg-combination-header-actions .btn-primary-cta {
    margin: 0;
}

.mg-combination-header-actions .mg-cms-guide-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    padding: 6px 16px;
    min-width: auto;
    height: auto;
}

.mg-combination-header-actions .mg-cms-guide-btn img {
    width: 16px;
    height: 16px;
}

/* ========================================
   Cards container
   ======================================== */
.mg-combination-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* Individual card */
.mg-combination-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    flex: 1 1 calc(20% - 12px);
    min-width: 160px;
    max-width: calc(20% - 12px);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: border-color 0.2s, background-color 0.2s;
}

.mg-few-cards .mg-combination-card {
    max-width: none;
}

@media (max-width: 1024px) {
    .mg-combination-card {
        flex: 1 1 calc(33.33% - 10px);
        max-width: calc(33.33% - 10px);
    }
}
@media (max-width: 768px) {
    .mg-combination-card {
        flex: 1 1 calc(50% - 8px);
        max-width: calc(50% - 8px);
    }
}
@media (max-width: 480px) {
    .mg-combination-card {
        flex: 1 1 100%;
        max-width: 100%;
    }
}

/* Card label */
.mg-card-label {
    font-weight: 600;
    font-size: 15px;
    color: var(--navy);;
    text-align: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--ciel);
}

/* Card reference */
.mg-card-reference {
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

/* Card price */
.mg-card-price {
    text-align: center;
    font-size: 16px;
    font-weight: 500;
    color: var(--blue);
}

/* Price sub-elements */
.mg-regular-price,
.mg-discount-price,
.mg-discount {
    margin: 0.3rem 0;
}

.mg-regular-price span {
    text-decoration: line-through;
    color: #7a7a7a;
    font-weight: 400;
}

.mg-discount-price span {
    color: #f39d72;
    font-weight: 400;
    white-space: nowrap;
}

.mg-current-price span,
.mg-product-unit-price {
    font-weight: 400;
    color: var(--navy);
    font-style: italic;
}

.mg-product-unit-price {
    font-size: 12px;
}

.mg-discount span {
    background-color: #f39d72;
    color: #fff;
    font-weight: 700;
    padding: .3125rem;
    white-space: nowrap;
    font-size: 12px;
}

/* Card stock badge */
.mg-card-stock {
    text-align: center;
}

.mg-out-of-stock .badge-danger {
    background-color: #dc3545;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
}

/* ========================================
   Quantity selector
   ======================================== */
.mg-card-qty {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: auto;
}

.mg-card-qty button {
    width: 38px;
    height: 38px;
    padding: 0;
    font-size: 20px;
    font-weight: bold;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.mg-card-qty button:hover {
    background: #e9ecef;
}

.mg-card-qty input {
    width: 62px;
    text-align: center;
    height: 38px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    min-height: inherit;
}

/* ========================================
   Bulk add to cart
   ======================================== */
.mg-bulk-add-to-cart {
    margin-top: 40px;
    text-align: center;
    margin-bottom: 80px;
}
.mg-bulk-add-to-cart .info-add{
    display: block;
    text-align: center;
    margin-top: .35rem;
    font-size: 14px;
}

.mg-bulk-add-to-cart .btn-primary-cta {
    display: inline-block;
    width: auto;
    margin: 0;
}

.mg-multi-add-to-cart {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.mg-multi-add-to-cart[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.mg-no-combinations {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

/* Hide overlapping elements when sticky bar is visible */
body.mg-bar-visible #btnTop,
body.mg-bar-visible .agJsWidget {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

/* ========================================
   Sticky selection bar
   ======================================== */
.mg-selection-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 2px solid #dee2e6;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: 2147483647;
    transform: translateY(100%);
    transition: transform 0.3s ease;
}

.mg-selection-bar.visible {
    transform: translateY(0);
}

.mg-selection-bar .btn-primary-cta {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

.mg-selection-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    flex: 1;
    overflow-x: auto;
}

.mg-selection-item {
    background: var(--ciel);
    border: 1px solid var(--blue);
    border-radius: 20px;
    padding: 6px 12px;
    font-size: 13px;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mg-selection-item-qty {
    background: var(--blue);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
}

.mg-selection-item-remove {
    color: #6c757d;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 4px;
    line-height: 1;
    transition: color 0.2s;
    user-select: none;
}

.mg-selection-item-remove:hover {
    color: #dc3545;
}

@media (max-width: 600px) {
    .mg-selection-bar {
        flex-direction: column;
        padding: 10px 15px;
    }
    .mg-selection-summary {
        overflow-y: auto;
    }
}

/* ========================================
   Modals (Bootstrap overrides)
   ======================================== */
#mg-cms-modal .modal-dialog {
    max-width: 630px;
}

#mg-cms-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#mg-cms-modal .modal-header .close {
    position: static;
    margin: 0;
    padding: 0 0 0 10px;
}

#mg-cms-modal .modal-body {
    padding: 0;
    height: 85vh;
    overflow: hidden;
}

#mg-cms-modal .modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#mg-accessories-modal .modal-body {
    padding: 20px;
}

.mg-accessories-subtitle {
    font-size: 14px;
    color: var(--navy);
    opacity: .7;
    margin-bottom: 20px;
}

.mg-accessories-list {
    max-height: 65vh;
    overflow-y: auto;
}

.mg-accessory-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    border: 1px solid var(--ciel);
    border-radius: 6px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.mg-accessory-item:hover {
    border-color: var(--blue);
}

.mg-accessory-check {
    flex-shrink: 0;
}

.mg-accessory-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.mg-accessory-image {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.mg-accessory-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.mg-accessory-info {
    flex: 1;
}

.mg-accessory-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--navy);
    margin-bottom: 4px;
}

.mg-accessory-price {
    font-weight: 600;
    color: var(--blue);
    font-size: 15px;
    margin-bottom: 6px;
}

.mg-accessory-combination {
    font-size: 13px;
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    max-width: 250px;
}

.mg-accessory-designation {
    font-size: 12px;
    color: var(--navy);
    opacity: .7;
}

.mg-accessories-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding-top: 15px;
}

.mg-accessories-actions .btn-primary-cta {
    margin: 0;
}

.mg-accessories-actions a.btn {
    font-size: 14px;
    padding: 8px 14px;
    white-space: nowrap;
}

.mg-accessories-actions a.btn img {
    width: 16px;
    height: 16px;
}

.mg-accessories-skip {
    min-width: auto;
}

.mg-accessories-validate {
    min-width: auto;
}



/* Styles mobile ici */
@media screen and (max-width: 768px) {
    #mg-accessories-modal h5 {
        font-size: 16px;
    }
}
