body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f0f0;
}

.periodic-table {
    display: grid;
    grid-template-columns: repeat(18, 60px);
    gap: 2px;
    max-width: 1200px;
    margin: 0 auto;
}

.element {
    width: 60px;
    height: 60px;
    background-color: #fff;
    border: 1px solid #ccc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    transition: transform 0.2s;
}

.element:hover {
    transform: scale(1.1);
    z-index: 10;
}

.element .symbol {
    font-size: 18px;
    font-weight: bold;
}

.element .number {
    font-size: 14px;
    position: absolute;
    top: 5px;
    left: 5px;
}

.tooltip {
    display: none;
    position: absolute;
    background-color: #333;
    color: white;
    padding: 12px;
    border-radius: 5px;
    z-index: 100;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    white-space: normal;
    width: 200px;
    font-size: 13px;
    line-height: 1.4;
}

.element:hover .tooltip {
    display: block;
}

.alkali-metal {
    background-color: #ff9999;
}

.alkaline-earth-metal {
    background-color: #ffcc99;
}

.transition-metal {
    background-color: #99ccff;
}

.post-transition-metal {
    background-color: #ccffcc;
}

.metalloid {
    background-color: #cc99cc;
}

.nonmetal {
    background-color: #99ff99;
}

.noble-gas {
    background-color: #ff99ff;
}

.lanthanide {
    background-color: #ccccff;
}

.actinide {
    background-color: #ffccff;
}

.search-container {
    margin-bottom: 20px;
    text-align: center;
}

.search-container input {
    padding: 10px;
    width: 300px;
    font-size: 16px;
}

.details-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    padding: 20px;
    border: 2px solid #333;
    border-radius: 10px;
    z-index: 1000;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    line-height: 1.5;
    font-size: 14px;
}

.details-popup h2 {
    margin-top: 0;
    font-size: 24px;
}

.details-popup h3 {
    margin: 15px 0 5px;
    font-size: 18px;
}

.details-popup table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.details-popup table td {
    padding: 5px;
    border: 1px solid #ccc;
}

.details-popup table td:first-child {
    font-weight: bold;
    width: 40%;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    font-size: 20px;
}

.category-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 5px 10px;
}

.legend-color {
    width: 20px;
    height: 20px;
    margin-right: 5px;
}

.spacer {
    background-color: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.error-message {
    color: red;
    text-align: center;
    margin-top: 20px;
    display: none;
}

@media (max-width:480px) {
.details-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
   
}

.tooltip {
    display: none;
    position: absolute;

    top: 60px;
    left: 150%; 
  
   
 
}

}