/* =============================================================
   SHOP V2 — Classes s2- isolees, zero conflit
   ============================================================= */

/* ==================== OVERLAY ==================== */
.s2-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.s2-overlay.active {
  display: flex;
}

/* ==================== MODAL ==================== */
.s2-modal {
  background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.9), 0 0 0 1px rgba(255,255,255,0.05);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  color: white;
  overflow: hidden;
}

/* ==================== HEADER ==================== */
.s2-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(0,0,0,0.9), rgba(20,20,30,0.95));
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 15px;
}
.s2-header-left {
  flex: 1;
  min-width: 0;
}
.s2-title {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.s2-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.6;
}
.s2-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.s2-balance {
  background: rgba(0,0,0,0.3);
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 16px;
  border: 1px solid rgba(255,215,0,0.3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.s2-balance-icon {
  font-size: 18px;
  filter: drop-shadow(0 0 4px rgba(255,215,0,0.6));
}
.s2-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: white;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.s2-close:hover {
  background: rgba(255,59,48,0.3);
  transform: rotate(90deg);
}

/* ==================== TABS ==================== */
.s2-tabs {
  display: flex;
  background: rgba(0,0,0,0.2);
  border-bottom: 2px solid rgba(255,255,255,0.05);
  flex-shrink: 0;
}
.s2-tab {
  flex: 1;
  padding: 14px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: rgba(255,255,255,0.5);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.s2-tab:hover {
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.8);
}
.s2-tab.active {
  color: #667eea;
  border-bottom-color: #667eea;
  background: rgba(102,126,234,0.1);
}

/* ==================== BODY (scrollable) ==================== */
.s2-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
}
.s2-body::-webkit-scrollbar { width: 10px; }
.s2-body::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
.s2-body::-webkit-scrollbar-thumb { background: rgba(102,126,234,0.5); border-radius: 5px; }
.s2-body::-webkit-scrollbar-thumb:hover { background: rgba(102,126,234,0.7); }

/* ==================== PANES ==================== */
.s2-pane {
  display: none;
}
.s2-pane.active {
  display: block;
}

/* ==================== FILTERS ==================== */
.s2-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 20px;
  background: rgba(0,0,0,0.2);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.s2-filter {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.s2-filter:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(102,126,234,0.5);
  color: white;
}
.s2-filter.active {
  background: rgba(102,126,234,0.3);
  border-color: #667eea;
  color: white;
  box-shadow: 0 0 12px rgba(102,126,234,0.3);
}

/* ==================== ITEMS GRID ==================== */
.s2-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 72px);
  gap: 12px;
  justify-content: center;
  padding: 20px;
}

/* ==================== SLOT ==================== */
.s2-slot {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, rgba(0,0,0,0.4), rgba(0,0,0,0.6));
  border: 2px solid rgba(139,139,139,0.5);
  border-radius: 8px;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4), inset 2px 0 3px rgba(255,255,255,0.05);
}
.s2-slot:hover {
  border-color: rgba(102,126,234,0.9);
  transform: translateY(-3px);
  box-shadow: 0 5px 20px rgba(102,126,234,0.4), inset 0 -3px 6px rgba(0,0,0,0.4);
}
.s2-slot.cant-afford {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.8);
}
.s2-slot.cant-afford:hover {
  transform: none;
  border-color: rgba(139,139,139,0.5);
  box-shadow: inset 0 -3px 6px rgba(0,0,0,0.4);
}
.s2-slot-img {
  max-width: 48px;
  max-height: 48px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}
.s2-slot-price {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  background: rgba(0,0,0,0.8);
  color: #FFD700;
  font-size: 11px;
  font-weight: bold;
  padding: 1px 4px;
  border-radius: 0 0 6px 6px;
  pointer-events: none;
}

/* ==================== TOOLTIP ==================== */
.s2-tooltip {
  position: fixed;
  z-index: 999999999;
  background: rgba(10,0,20,0.98);
  border: 2px solid rgba(102,126,234,0.9);
  border-radius: 8px;
  padding: 14px 16px;
  min-width: 200px;
  max-width: 300px;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
  box-shadow: 0 8px 24px rgba(0,0,0,0.9), 0 0 20px rgba(102,126,234,0.3);
  color: white;
}
.s2-tooltip.show {
  opacity: 1;
  visibility: visible;
}
.s2-tooltip-img {
  text-align: center;
  margin-bottom: 10px;
  padding: 8px;
  background: rgba(255,255,255,0.05);
  border-radius: 6px;
}
.s2-tooltip-img img {
  max-width: 80px;
  max-height: 80px;
  border-radius: 4px;
}
.s2-tooltip-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}
.s2-tooltip-desc {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
  margin-bottom: 6px;
}
.s2-tooltip-price {
  font-size: 14px;
  font-weight: 700;
  color: #FFD700;
}

