/* Base-10 Blocks Tool Styles */

/* ========== BACK LINK ========== */

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: var(--text-xl);
  color: var(--color-neutral-600);
  background: white;
  border: 2px solid var(--color-neutral-200);
  border-radius: var(--radius-lg);
  text-decoration: none;
  transition: all var(--duration-fast) var(--ease-out);
}

.back-link:hover {
  border-color: var(--color-secondary);
  color: var(--color-secondary);
}

/* ========== BLOCKS WORKSPACE ========== */

.blocks-workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  width: 100%;
  max-width: 700px;
}

/* ========== PLACE VALUE MAT ========== */

.place-value-mat {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 3px solid var(--color-accent-orange);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
}

.place-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
}

.column-header {
  font-family: var(--font-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-primary-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.blocks-area {
  width: 100%;
  min-height: 150px;
  background: rgba(255, 255, 255, 0.6);
  border: 2px dashed rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-lg);
  padding: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-content: flex-start;
  justify-content: center;
}

.column-count {
  font-family: var(--font-secondary);
  font-size: var(--text-2xl);
  font-weight: var(--weight-extrabold);
  color: var(--color-primary-dark);
}

/* ========== BLOCKS ========== */

.block {
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease-out;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}

.block:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.block:active {
  transform: scale(0.95);
}

/* One block (1x1 cube) */
.one-block {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  border: 1px solid #2563eb;
}

/* Ten block (1x10 rod) */
.ten-block {
  width: 20px;
  height: 100px;
  background: linear-gradient(135deg, #4ade80, #22c55e);
  border: 1px solid #16a34a;
  display: flex;
  flex-direction: column;
}

.ten-block::before {
  content: '';
  flex: 1;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 9px,
    rgba(0, 0, 0, 0.1) 9px,
    rgba(0, 0, 0, 0.1) 10px
  );
}

/* Hundred block (10x10 flat) */
.hundred-block {
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  border: 1px solid #d97706;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
}

.hundred-block::before {
  content: '';
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  background:
    repeating-linear-gradient(
      to right,
      transparent 0px,
      transparent 9px,
      rgba(0, 0, 0, 0.1) 9px,
      rgba(0, 0, 0, 0.1) 10px
    ),
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 9px,
      rgba(0, 0, 0, 0.1) 9px,
      rgba(0, 0, 0, 0.1) 10px
    );
}

/* ========== BLOCK BANK ========== */

.block-bank {
  display: flex;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-4);
  background: linear-gradient(to bottom, #f1f5f9, #e2e8f0);
  border: 2px solid var(--color-neutral-200);
  border-radius: var(--radius-xl);
}

.bank-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  padding: var(--space-3);
  border-radius: var(--radius-lg);
  transition: all var(--duration-fast) var(--ease-out);
}

.bank-item:hover {
  background: rgba(0, 201, 201, 0.1);
}

.bank-item:active {
  transform: scale(0.95);
}

.bank-block {
  pointer-events: none;
}

.bank-label {
  font-family: var(--font-secondary);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-primary-dark);
}

/* ========== TOTAL DISPLAY ========== */

.total-value {
  font-size: var(--text-3xl);
  font-weight: var(--weight-extrabold);
  color: var(--color-accent-orange);
  margin-left: var(--space-2);
}

/* ========== ANIMATION ========== */

.block.adding {
  animation: blockPop 0.3s ease-out;
}

@keyframes blockPop {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  50% {
    transform: scale(1.2);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.block.removing {
  animation: blockShrink 0.2s ease-out forwards;
}

@keyframes blockShrink {
  to {
    transform: scale(0);
    opacity: 0;
  }
}

/* ========== MOBILE RESPONSIVE ========== */

@media (max-width: 767px) {
  .place-value-mat {
    padding: var(--space-3);
  }

  .blocks-area {
    min-height: 100px;
  }

  .column-header {
    font-size: var(--text-xs);
  }

  .column-count {
    font-size: var(--text-xl);
  }

  /* Smaller blocks on mobile */
  .one-block {
    width: 16px;
    height: 16px;
  }

  .ten-block {
    width: 16px;
    height: 80px;
  }

  .hundred-block {
    width: 80px;
    height: 80px;
  }

  .block-bank {
    gap: var(--space-4);
    padding: var(--space-3);
  }

  .bank-item {
    padding: var(--space-2);
  }

  .bank-label {
    font-size: var(--text-sm);
  }

  .total-value {
    font-size: var(--text-2xl);
  }
}
