/* Fraction Bars 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);
}

/* ========== DENOMINATOR BUTTONS ========== */

.denominator-buttons {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.den-btn {
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-secondary);
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-neutral-600);
  background: white;
  border: 2px solid var(--color-neutral-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  min-width: 44px;
}

.den-btn:hover {
  border-color: var(--color-secondary);
  color: var(--color-secondary);
}

.den-btn.active {
  background: linear-gradient(to bottom, #33E5E5, #00C9C9);
  color: white;
  border-color: #00A3A3;
}

/* ========== FRACTION WORKSPACE ========== */

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

/* ========== BAR CONTAINERS ========== */

.whole-bar-container,
.tray-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.bar-label {
  font-family: var(--font-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-neutral-600);
}

#fraction-display {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-accent-pink);
}

/* ========== WHOLE BAR ========== */

.whole-bar {
  height: 40px;
  background: linear-gradient(to bottom, #e0f7fa, #b2ebf2);
  border: 3px solid var(--color-secondary);
  border-radius: var(--radius-lg);
  display: flex;
  position: relative;
  overflow: hidden;
}

.whole-bar::after {
  content: '1';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-secondary);
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  color: var(--color-secondary);
}

/* ========== FRACTION TRAY ========== */

.fraction-tray {
  height: 60px;
  background: linear-gradient(to bottom, #fef3c7, #fde68a);
  border: 3px dashed var(--color-accent-orange);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: stretch;
  position: relative;
  overflow: hidden;
}

.fraction-tray.full {
  border-style: solid;
  border-color: var(--color-success);
  background: linear-gradient(to bottom, #d1fae5, #a7f3d0);
}

/* ========== FRACTION PIECES ========== */

.fraction-piece {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-family: var(--font-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: white;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.2);
  user-select: none;
}

.fraction-piece:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fraction-piece:active {
  transform: scale(0.95);
}

/* Tray pieces */
.fraction-tray .fraction-piece {
  height: 100%;
  border-radius: 0;
  flex-shrink: 0;
}

.fraction-tray .fraction-piece:first-child {
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

/* Piece colors by denominator */
.fraction-piece[data-den="2"] { background: linear-gradient(to bottom, #FF6B9D, #FF4785); }
.fraction-piece[data-den="3"] { background: linear-gradient(to bottom, #A855F7, #9333EA); }
.fraction-piece[data-den="4"] { background: linear-gradient(to bottom, #00C9C9, #00A3A3); }
.fraction-piece[data-den="5"] { background: linear-gradient(to bottom, #FFD700, #FFA500); }
.fraction-piece[data-den="6"] { background: linear-gradient(to bottom, #4ade80, #22c55e); }
.fraction-piece[data-den="8"] { background: linear-gradient(to bottom, #60a5fa, #3b82f6); }
.fraction-piece[data-den="10"] { background: linear-gradient(to bottom, #f472b6, #ec4899); }
.fraction-piece[data-den="12"] { background: linear-gradient(to bottom, #fb923c, #f97316); }

/* ========== EQUIVALENT INDICATOR ========== */

.equivalent-badge {
  position: absolute;
  top: -10px;
  right: -10px;
  background: var(--color-success);
  color: white;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

@media (max-width: 767px) {
  .fraction-workspace {
    gap: var(--space-4);
  }

  .whole-bar {
    height: 32px;
  }

  .fraction-tray {
    height: 50px;
  }

  .denominator-buttons {
    justify-content: center;
  }

  .den-btn {
    padding: var(--space-1) var(--space-2);
    min-width: 40px;
    font-size: var(--text-sm);
  }
}
