.cj-modal{position:fixed;inset:0;display:flex;justify-content:center;align-items:center;z-index:999999999999}
.cj-modal.hide{display:none}
.cj-modal-bg{position:absolute;inset:0;background:#0007}
.cj-modal-box {
    position: relative;
    background: #fff;
    border-radius: 10px;
    /* padding: 2rem; */
    width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.cj-modal-box h2{
    margin-bottom: .4em;
    padding-top: 1rem;
    text-align: center;
    border-top: none;
    font-size: 40px;
}
#patchSearchInput{
    width: 100%;
    padding: 8px 12px;
    border: none !important;
    border-radius: 6px;
    background: #f3f3f3;
}
.cj-patches-wrapper{
    flex: 1;
    overflow-y: auto;
    padding: 0rem 2rem 1rem;
}
.cj-patches-wrapper h3{
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    margin-top: 20px;
    margin-bottom: 10px;
}
.cj-patches-wrapper h3:first-child{
    margin-top: 0px;
}

.cj-patch-slide.active{border-color:#0a3069}


#patchesWrapper div.glide__track{
    overflow: hidden;
    height: 100% !important;
    width: 100% !important;
    background: transparent !important;
    align-items: center;
    border-radius: 0;
}




/* --- Flechas --- */
.glide__arrow {
    background: none;
    border: 0;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    background: #ffffff !important;
    color: #002041 !important;
    padding: 0 !important;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0px 0px 10px #b5b5b5;
}
.glide__arrow.glide__arrow--left{
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
}

.glide__arrow.glide__arrow--right{
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
}

/* --- Footer --- */
.cj-modal-footer         { display:flex; justify-content:space-between; align-items:center; padding-top:12px; border-top:1px solid #eee; }
.cj-selected-list        { display:flex; gap:6px; align-items:center; }


#patchesWrapper .glide__slide {
    flex: 0 0 107.4px !important;
    width: 107.4px !important;
    box-sizing: border-box;
    padding: 0 !important;
    display: flex;
    justify-content: center;
    align-items: center;
}


.cj-patch-slide {
    padding: 0px;
    flex: 0 0 auto;
    margin: 0 !important;
}
.cj-patch-slide:first-child{
    padding-left: 0 !important;
}
.cj-patch-btn{
    background: #dbdbdb3b !important;
    width: 100px;
    height: 100px;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    box-shadow: none;
}
.cj-patch-btn.active{
    background: #0020411a !important;
    border: 1px solid #002041;
}
.cj-patch-slide img {
    max-width: 100px;
    max-height: 80px;
    object-fit: contain;
    display: block;
    filter: drop-shadow(0px 0px 5px #b3b3b3);
}
.cj-patch-flex {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
}
.cj-patch-flex.recomendados{
    border-radius: 15px;
    gap: 7px;
    border: 1px solid #f1f1f1;
    background: #dbdbdb3b;
    padding: 5px;
}
.cj-selected-list img {
    max-width: 40px;
    max-height: 40px;
    margin-right: 4px;
    border-radius: 4px;
    filter: drop-shadow(0 0 2px #b3b3b3);
}
/* Modal footer */
.cj-selected-list {
  display:flex;
  gap: 10px;
  flex-wrap:wrap;
}
.selected-item-modal {
  position:relative;
  display:inline-block;
}
.remove-selected-modal {
  position:absolute;
  top:0; right:0;
  background:#fff; color:#333;
  border-radius:50%;
  width:16px; height:16px;
  line-height:16px;
  text-align:center;
  cursor:pointer;
  font-size:14px;
  box-shadow:0 0 2px rgba(0,0,0,0.2);
}

/* Ficha */
.selected-patches {
  display:flex !important;
  gap:15px !important;
  align-items:center;
  margin-top:8px;
  margin-bottom: 5px;
}
.selected-patch-front {
  position:relative;
  display:inline-block;
}
.selected-patch-front .mini-patch{
    height: auto;
    max-width: 100%;
    max-height: 50px;
}

.remove-selected-front {
  position:absolute;
  top:-6px; right:-6px;
  background:#fff; color:#333;
  border-radius:50%;
  width:16px; height:16px;
  line-height:16px;
  text-align:center;
  cursor:pointer;
  font-size:14px;
  box-shadow:0 0 2px rgba(0,0,0,0.2);
}

.cj-patches-add.disabled,
.cj-patches-add:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}


.patches-surcharge{
    margin: 0 1rem;
    align-self: center;
    font-size: 20px;
    color: #002041;
    font-weight: 700;
}

#patchesModal > div.cj-modal-box > div.cj-modal-footer > div.precioBtn > button{
    padding: 12px 25px;
    font-size: 20px;
    font-weight: 800;
    border-radius: 12px;
}


#searchResults {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding-left: 15px !important;
    margin-top: 10px;
    overflow-y: scroll;
}
#searchResults > li {
  flex: 0 0 calc(20% - 12px);
  box-sizing: border-box;
}


