/* ==========================================
   STORE PAGE STYLES
   ========================================== */

/* Store Page Container */
#store-page {
  display: none;
  background: linear-gradient(180.18deg, #C400FF 0.15%, #000599 99.85%);
  color: #FFFFFF;
  font-family: 'Roboto', sans-serif;
}

#store-page.active {
  display: flex;
}

.store-content {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 18px 56px;
  display: flex;
  flex-direction: column; /* Зменшено відступ між секціями */
  gap: 8px;
  overflow-y: auto;
  overflow-x: hidden;
}

.store-header {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.store-title {
  margin: 0;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.4px;
}

.store-username {
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

.store-subtitle {
  margin: 10px 0 0;
  font-size: 14px;
  line-height: 1.6;
  max-width: 320px;
  color: rgba(255, 255, 255, 0.78);
}

.store-featured-list {
  display: flex; /* Зменшено відступ між featured картками */
  flex-direction: column;
  gap: 0px;
}

.booster-card {
  background: transparent;
  /* Прибрано рамку */
  /* Прибрано заокруглення */
  /* Прибрано тінь */
  color: #FFFFFF;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.booster-card:hover {
  transform: translateY(-3px);
  /* Тінь при наведенні також прибрана, щоб не було несподіваних ефектів */
}

.booster-card--featured {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 20px;
}

.booster-card--compact {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 14px 16px;
  gap: 10px;
}

.booster-media {
  flex: 0 0 96px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.booster-illustration {
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}

.booster-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.booster-icon-wrapper {
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.booster-icon {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.35));
}

.booster-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.booster-name {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(4, 0, 61, 0.65);
  font-style: italic;
}

.booster-card--featured .booster-name {
  font-size: 20px;
  color: #FFFFFF;
  font-style: italic;
}

.booster-description {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

.booster-card--featured .booster-description {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.84);
}

.booster-buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  padding: 4px 18px;
  border: none;
  border-radius: 999px;
  font-size: 14px; /* Зменшено розмір тексту на кнопках Buy */
  font-weight: 600;
  color: #FFFFFF;
  background: linear-gradient(90deg, #FFE864 0%, #22E175 100%);
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
  min-width: 130px;
}

.booster-card--featured .booster-buy-btn {
  align-self: flex-start;
  height: 30px; 
  box-sizing: border-box;
}

.booster-buy-btn .btn-price {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.booster-buy-btn .star-icon {
  font-size: 18px;
}

.booster-buy-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.booster-buy-btn:active {
  transform: scale(0.97);
}

.booster-buy-btn.disabled,
.booster-buy-btn.purchased {
  background: linear-gradient(90deg, rgba(255, 187, 0, 0.4) 0%, rgba(0, 255, 4, 0.4) 100%);
  color: #FFFFFF;
  cursor: not-allowed;
  filter: none;
}

/* Приховуємо ціну тільки для купленого "Bigger Battery" */
.booster-buy-btn[data-item-code="energy_bank"].purchased .btn-price {
  display: none;
}

.booster-buy-btn.disabled:hover,
.booster-buy-btn.purchased:hover {
  transform: none;
}

.booster-buy-btn.processing {
  background: linear-gradient(135deg, #666 0%, #888 100%);
  cursor: wait;
  opacity: 0.7;
}

.booster-buy-btn.warning {
  background: linear-gradient(135deg, #FF9500 0%, #FF6B00 100%);
}

.booster-buy-btn.warning:hover {
  background: linear-gradient(135deg, #FFA520 0%, #FF7B10 100%);
}

.store-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 16px 28px;
}

.store-footer-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  max-width: 55%;
  text-align: center;
}

.store-footer-heading {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #FFFFFF;
}

.store-footer-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.9);
}

.store-footer-illustration {
  flex: 0 0 180px;
  height: 220px;
  background-image: url('/assets/icons/boosters/avatar_big_store.png');
  background-repeat: no-repeat;
  background-position: bottom right;
  background-size: contain;
  margin-bottom: -80px;
}


.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

/* ========================================== 
   МОБІЛЬНІ ПРИСТРОЇ (iPhone, Android)
   ========================================== */

/* Для екранів 480px і менше (включає iPhone 16 Pro Max: 430px) */
@media screen and (max-width: 480px) {
  
  /* КРИТИЧНО: Завжди рівно 3 колонки */
  .store-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  
  /* Зменшуємо padding контейнера для більше місця */
  .store-content {
    padding: 20px 10px 36px !important;
  }
  
  /* Компактні картки бустерів */
  .booster-card--compact {
    padding: 14px 10px 12px !important;
    gap: 8px !important;
    min-width: 0 !important;
  }
  
  /* Зменшуємо іконки */
  .booster-icon-wrapper {
    width: 56px !important;
    height: 56px !important;
  }
  
  .booster-icon {
    max-width: 100% !important;
    max-height: 100% !important;
  }
  
  /* Компактні назви */
  .booster-card--compact .booster-name {
    font-size: 13px !important;
    line-height: 1.2 !important;
    margin: 0 !important;
  }
  
  /* Компактний опис */
  .booster-card--compact .booster-description {
    font-size: 10px !important;
    line-height: 1.3 !important;
    margin: 0 !important;
  }
  
  /* Компактна кнопка */
  .booster-card--compact .booster-buy-btn {
    padding: 6px 10px !important;
    font-size: 12px !important;
    min-width: auto !important;
    width: 100% !important; /* Зафіксувати ширину кнопки по ширині картки */
    gap: 4px !important;
    margin-top: 4px !important;
  }
  
  .booster-card--compact .booster-buy-btn .star-icon {
    font-size: 13px !important;
  }
  
  .booster-card--compact .booster-buy-btn .price-value {
    font-size: 12px !important;
  }
}

/* ========================================== 
   iPhone 16 Pro Max і подібні (430px)
   ========================================== */
@media screen and (max-width: 430px) {
  .store-grid {
    gap: 8px !important;
  }
  
  .store-content {
    padding: 22px 8px 48px !important;
  }
  
  .booster-card--compact {
    padding: 12px 8px 10px !important;
  }
  
  .booster-icon-wrapper {
    width: 52px !important;
    height: 52px !important;
  }
}

/* ========================================== 
   iPhone 16 Pro, 16, 15 Pro (393px)
   ========================================== */
@media screen and (max-width: 393px) {
  .store-grid {
    gap: 6px !important;
  }
  
  .store-content {
    padding: 22px 6px 48px !important;
  }
  
  .booster-card--compact {
    padding: 10px 6px 8px !important;
  }
  
  .booster-icon-wrapper {
    width: 48px !important;
    height: 48px !important;
  }
  
  .booster-card--compact .booster-name {
    font-size: 12px !important;
  }
  
  .booster-card--compact .booster-description {
    font-size: 9px !important;
  }
  
  .booster-card--compact .booster-buy-btn {
    padding: 5px 8px !important;
    font-size: 11px !important;
  }
}

/* ========================================== 
   ДУЖЕ МАЛІ ЕКРАНИ (iPhone SE: 375px)
   ========================================== */
@media screen and (max-width: 375px) {
  .store-grid {
    gap: 5px !important;
  }
  
  .store-content {
    padding: 20px 5px 44px !important;
  }
  
  .booster-icon-wrapper {
    width: 44px !important;
    height: 44px !important;
  }
}

/* ========================================== 
   ЕКСТРЕМАЛЬНО МАЛІ (старі Android: 360px)
   ========================================== */
@media screen and (max-width: 360px) {
  .store-grid {
    gap: 4px !important;
  }
  
  .store-content {
    padding: 18px 4px 40px !important;
  }
  
  .booster-card--compact {
    padding: 8px 4px 6px !important;
  }
  
  .booster-icon-wrapper {
    width: 40px !important;
    height: 40px !important;
  }
  
  .booster-card--compact .booster-name {
    font-size: 11px !important;
  }
  
  .booster-card--compact .booster-description {
    font-size: 8px !important;
  }
  
  .booster-card--compact .booster-buy-btn {
    padding: 4px 6px !important;
    font-size: 10px !important;
  }
  
  .booster-card--compact .booster-buy-btn .star-icon {
    font-size: 11px !important;
  }
}

/* ========================================== 
   FEATURED БУСТЕРИ (Energy Bank, Energy Boost)
   Залишаються без змін
   ========================================== */
@media screen and (max-width: 420px) {
  .booster-card--featured {
    gap: 14px;
    padding: 18px 16px;
  }

  .booster-illustration {
    width: 76px;
    height: 76px;
  }
}

  
  /* ==========================================
     STORE POPUP STYLES
     ========================================== */
  
  .store-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    padding-bottom: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .store-popup-overlay.showing {
    opacity: 1;
  }
  
  .store-popup-overlay.hiding {
    opacity: 0;
  }
  
  /* Popup Container */
  .store-popup-container {
    position: relative;
    width: 388px;
    height: 483px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
  
  .store-popup-overlay.showing .store-popup-container {
    transform: translateY(0);
  }
  
  .store-popup-overlay.hiding .store-popup-container {
    transform: translateY(100%);
  }
  
  /* Popup Background Image */
  .popup-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
  }
  
  /* Popup Content */
  .popup-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 30px;
    box-sizing: border-box;
  }
  /* НОВИЙ: Контейнер для текстового контенту */
  .popup-text-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 285px;
  }
  /* НОВИЙ: Wrapper для опису з фіксованою висотою */
