/* Responsive and mobile variations for spell slots */

/* General mobile breakpoint */
@media (max-width: 768px) {
  .spell-slots {
    display: flex;
    flex-direction: column;
    gap: 6px;
    height: 100%;
    justify-content: space-between;
  }

  /* Hide inline property badges on mobile to save space */
  .spell-slot .spell-slot-properties {
    display: none;
  }

  /* On mobile place the small properties button at the bottom center of the slot */
  .spell-slot-content .slot-props-btn {
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid #4a9eff;
    background: rgba(10,10,15,0.6);
    color: #64c8ff;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    padding: 0;
  }

  /* Adjust tooltip placement so it doesn't overlap bottom button */
  .slot-props-tooltip {
    top: auto;
    bottom: 36px; /* appear above the bottom props button */
    left: 50%;
    transform: translateX(-50%);
  }

  /* Make sure the top corner buttons remain accessible and don't overlap content */
  .spell-slot-content .spell-slot-swap,
  .spell-slot-content .slot-target-selector {
    top: 4px;
  }

  .slot-props-tooltip {
    position: absolute;
    left: -150px;
    top: -2px;
    min-width: 140px;
    max-width: 220px;
    background: linear-gradient(135deg, #0a0a0f 0%, #1a0f2e 100%);
    border: 1px solid #4a9eff;
    padding: 8px;
    box-shadow: 0 6px 16px rgba(10,10,10,0.6);
    display: none;
    z-index: 30;
    font-size: 12px;
  }

  .slot-props-tooltip.active {
    display: block;
  }

  .slot-props-tooltip .property-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: #dfefff;
    margin-bottom: 6px;
  }

  .slot-props-tooltip .property-row:last-child { margin-bottom: 0; }

  #equipped-spells .spell-slot {
    padding-left: 2px;
  }

  #equipped-spells:hover .spell-slot,
  #equipped-spells:active .spell-slot,
  #equipped-spells:focus-within .spell-slot {
    opacity: 1;
  }

  #equipped-spells .spell-slot {
    transition: opacity 160ms ease, transform 160ms ease;
    opacity: 0.95;
  }

  .spell-slot {
    aspect-ratio: 1;
    width: 100%;
    max-width: 100%;
    min-height: auto;
  }

  /* Adjustments for new internal layout on mobile */
  .spell-slot-header {
    padding: 2px 4px;
  }

  .spell-slot-focus-display {
    font-size: 10px;
  }

  .slot-add-focus {
    width: 18px;
    height: 18px;
    line-height: 16px;
    font-size: 12px;
  }

  .spell-slot-footer {
    padding: 2px 4px;
  }

  .spell-slot-footer .spell-slot-name {
    font-size: 9px;
  }

  .spell-slot-content {
    gap: 3px;
    padding: 4px;
  }

  .spell-slot-name {
    font-size: 9px;
  }

  .spell-slot-swap {
    width: 20px;
    height: 20px;
    font-size: 13px;
  }

  .inventory-selector-modal {
    max-width: 90vw;
    max-height: 80vh;
  }
}

/* Small screen adjustments */
@media (max-width: 480px) {
  /* Ensure corner buttons don't overlap: consolidated primary button rules */
  .spell-slot-content button {
    width: 24px;
    height: 24px;
    font-size: 12px;
    border-radius: 6px;
    padding: 0;
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .spell-slot {
    min-height: 50px;
  }

  .spell-slot-wrapper {
    gap: 2px;
  }

  .inventory-selector-modal {
    max-width: 95vw;
    padding: 15px;
  }

  .inventory-spell-item {
    padding: 8px;
    gap: 8px;
  }

  .inventory-spell-color {
    width: 40px;
    height: 40px;
  }

  .inventory-spell-name {
    font-size: 13px;
  }

  .inventory-spell-desc {
    font-size: 11px;
  }

  /* Make empty slot plus button smaller on very small screens */
  .spell-slot-empty-btn {
    font-size: 8px;
  }

  /* compact layout tweaks for equipped-spells on very small screens */
  #equipped-spells { margin: 0; padding: 0; }
  .spell-slots { gap: 1px; }
  .spell-slot-wrapper { height: 25%; }
  .spell-slot { border-left: 0; border-right: 0; }

  /* Target the slot-target-selector to nudge it slightly left on very small screens */
  .spell-slot-content .slot-target-selector {
    left: -4px;
    top: 4px; /* keep pinned to top */
  }

  /* Ensure swap button is pinned to the right edge without overlapping */
  .spell-slot-content .spell-slot-swap {
    right: -2px;
  }

  /* Place the props button at the bottom and center it */
  .spell-slot-content .slot-props-btn {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Additional small adjustments */
@media (max-width: 640px) {
  .spell-slot-content {
    gap: 2px;
    padding: 4px;
  }

  .spell-slot-stats {
    gap: 2px;
    margin-bottom: 3px;
  }

  .spell-slot-stats .stat-item {
    padding: 2px 4px;
    font-size: 9px;
  }

  .prop-badge {
    padding: 2px 4px;
    font-size: 9px;
  }
}