/* ==============================================================
   GAMIFICATION — ITEM PICKER  (prefix gitem_)
   ==============================================================*/

/* ---------- базові елементи ---------- */

#gitem-item-selection::-webkit-scrollbar      { width:6px; }
#gitem-item-selection::-webkit-scrollbar-thumb{ background:#ccc; border-radius:4px; }

.gitem_scroll-wrapper { position:relative; width:150px; max-height:450px; }

#gitem-item-selection{
  display:flex; flex-direction:column; gap:.75rem;
  width:100%; max-height:450px; overflow-y:auto;
  padding-right:4px;
  scrollbar-width:thin; scrollbar-color:#ccc transparent;
}

#gitem-scroll-indicator{
  position:absolute; left:50%; transform:translateX(-50%);
  font-size:30px; color:#888; opacity:.6;
  transition:opacity .3s ease;
  pointer-events:none;
  animation:gitem_bounce 1.5s infinite;
}

#gitem-scroll-indicator,
#gitem-scroll-up {
  cursor: pointer;
}

#gitem-scroll-up {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  font-size: 26px;
  color: #888;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: auto;
  cursor: pointer;
  animation: gitem_bounce_up 1.5s infinite;
  z-index: 2;
}

@keyframes gitem_bounce_up {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%      { transform: translateX(-50%) translateY(-4px); }
}

@keyframes gitem_bounce{
  0%,100%{ transform:translateX(-50%) translateY(0); }
  50%    { transform:translateX(-50%) translateY(4px); }
}

/* ---------- картка айтема ---------- */

.gitem_item-card{
  border:1px solid #d1e3f8; border-radius:12px;
  background:#fff; box-shadow:0 0 6px rgba(0,0,0,.06);
  padding:.5rem; position:relative; text-align:center; font-family:sans-serif;
}
.gitem_item-card.gitem_selected{ border:1px solid #ffe58f; }

.gitem_item-card .gitem_label { font-weight:600; }
.gitem_item-card img          { width:100%; max-width:100px; object-fit:contain; margin-bottom:.5rem; }
.gitem_item-card .gitem_price{
  background:#e9f5ff; color:#007acc; font-weight:600; font-size:.85rem;
  border-radius:10px; padding:.3rem .75rem; margin:0 auto; width:fit-content;
}
.gitem_item-card .gitem_remove{
  position:absolute !important; 
  top:-2px !important; 
  right:0 !important;
  background:none !important; 
  border:none !important; 
  font-size:14px !important; 
  font-weight:bold !important; 
  cursor:pointer !important; 
  color:#444 !important;

}

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

/* ---------- TABLET 768 – 1024 px ---------- */
@media (min-width:768px) and (max-width:1024px){

  .gitem_scroll-wrapper{ 
    width:100%; 
    max-width:100%; 
    max-height:520px; 
    padding-bottom:2.5rem;
  }

  #gitem-item-selection{
    flex-direction:row; gap:1rem;
    overflow-x:auto; overflow-y:hidden;
    max-height:none;
    justify-content:center;
    padding:0 32px;
    scroll-snap-type:x mandatory;
    -webkit-overflow-scrolling:touch;
  }

  .gitem_item-card{
    flex:0 0 calc(33.333% - 1rem);
    max-width:calc(33.333% - 1rem);
    min-width:140px;
    scroll-snap-align:start;
  }

  /* Стрілки вниз */
  .gitem_arrow {
    display:flex;
    align-items:center;
    justify-content:center;
    position:absolute;
    bottom:0.5rem;
    z-index:5;
    width:24px; height:24px;
    font-size:24px; line-height:22px;
    color:#007acc; background:#fff;
    border-radius:50%;
    box-shadow:0 0 4px rgba(0,0,0,.15);
    cursor:pointer;
    user-select:none;
  }
  .gitem_arrow-left  { left:1rem; animation:gitem_bounce_hL 1.5s infinite; }
  .gitem_arrow-right { right:1rem; animation:gitem_bounce_h  1.5s infinite; }

  @keyframes gitem_bounce_h  { 0%,100%{transform:translateX(0);} 50%{transform:translateX(4px);} }
  @keyframes gitem_bounce_hL { 0%,100%{transform:translateX(0);} 50%{transform:translateX(-4px);} }

  #gitem-scroll-indicator { display:none; }

  /* Пагінація */
  #gitem-pagination {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 4;
  }

  .gitem_dot {
    width: 10px;
    height: 10px;
    background-color: #b3d9f9;
    border-radius: 50%;
    transition: background-color 0.3s;
  }

  .gitem_dot.gitem_active {
    background-color: #007acc;
  }
}

/* ---------- MOBILE ≤768 px ---------- */
@media (max-width:768px){

  .gitem_item-card .gitem_label,
  .gitem_item-card .gitem_remove {
    display: none;
  }

  .gitem_scroll-wrapper{ 
    width:100%; 
    max-width:100%; 
    max-height:none; 
    padding-bottom:3.5rem;
    margin-bottom: 1rem;
  }

  #gitem-item-selection{
    flex-direction:row; gap:.75rem;
    overflow-x:auto; overflow-y:hidden;
    max-height:none;
    scroll-snap-type:x mandatory;
    -webkit-overflow-scrolling:touch;
  }

  .gitem_item-card{
    min-width: calc((100% - 2 * 40px) / 3);
    flex: 0 0 calc((100% - 2 * 40px) / 3);
    scroll-snap-align:start;
  }

  .gitem_arrow {
    display:flex;
    align-items:center;
    justify-content:center;
    position:absolute;
    bottom:0.5rem;
    z-index:5;
    width:24px; height:24px;
    font-size:24px; line-height:22px;
    color:#007acc; background:#fff;
    border-radius:50%;
    box-shadow:0 0 4px rgba(0,0,0,.15);
    cursor:pointer;
    user-select:none;
  }
  .gitem_arrow-left  { left:1rem;  animation:gitem_bounce_hL 1.5s infinite; }
  .gitem_arrow-right { right:1rem; animation:gitem_bounce_h  1.5s infinite; }

  #gitem-scroll-indicator{ display:none; }

  /* Пагінація */
  #gitem-pagination {
    position: absolute;
    bottom: 0.8rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 4;
  }

  .gitem_dot {
    width: 10px;
    height: 10px;
    background-color: #b3d9f9;
    border-radius: 50%;
    transition: background-color 0.3s;
  }

  .gitem_dot.gitem_active {
    background-color: #007acc;
  }
}

/* ---------- DESKTOP >1024 px ---------- */
@media (min-width:1025px){

  .gitem_scroll-wrapper   { width:170px; }
  #gitem-scroll-indicator { font-size:26px; animation:gitem_bounce 1.8s infinite; }

  .gitem_arrow{ display:none; }

  .gitem_item-card {
    padding: 0.4rem;
    font-size: 0.9rem;
    max-width: 160px;
  }

  .gitem_item-card img {
    max-width: 80px;
    margin-bottom: 0.4rem;
  }

  .gitem_item-card .gitem_price {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
  }

  #gitem-pagination { display: none !important; }
}

