/* ==================== SIDEBAR CONTENT ==================== */
.sidebar-section {
  margin-bottom: 20px;
}

.section-label {
  font-size: 0.66rem;
  font-weight: 600;
  color: #666666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

/* ==================== MODE TABS ==================== */
.mode-tabs {
  display: flex;
  background: #E8E8E8;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #666666;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.mode-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.mode-tab:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #333333;
}

.mode-tab.active {
  background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(185, 0, 255, 0.3);
}

.mode-tab.active svg {
  color: #fff;
}

/* ==================== SETTINGS ==================== */
.settings-group {
  margin-bottom: 12px;
}

.settings-group.hidden {
  display: none;
}

.settings-label {
  font-size: 0.75rem;
  color: #666666;
  margin-bottom: 6px;
  display: block;
}

/* ==================== DROPDOWNS ==================== */
.dropdown {
  position: relative;
}

.dropdown-btn {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: #E8E8E8;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #333333;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.dropdown-btn:hover {
  background: #DFDFDF;
}

.dropdown-btn svg {
  width: 16px;
  height: 16px;
  color: #666666;
  transition: transform 0.2s ease;
}

.dropdown.open .dropdown-btn svg {
  transform: rotate(180deg);
}

.dropdown.open .dropdown-btn {
  border-color: #832EC5;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #FFFFFF;
  border: 1px solid #E0E0E0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 200;
  display: none;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-item {
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: #333333;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.dropdown-item:hover {
  background: #F5F5F5;
}

.dropdown-item.active {
  background: linear-gradient(135deg, rgba(185, 0, 255, 0.1) 0%, rgba(131, 46, 197, 0.08) 100%);
  color: #832EC5;
  font-weight: 500;
}

/* ==================== AXIS INPUTS ==================== */
.axis-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.axis-input-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.axis-label {
  font-size: 0.75rem;
  color: #666666;
  font-weight: 500;
  min-width: 55px;
}


/* ==================== QUICK ACTIONS ==================== */
.quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  background: #E8E8E8;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #666666;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.action-btn svg {
  width: 16px;
  height: 16px;
}

.action-btn:hover {
  background: #DFDFDF;
  border: 1px solid transparent;
  color: #333333;
}

.action-btn.active {
  background: linear-gradient(135deg, rgba(185, 0, 255, 0.15) 0%, rgba(131, 46, 197, 0.1) 100%);
  border-color: rgba(185, 0, 255, 0.3);
  color: #832EC5;
}

/* ==================== TOOLS ==================== */
/* Using shared/tools-card.css */

/* Tool-specific overrides */
.blackout-icon {
  background: #1a1a2e;
  border-radius: 4px;
  border: 1px solid #CCCCCC;
}

.eraser-btn {
  border-style: dashed;
}

/* ==================== PAINT TOGGLE ==================== */
.paint-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #F5F5F5;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 12px;
}

.paint-toggle:hover {
  background: #E8E8E8;
}

.paint-toggle.active {
  background: linear-gradient(135deg, rgba(185, 0, 255, 0.12) 0%, rgba(131, 46, 197, 0.08) 100%);
  border: 1px solid rgba(185, 0, 255, 0.25);
}

.paint-toggle .paint-icon {
  width: 20px;
  height: 20px;
  color: #666666;
}

.paint-toggle.active .paint-icon {
  color: #832EC5;
}

.toggle-label {
  flex: 1;
  font-size: 0.8rem;
  font-weight: 500;
  color: #333333;
}

.toggle-switch {
  display: flex;
  align-items: center;
}

.toggle-track {
  width: 36px;
  height: 20px;
  background: #CCCCCC;
  border-radius: 10px;
  position: relative;
  transition: all 0.2s ease;
}

.paint-toggle.active .toggle-track {
  background: linear-gradient(135deg, #B900FF 0%, #832EC5 100%);
}

.toggle-thumb {
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.paint-toggle.active .toggle-thumb {
  left: 18px;
}

/* ==================== CLEAR BUTTON ==================== */
.clear-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background: #FFFFFF;
  border: 2px solid #EF4444;
  border-radius: 8px;
  color: #333333;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.clear-btn svg {
  width: 18px;
  height: 18px;
  color: #EF4444;
}

.clear-btn:hover:not(:disabled) {
  background: #FEF2F2;
  transform: translateY(-1px);
}

.clear-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  justify-content: center;
}

.container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #B900FF 0%, #FFC700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(185, 0, 255, 0.3);
  margin-bottom: 24px;
}