/* ==================== PAGINATION ==================== */
.s2-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.s2-page-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: rgba(255,255,255,0.7);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 36px;
  text-align: center;
}
.s2-page-btn:hover:not(:disabled) {
  background: rgba(102,126,234,0.2);
  border-color: rgba(102,126,234,0.5);
  color: white;
}
.s2-page-btn.active {
  background: rgba(102,126,234,0.4);
  border-color: #667eea;
  color: white;
  font-weight: 700;
}
.s2-page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.s2-page-info {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  margin: 0 8px;
}

/* ==================== EMPTY ==================== */
.s2-empty {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255,255,255,0.4);
  font-size: 15px;
}
.s2-empty-icon {
  font-size: 48px;
  margin-bottom: 15px;
  opacity: 0.3;
}

/* ==================== QUANTITY MODAL ==================== */
.quantity-modal {
  max-width: 500px;
  width: 90%;
}
.quantity-selection { padding: 20px; }
.item-preview {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 25px;
  padding: 15px;
  background: rgba(60,60,80,0.8);
  border-radius: 12px;
  border: 2px solid rgba(100,150,255,0.2);
}
.item-preview-image {
  width: 64px; height: 64px;
  background: rgba(80,80,100,0.8);
  border-radius: 8px;
  border: 1px solid rgba(100,150,255,0.3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.item-preview-image img { width: 48px; height: 48px; image-rendering: crisp-edges; }
.item-preview-info h3 { margin: 0 0 5px; font-size: 18px; font-weight: 600; color: white; }
.item-preview-info p { margin: 0 0 8px; font-size: 14px; color: rgba(255,255,255,0.7); }
.item-preview-price { font-size: 16px; font-weight: 600; color: #4CAF50; }
.quantity-controls { margin-bottom: 25px; }
.quantity-label { display: block; font-size: 16px; font-weight: 600; color: white; margin-bottom: 12px; }
.quantity-input-group { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.quantity-btn {
  width: 40px; height: 40px;
  border: 2px solid rgba(100,150,255,0.3);
  background: rgba(60,60,80,0.8);
  color: white;
  border-radius: 8px;
  font-size: 18px; font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex; align-items: center; justify-content: center;
}
.quantity-btn:hover { border-color: rgba(100,150,255,0.6); background: rgba(80,80,100,0.9); }
#quantityInput {
  width: 80px; height: 40px;
  border: 2px solid rgba(100,150,255,0.3);
  background: rgba(60,60,80,0.8);
  color: white;
  border-radius: 8px;
  font-size: 16px; font-weight: 600;
  text-align: center; outline: none;
}
#quantityInput:focus { border-color: rgba(100,150,255,0.6); background: rgba(80,80,100,0.9); }
.quantity-shortcuts { display: flex; gap: 8px; flex-wrap: wrap; }
.quantity-shortcut {
  padding: 8px 16px;
  border: 2px solid rgba(100,150,255,0.2);
  background: rgba(40,40,50,0.8);
  color: white; border-radius: 6px;
  font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.quantity-shortcut:hover { border-color: rgba(100,150,255,0.5); background: rgba(60,60,80,0.9); }
.quantity-summary {
  margin-bottom: 25px; padding: 15px;
  background: rgba(40,40,50,0.8);
  border-radius: 12px;
  border: 2px solid rgba(100,150,255,0.2);
}
.quantity-total-price, .quantity-balance { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.quantity-balance { margin-bottom: 0; }
.price-label, .balance-label { font-size: 14px; color: rgba(255,255,255,0.7); }
.total-price { font-size: 18px; font-weight: 700; color: #4CAF50; }
.balance-amount.insufficient { color: #F44336; }
.quantity-actions { display: flex; gap: 15px; justify-content: center; }
.cancel-btn, .confirm-purchase-btn {
  padding: 12px 24px; border: none; border-radius: 8px;
  font-size: 16px; font-weight: 600; cursor: pointer; transition: all 0.2s; flex: 1;
}
.cancel-btn { background: rgba(80,80,100,0.8); color: white; border: 2px solid rgba(100,150,255,0.3); }
.cancel-btn:hover { background: rgba(100,100,120,0.9); border-color: rgba(100,150,255,0.5); }
.confirm-purchase-btn { background: linear-gradient(135deg, #4CAF50, #45a049); color: white; border: 2px solid #4CAF50; }
.confirm-purchase-btn:hover:not(:disabled) { background: linear-gradient(135deg, #45a049, #3d8b40); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(76,175,80,0.3); }
.confirm-purchase-btn:disabled { background: rgba(80,80,100,0.8); color: rgba(255,255,255,0.5); border-color: rgba(100,150,255,0.2); cursor: not-allowed; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .s2-modal { max-width: 95%; max-height: 95vh; }
  .s2-header { flex-direction: column; gap: 10px; text-align: center; }
  .s2-grid { grid-template-columns: repeat(auto-fill, 64px); gap: 10px; padding: 15px; }
  .s2-slot { width: 64px; height: 64px; }
  .s2-slot-img { max-width: 42px; max-height: 42px; }
  .s2-filter { padding: 5px 8px; font-size: 11px; }
}
