/* Storage — Profile > Storage (Locker / Garage / Entities) */

#profile-storage .card {
  background: linear-gradient(180deg, rgba(7, 18, 27, 0.94), rgba(5, 14, 22, 0.98));
  border: 1px solid rgba(56, 88, 109, 0.58);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

#profile-storage .card * {
  background-color: transparent;
}

#profile-storage .storage-section {
  background: transparent;
  border-radius: 12px;
  position: relative;
  padding-top: 0;
}

#profile-storage .storage-card {
  position: relative;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

#profile-storage .storage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

#profile-storage .storage-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: #dce8f2;
  letter-spacing: 0.3px;
}

#profile-storage .storage-actions-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.storage-notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(47, 51, 54, 0.9);
  color: #71767b;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.storage-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 10px 0 16px;
}

.storage-btn {
  padding: 10px 12px;
  border: 1px solid #173447;
  border-radius: 10px;
  background: #0b1924;
  color: #d4e2ef;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.storage-btn:hover {
  border-color: #3c6480;
  color: #f3f8fc;
}

.storage-btn.active {
  background: #122434;
  border-color: #3c6480;
  color: #f3f8fc;
}

.storage-section { display: none; }
.storage-section.active { display: block; }

#profile-storage .stat-item {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  background: linear-gradient(180deg, rgba(12, 28, 40, 0.82), rgba(10, 20, 30, 0.94));
  color: #e7e9ea;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-radius: 10px;
  border: 1px solid rgba(48, 77, 96, 0.62);
  box-shadow: none;
  transition: border-color 0.2s ease;
  position: relative;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;
}

#profile-storage .stat-item.dragging {
  touch-action: none;
}

#profile-storage .stat-item:hover {
  border-color: rgba(79, 113, 137, 0.74);
  transform: none;
}

#profile-storage .stat-item .quantity {
  grid-column: 1;
  font-weight: bold;
  color: #1d9bf0;
  margin: 0 8px;
  justify-self: start;
}

#profile-storage .stat-item .name {
  grid-column: 2;
  color: #e7e9ea;
  text-shadow: none;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  text-align: center;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#profile-storage .storage-actions {
  grid-column: 3;
  justify-self: end;
  display: flex;
  gap: 8px;
  align-items: center;
}

#profile-storage .storage-actions .delete-btn {
  grid-column: auto;
  justify-self: auto;
}

#profile-storage .stat-item.selected {
  outline: 2px solid #1d9bf0;
  border-color: #1d9bf0;
}

#profile-storage .stat-item.dragging {
  cursor: grabbing;
  touch-action: none;
}

#profile-storage .stat-item.storage-drag-lift {
  border-color: rgba(29, 155, 240, 0.95) !important;
  background: linear-gradient(165deg, rgba(12, 28, 40, 0.98), rgba(8, 18, 28, 0.98)) !important;
  box-shadow:
    0 0 0 2px rgba(29, 155, 240, 0.4),
    0 22px 52px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(29, 155, 240, 0.16) !important;
  opacity: 0.98 !important;
  transform: scale(1.03) rotate(-0.4deg);
  transition: box-shadow 0.16s ease, transform 0.16s ease;
}

#profile-storage .bank-list.is-reordering,
#profile-storage .garage-list.is-reordering,
#profile-storage .crates-list.is-reordering {
  position: relative;
}

#profile-storage .bank-list.is-reordering::before,
#profile-storage .garage-list.is-reordering::before,
#profile-storage .crates-list.is-reordering::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 12px;
  background: rgba(29, 155, 240, 0.04);
  border: 1px dashed rgba(29, 155, 240, 0.24);
  pointer-events: none;
}

#profile-storage .stat-item.storage-placeholder {
  border: 2px dashed rgba(29, 155, 240, 0.5) !important;
  background: rgba(29, 155, 240, 0.08) !important;
  box-shadow: inset 0 0 0 1px rgba(29, 155, 240, 0.1);
  min-height: 52px;
}

#profile-storage .stat-item.dragging .storage-actions,
#profile-storage .stat-item.dragging .quantity,
#profile-storage .stat-item.dragging .name {
  pointer-events: none;
}

.storage-select-actions {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
  margin-top: 8px;
  justify-content: center;
  pointer-events: none;
}

#profile-storage .stat-item.selected .storage-select-actions {
  display: flex;
  pointer-events: auto;
}

#profile-storage .stat-item:not(.selected) .storage-select-actions,
#profile-storage .stat-item:not(.selected) .storage-move-top-btn,
#profile-storage .stat-item:not(.selected) .storage-split-btn {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  opacity: 0 !important;
}