/* ==================== GRID ==================== */
.grid-container {
  display: flex;
  justify-content: center;
  align-items: center;
}

.grid {
  display: grid;
  gap: 3px;
}

/* Hundreds Chart Grid - 10x10 */
body.number-mode .grid {
  grid-template-columns: repeat(10, 1fr);
}

.cell {
  width: var(--cell-size, 60px);
  height: var(--cell-size, 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--cell-font-size, 1rem);
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  position: relative;
  user-select: none;
}

.cell.header {
  background: linear-gradient(135deg, #832EC5 0%, #B900FF 100%);
  color: #fff;
  font-weight: 700;
}

.cell.corner {
  background: transparent;
}

.cell.product,
.cell.sum,
.cell.number {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
}

.cell.product:hover,
.cell.sum:hover,
.cell.number:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
  z-index: 10;
  box-shadow: 0 4px 20px rgba(185, 0, 255, 0.3);
}

.cell.highlighted {
  color: #1a1a2e;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.cell.highlighted[style*="background-color: rgb(0, 0, 0)"],
.cell.highlighted[style*="background-color:#000000"],
.cell.highlighted[style*="background-color: #000000"] {
  color: #ffffff !important;
}

.cell.blackout {
  background: #000 !important;
  color: #000 !important;
  text-shadow: none !important;
}

.cell.hidden-number {
  color: transparent !important;
}

.cell.factor-highlight {
  background: rgba(255, 255, 255, 0.25) !important;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.2);
}

.cell.axis-glow {
  box-shadow: 0 0 12px rgba(185, 0, 255, 0.5), 0 0 20px rgba(131, 46, 197, 0.3);
  z-index: 5;
}

.cell.axis-glow.highlighted {
  z-index: 6;
}

/* Highlighted cells override glow background */
.cell.axis-glow.highlighted {
  box-shadow: 0 0 12px rgba(185, 0, 255, 0.5), 0 0 20px rgba(131, 46, 197, 0.3), 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* Hide paint/eraser tools in Number mode */
body.number-mode .paint-btn,
body.number-mode .eraser-btn {
  display: none;
}

/* ==================== EQUATION DISPLAY ==================== */
.equation-display {
  min-height: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.equation {
  font-size: 1.8rem;
  font-weight: 700;
  padding: 12px 28px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  animation: fadeIn 0.3s ease;
}

.equation .factor {
  color: #B900FF;
}

.equation .product,
.equation .sum {
  color: #FFC700;
}

.number-display {
  font-size: 3rem;
  font-weight: 700;
  padding: 16px 40px;
  background: linear-gradient(135deg, rgba(131, 46, 197, 0.2) 0%, rgba(185, 0, 255, 0.15) 100%);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(185, 0, 255, 0.3);
  color: #fff;
  animation: fadeIn 0.3s ease;
}

.number-display .number {
  background: linear-gradient(135deg, #B900FF 0%, #FFC700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1100px) {
  .sidebar {
    width: 80px;
    padding: 16px 8px;
  }
  
  .section-label,
  .settings-label,
  .toggle-label,
  .mode-tab span,
  .tool-btn span,
  .action-btn span,
  .clear-btn span,
  .dropdown-btn span {
    display: none;
  }
  
  .mode-tabs {
    flex-direction: column;
  }
  
  .mode-tab {
    justify-content: center;
    padding: 12px;
  }
  
  .color-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
  }
  
  .quick-actions {
    flex-direction: column;
  }
  
  .dropdown-btn {
    justify-content: center;
  }
  
  .dropdown-btn svg {
    display: none;
  }
  
  .main-content {
    margin-left: 80px;
  }
  
  .paint-toggle {
    justify-content: center;
    padding: 10px;
  }
  
  .clear-btn {
    justify-content: center;
  }
}

@media (max-width: 1400px) {
  .cell {
    width: 48px;
    height: 48px;
    font-size: 0.9rem;
  }
}

@media (max-width: 900px) {
  .cell {
    width: 36px;
    height: 36px;
    font-size: 0.8rem;
  }
  
  h1 {
    font-size: 1.8rem;
  }
  
  .equation {
    font-size: 1.4rem;
  }
  
  .number-display {
    font-size: 2rem;
    padding: 12px 28px;
  }
}

@media (max-width: 600px) {
  .sidebar {
    width: 60px;
    padding: 12px 6px;
  }
  
  .main-content {
    margin-left: 60px;
    padding: 20px 10px;
  }
  
  .cell {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
    border-radius: 4px;
  }
  
  .color-btn {
    border-radius: 6px;
  }
}
