/* VR5 interaction and compact modal polish — 2026-07-13 */

:root {
  --motion-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-press: cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* More tactile, app-like button feedback without adding heavy animation. */
button[data-action] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  will-change: transform;
  transition:
    transform 150ms var(--motion-press),
    background-color 180ms var(--motion-press),
    border-color 180ms var(--motion-press),
    box-shadow 180ms var(--motion-press),
    color 180ms var(--motion-press),
    filter 180ms var(--motion-press),
    opacity 180ms var(--motion-press);
}

button[data-action]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.18), transparent 68%);
  opacity: 0;
  transform: scale(0.72);
  transition:
    opacity 220ms ease,
    transform 260ms var(--motion-spring);
}

button[data-action]:not(:disabled):active {
  transform: translateY(1px) scale(0.97);
  filter: brightness(1.08);
}

button[data-action]:not(:disabled):active::after {
  opacity: 0.7;
  transform: scale(1.18);
  transition-duration: 40ms;
}

.modal-backdrop {
  background: rgba(1, 4, 12, 0.72);
  background-image: none;
  backdrop-filter: blur(10px) saturate(0.82);
  -webkit-backdrop-filter: blur(10px) saturate(0.82);
  animation: vr5BackdropIn 220ms ease-out both;
}

/* Compact, grouped iOS-style editor instead of stacked oversized cards. */
.trade-edit-panel {
  width: min(calc(100vw - 28px), 430px);
  min-width: 0;
  max-height: min(76svh, 540px);
  padding: 12px 12px 14px;
  overflow: hidden;
  border: 1px solid rgba(143, 151, 255, 0.18);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(17, 24, 43, 0.985), rgba(10, 15, 29, 0.992));
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.56),
    0 1px 0 rgba(255, 255, 255, 0.055) inset,
    0 0 0 1px rgba(92, 79, 210, 0.035) inset;
  animation: vr5TradePanelIn 280ms var(--motion-spring) both;
}

.trade-edit-panel .modal-titlebar {
  height: 42px;
  grid-template-columns: 66px minmax(0, 1fr) 66px;
  padding: 0 2px;
}

.trade-edit-panel .modal-titlebar h2 {
  overflow: hidden;
  color: #f6f8ff;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 17px;
  line-height: 1.15;
  font-weight: 760;
  letter-spacing: -0.018em;
}

.trade-edit-panel .modal-titlebar button {
  min-height: 36px;
  padding: 0 8px;
  border-radius: 10px;
  background: transparent;
  color: #8e98ff;
  font-size: 14px;
  font-weight: 720;
}

.trade-edit-panel .modal-titlebar button:first-child {
  text-align: left;
}

.trade-edit-panel .modal-titlebar button:last-child {
  text-align: right;
  color: #a7afff;
}

.trade-edit-panel .modal-stack {
  gap: 10px;
  padding-top: 7px;
}

.trade-edit-panel .form-card {
  gap: 0;
  padding: 4px 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 16px;
  background: rgba(30, 40, 59, 0.66);
  background-image: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.025) inset,
    0 12px 28px rgba(0, 0, 0, 0.14);
}

.trade-edit-panel .form-card > * + * {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.trade-edit-panel .modal-row {
  min-height: 54px;
  grid-template-columns: minmax(112px, 1fr) minmax(120px, 0.92fr);
  gap: 10px;
  padding: 0 4px;
  border-radius: 0;
  background: transparent;
  background-image: none;
  transition:
    background-color 180ms var(--motion-press),
    box-shadow 180ms var(--motion-press),
    transform 180ms var(--motion-press);
  animation: vr5TradeRowIn 300ms var(--motion-spring) both;
}

.trade-edit-panel .modal-row:nth-child(2) {
  animation-delay: 35ms;
}

.trade-edit-panel .modal-row:nth-child(3) {
  animation-delay: 70ms;
}

.trade-edit-panel .modal-row:focus-within {
  margin-inline: -8px;
  padding-inline: 12px;
  border-radius: 12px;
  background: rgba(112, 102, 232, 0.105);
  background-image: none;
  box-shadow:
    inset 0 0 0 1px rgba(133, 124, 255, 0.22),
    0 0 0 3px rgba(109, 99, 232, 0.045);
}

.trade-edit-panel .modal-row span {
  color: #8f99ae;
  font-size: 13px;
  font-weight: 680;
  letter-spacing: -0.01em;
}

.trade-edit-panel .modal-row input {
  min-height: 32px;
  color: #f4f6ff;
  font-size: 16px;
  line-height: 1;
  font-weight: 720;
  letter-spacing: -0.012em;
}

.trade-edit-panel .unit-input {
  gap: 4px;
}

.trade-edit-panel .unit-input.quantity {
  max-width: 160px;
  grid-template-columns: minmax(62px, 1fr) min-content;
}

.trade-edit-panel .unit-input.quantity input {
  min-width: 62px;
  padding-right: 3px;
}

.trade-edit-panel .unit-input.money {
  grid-template-columns: min-content minmax(66px, 1fr);
}

.trade-edit-panel .unit-input b {
  color: #8893a8;
  font-size: 13px;
  font-weight: 680;
}

.trade-edit-panel input[type="date"] {
  color-scheme: dark;
  font-size: 15px;
}

.trade-edit-panel .delete-vr {
  min-height: 46px;
  justify-content: center;
  border: 1px solid rgba(255, 99, 121, 0.1);
  border-radius: 14px;
  background: rgba(255, 99, 121, 0.045);
  background-image: none;
  color: #ff6c82;
  font-size: 14px;
  font-weight: 720;
  box-shadow: none;
  animation: vr5TradeRowIn 300ms var(--motion-spring) 95ms both;
}

.trade-edit-panel .delete-vr:active {
  background: rgba(255, 99, 121, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 99, 121, 0.08);
}

@keyframes vr5BackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes vr5TradePanelIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 18px)) scale(0.96);
    filter: blur(5px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
  }
}

@keyframes vr5TradeRowIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 560px) {
  .trade-edit-panel {
    width: calc(100vw - 24px);
    max-height: min(74svh, 510px);
    padding: 10px 10px 12px;
    border-radius: 22px;
  }

  .trade-edit-panel .modal-titlebar {
    grid-template-columns: 62px minmax(0, 1fr) 62px;
  }

  .trade-edit-panel .modal-titlebar h2 {
    font-size: 16px;
  }

  .trade-edit-panel .modal-row {
    min-height: 52px;
    grid-template-columns: minmax(100px, 1fr) minmax(112px, 0.9fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  button[data-action],
  button[data-action]::after,
  .modal-backdrop,
  .trade-edit-panel,
  .trade-edit-panel .modal-row,
  .trade-edit-panel .delete-vr {
    animation: none !important;
    transition-duration: 1ms !important;
  }
}