.storage-move-top-btn,
.storage-split-btn {
  border: none;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.2px;
  white-space: nowrap;
  min-height: 34px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.storage-move-top-btn {
  background: #1d9bf0;
  color: #fff;
}

.storage-move-top-btn:hover {
  background: #1a8cd8;
}

.storage-split-btn {
  background: rgba(29, 155, 240, 0.12);
  color: #dff6ff;
  border: 1px solid rgba(29, 155, 240, 0.4);
}

.storage-split-btn:hover {
  background: rgba(29, 155, 240, 0.22);
}

@media (max-width: 520px) {
  .storage-select-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .storage-move-top-btn,
  .storage-split-btn {
    width: 100%;
  }
}

#profile-storage .delete-btn {
  grid-column: 3;
  background: linear-gradient(135deg, #ff4d4d, #b80000);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  justify-self: end;
}

#profile-storage .delete-btn:hover {
  background: linear-gradient(135deg, #ff6666, #d10000);
}

.bank-list,
.garage-list,
.crates-list {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  touch-action: pan-y;
}

#profile-storage .bank-list.is-reordering,
#profile-storage .garage-list.is-reordering,
#profile-storage .crates-list.is-reordering,
#profile-storage .bank-list.is-press-pending,
#profile-storage .garage-list.is-press-pending,
#profile-storage .crates-list.is-press-pending {
  touch-action: none;
  overflow: hidden !important;
  overscroll-behavior: none;
}

#profile-storage .stat-item.storage-press-pending {
  touch-action: none;
}

html.storage-drag-lock,
body.storage-drag-lock {
  overflow: hidden !important;
  overscroll-behavior: none;
  touch-action: none;
}

.save-btn {
  padding: 8px 12px;
  border-radius: 8px;
  background: #1a2a55;
  border: 1px solid #0d2a36;
  color: #cfe7ff;
  cursor: pointer;
  min-width: 80px;
  text-align: center;
}

#profile-storage .storage-header .save-btn {
  position: static !important;
  top: auto;
  right: auto;
}

.next-claim-badge {
  position: absolute;
  top: -10px;
  left: 12px;
  background: #1d9bf0;
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.4px;
}

#storage-sell-overlay,
#storage-delete-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

#storage-sell-overlay .modal-content,
#storage-delete-overlay .modal-content {
  width: min(560px, 92vw);
  background: linear-gradient(180deg, rgba(10, 14, 18, 0.95), rgba(8, 11, 14, 0.98));
  border: 1px solid rgba(47, 51, 54, 0.9);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

#storage-sell-overlay .modal-header,
#storage-delete-overlay .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #141a1f, #0d1116);
  color: #e7e9ea;
}

#storage-sell-overlay .modal-header h3,
#storage-delete-overlay .modal-header h3 {
  margin: 0;
  font-family: 'Poppins', sans-serif;
  letter-spacing: 0.2px;
}

#storage-sell-overlay .modal-header .close,
#storage-delete-overlay .modal-header .close {
  background: transparent;
  border: none;
  color: #e7e9ea;
  font-size: 22px;
  cursor: pointer;
}

#storage-sell-overlay .modal-body,
#storage-delete-overlay .modal-body {
  padding: 16px;
}

#storage-sell-overlay .storage-sell-copy {
  text-align: center;
  color: #e7e9ea;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  line-height: 1.4;
}

#storage-sell-overlay .storage-sell-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

#storage-sell-overlay .storage-sell-actions .storage-btn,
#storage-sell-overlay .storage-sell-actions .delete-btn {
  flex: 1;
  min-width: 140px;
}

#storage-sell-overlay .storage-sell-actions-single {
  justify-content: center;
}

#storage-sell-overlay .storage-sell-actions-single .storage-btn {
  flex: 0 1 220px;
}

#storage-sell-overlay .storage-sell-balance {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(29, 155, 240, 0.28);
  background: rgba(29, 155, 240, 0.1);
  color: #e7e9ea;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
}

#storage-sell-overlay .storage-sell-balance-icon,
#storage-sell-overlay .storage-sell-inline-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

#storage-sell-overlay .storage-sell-inline-icon {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
}

#storage-sell-overlay .storage-sell-sub {
  margin-top: 8px;
  opacity: 0.9;
}

@keyframes storageSellPop {
  0% { transform: scale(0.98); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

#storage-sell-overlay .storage-sell-pop,
#storage-delete-overlay .storage-delete-pop {
  animation: storageSellPop 140ms ease-out;
}

#storage-delete-overlay .storage-delete-copy {
  text-align: center;
  color: #e7e9ea;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

#storage-delete-overlay .storage-delete-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

#storage-delete-overlay .storage-delete-actions .storage-btn,
#storage-delete-overlay .storage-delete-actions .delete-btn {
  flex: 1;
  min-width: 140px;
  min-height: 44px;
}

@media (max-width: 720px) {
  #profile-storage .bank-list,
  #profile-storage .garage-list,
  #profile-storage .crates-list {
    max-height: min(58vh, calc(100dvh - 280px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-bottom: 8px;
  }

  #storage-sell-overlay,
  #storage-delete-overlay {
    align-items: center;
    justify-content: center;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  #storage-sell-overlay .modal-content,
  #storage-delete-overlay .modal-content {
    width: 100%;
    max-height: min(88dvh, calc(100dvh - 20px));
    border-radius: 16px;
    align-self: center;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #storage-sell-overlay .modal-body,
  #storage-delete-overlay .modal-body {
    flex: 1 1 auto;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  #storage-sell-overlay .storage-sell-actions,
  #storage-delete-overlay .storage-delete-actions {
    justify-content: stretch;
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 12px;
  }

  #storage-sell-overlay .storage-sell-actions .storage-btn,
  #storage-sell-overlay .storage-sell-actions .delete-btn,
  #storage-delete-overlay .storage-delete-actions .storage-btn,
  #storage-delete-overlay .storage-delete-actions .delete-btn {
    min-height: 44px;
  }
}
