/* ===================================
   PERIODIC TABLE CONTROLS & LAYOUT
   =================================== */

/* Container and Layout */
.periodic-container {
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto; /* Allow horizontal scroll on mobile */
  overflow-y: hidden;
}

.table-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2rem auto;
  padding: 1rem;
  min-width: fit-content;
  transform-origin: top center;
}

/* Responsive scaling for table */
@media (max-width: 1600px) {
  .table-container {
    transform: scale(0.9);
    margin: 1rem auto;
  }
}

@media (max-width: 1400px) {
  .table-container {
    transform: scale(0.8);
    margin: 0.5rem auto;
  }
}

@media (max-width: 1200px) {
  .table-container {
    transform: scale(0.7);
    margin: 0 auto;
  }
}

@media (max-width: 1000px) {
  .table-container {
    transform: scale(0.6);
    margin: -2rem auto;
  }
}

@media (max-width: 768px) {
  .table-container {
    transform: scale(0.5);
    margin: -4rem auto;
  }
}

@media (max-width: 600px) {
  .table-container {
    transform: scale(0.4);
    margin: -8rem auto;
  }
}

/* Control Panel - Original Design */
.control-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

/* Search Scanner - Original Design */
.search-scanner {
  position: relative;
  max-width: 400px;
}

.scanner-input {
  width: 100%;
  padding: 0.7rem 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: #8892A0;
  font-family: var(--font-tech);
  font-size: 0.9rem;
  letter-spacing: 1px;
  transition: all 0.3s ease;
  border-radius: 5px;
}

.scanner-input:focus {
  outline: none;
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  background: rgba(0, 212, 255, 0.1);
}

.scanner-input::placeholder {
  color: var(--color-text-secondary);
  opacity: 0.6;
}

.scanner-beam {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--color-brand-primary), transparent);
  animation: scan-beam 2s linear infinite;
  opacity: 0;
  transition: opacity 0.3s;
}

.scanner-input:focus ~ .scanner-beam {
  opacity: 1;
}

@keyframes scan-beam {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Filter Controls - Original Design */
.filter-controls {
  display: flex;
  gap: 1rem;
}

/* Filter Buttons - Original Design */
.filter-btn {
  padding: 0.7rem 1.5rem;
  background: transparent;
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: #8892A0;
  font-family: var(--font-tech);
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 5px;
  text-transform: uppercase;
}

.filter-btn:hover,
.filter-btn.active {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  background: rgba(0, 212, 255, 0.1);
}

.filter-btn#clear-filters {
  background: linear-gradient(135deg, rgba(255, 23, 68, 0.2), rgba(255, 64, 129, 0.2));
  border-color: rgba(255, 23, 68, 0.5);
}

.filter-btn#clear-filters:hover {
  border-color: rgb(255, 23, 68);
  color: rgb(255, 23, 68);
  box-shadow: 0 5px 15px rgba(255, 23, 68, 0.3);
}

/* Filter Dropdowns - Original Design */
.filter-select {
  padding: 0.7rem 1.5rem;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(0, 212, 255, 0.3);
  color: #8892A0;
  font-family: var(--font-tech);
  font-size: 0.9rem;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.3s ease;
  border-radius: 5px;
}

.filter-select:hover,
.filter-select:focus {
  border-color: var(--neon-blue);
  color: var(--neon-blue);
  background: rgba(0, 212, 255, 0.1);
  outline: none;
}

.filter-select option {
  background: #0a0f1b;
  color: #8892A0;
}

/* Legend Section - Original Design */
.table-legend {
  margin-top: 3rem;
  padding: 2rem;
  background: rgba(26, 29, 36, 0.5);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: 10px;
  backdrop-filter: blur(10px);
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.legend-title {
  color: var(--neon-blue);
  margin-bottom: 1.5rem;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
  font-size: 1.5rem;
  font-weight: 700;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem;
  border-radius: 5px;
  transition: all 0.3s ease;
  cursor: pointer;
  user-select: none;
}

.legend-item:hover {
  background: rgba(0, 212, 255, 0.1);
  transform: translateX(5px);
}

.legend-item.legend-active {
  background: rgba(0, 212, 255, 0.2);
  border: 1px solid rgba(0, 212, 255, 0.5);
  box-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.legend-color {
  width: 30px;
  height: 30px;
  border: 2px solid;
  border-radius: 5px;
  background: rgba(26, 29, 36, 0.8);
}

.legend-label {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-primary);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .control-panel {
    padding: 1rem;
    gap: 0.75rem;
  }
  
  .search-scanner {
    min-width: 100%;
  }
  
  .filter-controls {
    width: 100%;
    justify-content: space-around;
  }
  
  .filter-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
  }
  
  .filter-select {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
    min-width: 100px;
  }
  
  .legend-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .table-container {
    padding: 0.5rem;
  }
}