body {
  background-color: #1a1a2e;
  color: #eee;
  font-family: 'Inter', sans-serif;
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  line-height: 1.6;
}

.element-heading {
  color: #16f4d0;
  font-size: 2.5rem;
  margin-bottom: 2rem;
  text-align: center;
}

p {
  margin: 1rem 0;
  display: grid;
  grid-template-columns: 200px minmax(200px, 400px);
  gap: 2rem;
}

strong {
  color: #a0a0a0;
  font-weight: 600;
}

span {
  color: #ffffff;
  font-weight: 400;
}

/* Index page specific styles */
main {
  padding: 2rem 0;
}

.period {
  margin-bottom: 3rem;
}

.period h2 {
  color: #16f4d0;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #16f4d0;
}

.element-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.element-list a {
  background-color: #16f4d0;
  color: #1a1a2e;
  text-decoration: none;
  padding: 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  text-align: center;
  font-weight: 500;
}

.element-list a:hover {
  background-color: #16f4d0;
  color: #1a1a2e;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(22, 244, 208, 0.3);
}

.element-list a:visited {
  color: #16f4d0;
}

.element-list a:visited:hover {
  background-color: #16f4d0;
  color: #1a1a2e;
}

/* Element pages specific styles */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px;
    background-color: #d0d0d0;
}

.quick-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    list-style: none;
    padding: 20px;
    margin: 20px 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.groups-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 40px;
    margin-top: 40px;
    grid-auto-flow: dense;  
}

.group-section {
    break-inside: avoid;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.group-section ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 0;
    list-style: none;
}

.group-section li {
    flex: 0 0 auto;
}

.group-section li::before {
    content: "• ";
    margin-right: 5px;
}

.group-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0, 0.15);
}

h1 {
    border-bottom: 2px solid;
    padding-bottom: 5px;
}

a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: #0044aa;
    text-decoration: underline;
}

@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
}

/* Period Colors */
#period-1 a {
    background-color: #E3F2FD; /* Light Blue */
}

#period-2 a {
    background-color: #E8F5E9; /* Light Green */
}

#period-3 a {
    background-color: #FFF9C4; /* Light Yellow */
}

#period-4 a {
    background-color: #FFE0B2; /* Light Orange */
}

#period-5 a {
    background-color: #F8BBD0; /* Light Pink */
}

#period-6 a {
    background-color: #E1BEE7; /* Light Purple */
}

#period-7 a {
    background-color: #FFCCBC; /* Light Coral */
}

/* Filter Buttons */
.filter-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: #2a2a3e;
  border-radius: 8px;
}

.filter-btn {
  padding: 0.6rem 1.2rem;
  background-color: #1a1a2e;
  color: #16f4d0;
  border: 2px solid #16f4d0;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.filter-btn:hover {
  background-color: #16f4d0;
  color: #1a1a2e;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(22, 244, 208, 0.3);
}

.filter-btn.active {
  background-color: #16f4d0;
  color: #1a1a2e;
}

/* Hidden class for filters */
.hidden {
  display: none;
}

/* Element Search Box */
.search-container {
    text-align: center;
    margin: 2rem auto;
    max-width: 600px;
}

#element-search {
    padding: 0.8rem;
    font-size: 1rem;
    width: 60%;
    border: 2px solid #333;
    border-radius: 5px;
    margin-right: 0.5rem;
}

#search-button {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    background-color: #333;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#search-button:hover {
    background-color: #555;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
}

/* Quiz Link Styling */
.quiz-link-container {
    text-align: center;
    margin: 2rem 0;
    max-width: 790px;
}

.quiz-link {
    display: inline-block;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.quiz-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Element Popup Styles */
.popup-hidden {
  display: none;
}

#element-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  background-color: white;
  transform: translate(-50%, -50%);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  color: #2c3e50;
  z-index: 1001;
  animation: fadeIn 1.0s ease-in-out;
}

#popup-element-name {
  margin-bottom: 20px;
  color: #2c3e50;
  font-size: 28px;
  border-bottom: 3px solid #3498db;
  padding-bottom: 10px;}

.close-button {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 28px;
  cursor: pointer;
  color: #666;
}

.close-button:hover {
  color: #000;
}

.view-page-button { /*Selector Specificity: 0, 1, 0 */
  display: inline-block;
  margin-top: 25px;
  padding: 12px 30px;
  background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
  color: black;
  text-decoration: none;
  border-radius: 25px;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 4px 8px rgba(52, 152, 219, 0.3);
}

.view-page-button:hover { /*Selector Specificity: 0, 2, 0 */
  background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

@keyframes fadeIn {
  from { 
    opacity: 0; 
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
  }
}

.popup-overlay { /*Selector Specificity: 0, 1, 0 */ 
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  z-index: 999;
}