/* Periodic Table Specific Styles */

.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 768px) {
  .main-grid {
    grid-template-columns: 1fr;
  }
}

.element-display {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: rgba(255,255,255,0.8);
  border: 2px solid #dee2e6;
  border-radius: 8px;
  margin-bottom: 16px;
}

.element-symbol-large {
  font-size: 48px;
  font-weight: 700;
  color: #2c3e50;
  min-width: 80px;
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.element-info {
  flex: 1;
}

.element-name-large {
  font-size: 24px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 4px;
}

.element-number-large,
.element-weight-large {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 2px;
}

.element-properties {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.property-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 12px;
}

.property-label {
  color: #6c757d;
  font-weight: 500;
}

.property-value {
  font-family: monospace;
  color: #2c3e50;
  font-weight: 600;
}

.element-description {
  padding: 12px;
  background: rgba(255,255,255,0.8);
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: #495057;
}

.legend {
  margin-top: 16px;
}

.legend-title {
  font-size: 13px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 8px;
}

.legend-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #495057;
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(0,0,0,0.1);
}

.periodic-table-container {
  overflow: auto;
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
}

.periodic-table {
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 2px;
  min-width: 900px;
  transform-origin: top left;
  transition: transform 0.3s ease;
}

.element-cell {
  aspect-ratio: 1;
  min-height: 45px;
  background: #ffffff;
  border: 2px solid #dee2e6;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2px;
  font-size: 10px;
}

.element-cell:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  z-index: 10;
  border-color: #667eea;
}

.element-cell.selected {
  border-color: #28a745;
  background: rgba(40, 167, 69, 0.1);
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.3);
}

.element-cell.highlighted {
  border-color: #ffc107;
  background: rgba(255, 193, 7, 0.1);
  animation: highlight 1s ease-in-out;
}

.element-number {
  position: absolute;
  top: 2px;
  left: 2px;
  font-size: 8px;
  color: #6c757d;
  font-weight: 500;
}

.element-symbol {
  font-size: 14px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 1px;
}

.element-name {
  font-size: 7px;
  color: #6c757d;
  text-align: center;
  line-height: 1;
}

.element-weight {
  position: absolute;
  bottom: 1px;
  right: 2px;
  font-size: 6px;
  color: #6c757d;
}

/* 元素类型颜色 */
.element-cell.alkali-metal { background-color: #ff6b6b; }
.element-cell.alkaline-earth { background-color: #feca57; }
.element-cell.transition-metal { background-color: #48dbfb; }
.element-cell.post-transition { background-color: #ff9ff3; }
.element-cell.metalloid { background-color: #54a0ff; }
.element-cell.nonmetal { background-color: #5f27cd; color: white; }
.element-cell.halogen { background-color: #00d2d3; }
.element-cell.noble-gas { background-color: #ff3838; color: white; }
.element-cell.lanthanide { background-color: #2ed573; }
.element-cell.actinide { background-color: #ffa502; }

.legend-color.alkali-metal { background-color: #ff6b6b; }
.legend-color.alkaline-earth { background-color: #feca57; }
.legend-color.transition-metal { background-color: #48dbfb; }
.legend-color.post-transition { background-color: #ff9ff3; }
.legend-color.metalloid { background-color: #54a0ff; }
.legend-color.nonmetal { background-color: #5f27cd; }
.legend-color.halogen { background-color: #00d2d3; }
.legend-color.noble-gas { background-color: #ff3838; }

.table-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
}

.comparison-container {
  min-height: 200px;
  background: rgba(255,255,255,0.8);
  border: 2px dashed #dee2e6;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
}

.comparison-placeholder {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 14px;
  min-height: 120px;
}

.comparison-placeholder .icon {
  width: 48px;
  height: 48px;
  margin-bottom: 8px;
  opacity: 0.5;
}

.comparison-element {
  background: #ffffff;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 12px;
  min-width: 120px;
  text-align: center;
  position: relative;
  transition: all 0.3s ease;
}

.comparison-element:hover {
  border-color: #667eea;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.comparison-element .element-symbol {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 4px;
}

.comparison-element .element-name {
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 8px;
}

.comparison-properties {
  font-size: 10px;
  color: #495057;
  text-align: left;
}

.comparison-properties div {
  margin-bottom: 2px;
}

.remove-comparison {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 20px;
  height: 20px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.remove-comparison:hover {
  background: #c82333;
  transform: scale(1.1);
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* 动画效果 */
@keyframes highlight {
  0%, 100% { 
    border-color: #ffc107;
    background: rgba(255, 193, 7, 0.1);
  }
  50% { 
    border-color: #ff6b35;
    background: rgba(255, 107, 53, 0.2);
    transform: scale(1.02);
  }
}

.element-cell.new {
  animation: elementAppear 0.5s ease-out;
}

@keyframes elementAppear {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.comparison-element.new {
  animation: comparisonAdd 0.3s ease-out;
}

@keyframes comparisonAdd {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .element-properties {
    grid-template-columns: 1fr;
  }
  
  .legend-items {
    grid-template-columns: 1fr;
  }
  
  .element-display {
    flex-direction: column;
    text-align: center;
  }
  
  .element-symbol-large {
    min-width: auto;
  }
  
  .periodic-table {
    min-width: 720px;
  }
  
  .element-cell {
    min-height: 35px;
  }
  
  .element-symbol {
    font-size: 12px;
  }
  
  .element-name {
    font-size: 6px;
  }
  
  .table-controls {
    justify-content: center;
  }
  
  .toolbar {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .periodic-table {
    min-width: 600px;
  }
  
  .element-cell {
    min-height: 30px;
  }
  
  .element-symbol {
    font-size: 10px;
  }
  
  .element-number,
  .element-weight {
    font-size: 6px;
  }
  
  .comparison-element {
    min-width: 100px;
    padding: 8px;
  }
}