/* Botón cerrar (X roja) */
#patchesModal .cj-close-x{
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    height: 36px;
    padding: 5px !important;
    padding-top: 0 !important;
    border: 0;
    border-radius: 5px;
    background: #fff;
    color: #d32f2f;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    box-shadow: none !important;
    transition: transform .12s 
ease, box-shadow .12s 
ease, background .12s, color .12s;
    z-index: 2;
    display: flex
;
    justify-content: center;
    align-items: center;
}

#patchesModal .cj-close-x:hover{
  transform: scale(1.05);
  box-shadow: 0 3px 12px rgba(0,0,0,.2);
  background: #ffe8e8;
  color: #b71c1c;
}
#patchesModal .cj-close-x:active{
  transform: scale(0.96);
}

/* Asegura que el contenedor del contenido es referencia para posicionar la X */
#patchesModal .cj-modal,
#patchesModal .cj-modal-content{
  position: relative;
}





/* ============================================================
   MOBILE — Modal de parches (≤768px)
   ============================================================ */
@media (max-width: 768px){
  .cj-modal{ align-items: stretch; }
  .cj-modal-box{
    width: 100vw; max-width: none;
    height: 100vh; max-height: none;
    border-radius: 0;
  }
  .cj-modal-header{
    position: sticky; top: 0; z-index: 2;
    background: #fff;
    padding: 14px 16px;
    border-bottom: 1px solid #eee;
  }
  .cj-modal-content{
    height: calc(100vh - 56px - 64px); /* header + footer aprox */
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 12px 90px; /* deja hueco al footer fijo */
  }
  .cj-modal-footer{
    position: sticky; bottom: 0; z-index: 2;
    background: #fff;
    padding: 12px 16px;
    border-top: 1px solid #eee;
  }
  #patchesWrapper .glide__slide{ width: 96px !important; flex: 0 0 96px !important; }
  .cj-patch-slide img{ width: 100%; height: 100%; object-fit: cover; border-radius: 10px; }
  
  .cj-patch-flex{
    gap: 10px;
  }
  .glide__track {
    width: min(600px, 100%) !important;
    aspect-ratio: auto;
    /* aspect-ratio: 1 / 1; */
    /* display: grid
; */
    /* place-items: center; */
    border-radius: 18px;
    background-color: #ededed;
    /* width: 500px !important; */
    /* height: 500px !important; */
    align-items: center;
    display: grid
;
    border-radius: 18px;
}

    .glide__track {
        /* width: 100% !important; */
        /* aspect-ratio: 1 / 1; */
    }
    
    
        .glide__track {
        /* height: auto !important; */
    }
    
    #patchesWrapper div.glide__track {
    /* overflow: hidden; */
    /* height: 100% !important; */
    /* width: 100% !important; */
    /* background: transparent !important; */
    /* align-items: center; */
    /* border-radius: 0; */
}
}