.popup-description-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px; /* 3 рядки: 20px * 3 */
  width: 100%;
  margin-bottom: 22px;
}
  /* Popup Icon */
  .popup-icon-wrapper {
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    margin-top: 30px;
  }
  
  .popup-booster-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
  }
  
  /* Popup Booster Name */
  .popup-booster-name {
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: 28px;
    line-height: 32px;
    text-align: center;
    color: #FCFF67;
    text-shadow: 0px 1px 4px rgba(0, 0, 0, 0.25);
    margin: 0 0 12px 0;
    max-width: 285px;
  }
  
  /* Popup Description */
  .popup-booster-description {
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    font-weight: 500;
    font-size: 16px;
    line-height: 20px;
    text-align: center;
    color: #FFFFFF;
    text-shadow: 0px 1px 4px rgba(0, 0, 0, 0.25);
    margin: 0; /* ⭐ Видалили margin-bottom, бо він тепер в wrapper */
    max-width: 285px;
  }
  
  /* Popup Buy Button */
  .popup-buy-button {
    width: 280px;
    height: 66px;
    background-image: url('/assets/icons/boosters/PopUp_batton.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Roboto', sans-serif;
    font-weight: 600;
    font-size: 18px;
    line-height: 1.3;
    color: #FCFF67;
    text-shadow: 0px 1px 4px rgba(0, 0, 0, 0.25);
    transition: all 0.2s ease;
    margin-bottom: 20px;
    padding: 0 24px;
    background-color: transparent;
  box-sizing: border-box;
  }
  
  .popup-buy-button:hover {
    transform: scale(1.05);
    filter: brightness(1.1);
  }
  
  .popup-buy-button:active {
    transform: scale(0.98);
  }
  
  .popup-buy-button .popup-btn-price {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 18px;
  }

  .popup-buy-button .popup-btn-text,
  .popup-buy-button .price-value {
    white-space: nowrap;
  }

  .popup-buy-button .star-icon {
    font-size: 18px;
  }

  .popup-footer {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 14px;
    width: 100%;
    max-width: 285px;
    padding: 0 10px;
    box-sizing: border-box;
  }

  .popup-footer-avatar {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
  }

  .popup-footer-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  /* Popup Footer Text */
  .popup-footer-text {
    font-family: 'Roboto', sans-serif;
    font-style: italic;
    font-weight: 900;
    font-size: 14px;
    line-height: 18px;
    text-align: left;
    color: #0048FF;
    margin: 0;
    flex: 1;
  }
  
  /* ==========================================
     RESPONSIVE DESIGN
     ========================================== */
  
     @media (max-width: 480px) {

      
      .popup-booster-name {
        font-size: 24px;
      }
    
      .popup-booster-description {
        font-size: 16px;
      }
    }

    .popup-booster-description {
      font-size: 16px;
    }
  

  @media (max-height: 600px) {
    .store-content {
      padding: 20px 16px 90px;
    }

    .store-header {
      gap: 4px;
    }
  }
  
  /* ==========================================
     UI BLOCKED STATE (під час покупки)
     ========================================== */
  
  body.ui-blocked {
    pointer-events: none;
    user-select: none;
  }
  
  body.ui-blocked .store-popup-overlay {
    pointer-events: auto;
  }

/* Loading Indicator */
.store-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  z-index: 100;
}

.store-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.store-loading p {
  color: #fff;
  font-size: 14px;
  font-weight: 500;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
