/* Pallet Frame - consistent across all contexts */
.pallet-frame-outer {
  width: 340px;
  aspect-ratio: var(--pallet-aspect, 1.5);
}

.grid-preview .pallet-frame-outer {
  width: 100%;
  max-width: 340px;
}

@media (max-width: 900px) {
  .pallet-frame-outer { width: 280px; }
  .grid-preview .pallet-frame-outer { max-width: 280px; }
}

@media (max-width: 600px) {
  .pallet-frame-outer { width: 240px; }
  .grid-preview .pallet-frame-outer { max-width: 240px; }
}

.pallet-frame {
  width: 100%;
  height: 100%;
  background: #F5F0E8;
  border: 6px solid #8B6914;
  border-radius: 8px;
  padding: 8px;
  box-shadow: inset 0 0 0 2px #C4A882, 0 2px 8px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
}

.grid-preview .pallet-frame {
  border-width: 4px;
  padding: 6px;
}

.planting-grid {
  width: 100%;
  height: 100%;
  display: grid;
  gap: 2px;
  user-select: none;
}

/* Cells fill their grid slots */
.grid-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #C4A882;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 500;
  transition: all 0.15s;
}

.grid-cell:hover {
  border-color: var(--color-primary);
  transform: scale(1.05);
}

.cell-label {
  pointer-events: none;
}

.cell-empty {
  background: var(--cell-bg, #A0845C);
  color: #3E2723;
}

.cell-selected {
  background: var(--color-primary);
  color: white;
  border: 2px dashed white;
  box-shadow: 0 0 0 1px var(--color-primary-dark);
}

.cell-dragging {
  background: #6B9E7A;
  border: 2px solid var(--color-primary);
  opacity: 0.8;
}

/* Dimension Labels - outside the frame */
.pallet-dimensions {
  position: relative;
  width: 340px;
  height: 28px;
  margin-top: 4px;
}

@media (max-width: 900px) {
  .pallet-dimensions { width: 280px; }
}

@media (max-width: 600px) {
  .pallet-dimensions { width: 240px; }
}

.dim-label {
  position: absolute;
  font-size: 0.75rem;
  font-weight: 600;
  color: #3E2723;
  white-space: nowrap;
}

.dim-length {
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
}

.dim-width {
  right: -4px;
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: left center;
}

/* Grid Preview Container */
.grid-preview {
  background: var(--color-surface);
  padding: var(--spacing-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-width: 420px;
}

/* Mini Grid - for card previews */
.mini-grid .pallet-frame-outer {
  width: 100%;
  max-width: 120px;
}

.mini-grid .pallet-frame {
  border-width: 3px;
  padding: 4px;
}

.mini-grid .planting-grid {
  gap: 1px;
}

.mini-grid .grid-cell {
  font-size: 0;
  cursor: default;
  border-width: 1px;
}

.mini-grid .grid-cell:hover {
  transform: none;
  border-color: #C4A882;
}

.mini-grid .cell-label {
  display: none;
}

.mini-grid .pallet-dimensions {
  display: none;
}

/* Mini grid inside data table cells */
.data-table .mini-grid .pallet-frame-outer {
  max-width: 100px;
}

.data-table .mini-grid {
  display: flex;
  justify-content: center;
}
