/* ===== 周期表容器 ===== */
.periodic-table-wrapper {
    overflow-x: auto;
    padding: 10px 0;
}
.periodic-grid {
    display: grid;
    grid-template-columns: repeat(18, minmax(52px, 1fr));
    gap: 3px;
    min-width: 960px;
    margin: 0 auto;
}

/* ===== 元素卡片 ===== */
.element-card {
    border-radius: 4px;
    padding: 4px 2px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1a1a2e;
    font-size: 11px;
    line-height: 1.2;
    min-height: 58px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.4);
    user-select: none;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.element-card:hover {
    transform: scale(1.08);
    z-index: 10;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    border-color: #fff;
}
.element-card .number {
    font-size: 9px;
    opacity: 0.7;
    font-weight: 500;
    line-height: 1;
}
.element-card .symbol {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.5px;
}
.element-card .name {
    font-size: 9px;
    opacity: 0.85;
    line-height: 1.1;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 空占位 ===== */
.element-placeholder {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    cursor: default !important;
    min-height: 58px;
}

/* ===== 分类颜色 ===== */
.cat-alkali {
    background: #ff6b6b;
    color: #fff;
}
.cat-alkaline {
    background: #ff9f43;
    color: #fff;
}
.cat-transition {
    background: #ffc312;
    color: #1a1a2e;
}
.cat-post-transition {
    background: #4ecdc4;
    color: #1a1a2e;
}
.cat-metalloid {
    background: #45b7d1;
    color: #fff;
}
.cat-nonmetal {
    background: #2ecc71;
    color: #fff;
}
.cat-halogen {
    background: #a29bfe;
    color: #fff;
}
.cat-noble {
    background: #fd79a8;
    color: #1a1a2e;
}
.cat-lanthanide {
    background: #fdcb6e;
    color: #1a1a2e;
}
.cat-actinide {
    background: #e17055;
    color: #fff;
}

/* ===== 图例 ===== */
.legend-item {
    display: inline-flex;
    align-items: center;
    margin-right: 14px;
    margin-bottom: 6px;
    font-size: 13px;
}
.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    margin-right: 6px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

/* ===== 搜索 & 筛选 ===== */
.toolbar-area {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 16px;
    margin-bottom: 18px;
}
.toolbar-area .search-box {
    flex: 1 1 220px;
    min-width: 150px;
}
.toolbar-area .filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.toolbar-area .filter-group .btn-filter {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 20px;
    border: 2px solid transparent;
    background: #f1f2f6;
    color: #2d3436;
    transition: all 0.2s;
}
.toolbar-area .filter-group .btn-filter:hover {
    background: #dfe6e9;
}
.toolbar-area .filter-group .btn-filter.active {
    border-color: #2d3436;
    background: #2d3436;
    color: #fff;
}
.toolbar-area .filter-group .btn-filter.active-cat {
    border-color: currentColor;
    background: currentColor;
    color: #fff;
}

/* ===== 镧系 / 锕系 专用行 ===== */
.lanthanide-actinide-row {
    display: grid;
    grid-template-columns: repeat(18, minmax(52px, 1fr));
    gap: 3px;
    min-width: 960px;
    margin: 6px auto 0;
}
.la-row-label {
    grid-column: span 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #2d3436;
    background: #f8f9fa;
    border-radius: 4px;
    min-height: 58px;
    padding: 0 4px;
    text-align: center;
    line-height: 1.2;
}
.la-row-label small {
    font-weight: 400;
    font-size: 10px;
    display: block;
    opacity: 0.7;
}

/* ===== 响应式适配 ===== */
@media (max-width: 1024px) {
    .periodic-grid,
    .lanthanide-actinide-row {
        min-width: 720px;
    }
    .periodic-grid {
        grid-template-columns: repeat(18, minmax(38px, 1fr));
    }
    .lanthanide-actinide-row {
        grid-template-columns: repeat(18, minmax(38px, 1fr));
    }
    .element-card .symbol {
        font-size: 14px;
    }
    .element-card .number {
        font-size: 8px;
    }
    .element-card .name {
        font-size: 7px;
    }
    .element-card {
        min-height: 44px;
        padding: 2px 1px;
    }
    .la-row-label {
        min-height: 44px;
        font-size: 10px;
    }
}
@media (max-width: 768px) {
    .periodic-grid,
    .lanthanide-actinide-row {
        min-width: 580px;
    }
    .periodic-grid {
        grid-template-columns: repeat(18, minmax(30px, 1fr));
        gap: 2px;
    }
    .lanthanide-actinide-row {
        grid-template-columns: repeat(18, minmax(30px, 1fr));
        gap: 2px;
    }
    .element-card .symbol {
        font-size: 11px;
    }
    .element-card .number {
        font-size: 6px;
    }
    .element-card .name {
        font-size: 6px;
    }
    .element-card {
        min-height: 34px;
        padding: 1px;
        border-radius: 2px;
    }
    .la-row-label {
        min-height: 34px;
        font-size: 8px;
    }
    .toolbar-area {
        flex-direction: column;
        align-items: stretch;
    }
    .toolbar-area .filter-group {
        justify-content: center;
    }
}

/* ===== 详情模态框 ===== */
.element-detail-symbol {
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
}
.element-detail-name {
    font-size: 28px;
    font-weight: 600;
}
.element-detail-number {
    font-size: 18px;
    opacity: 0.7;
}
.detail-color-box {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    display: inline-block;
    border: 2px solid rgba(0, 0, 0, 0.1);
}
.detail-property {
    padding: 6px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}
.detail-property .label {
    opacity: 0.6;
    font-weight: 500;
}

/* ===== 统计信息 ===== */
.stats-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 20px;
    font-size: 13px;
    background: #f1f2f6;
    color: #2d3436;
    margin-right: 6px;
}
.stats-badge strong {
    font-weight: 700;
}

/* 加载占位 */
.periodic-loading {
    text-align: center;
    padding: 60px 0;
    font-size: 18px;
    color: #636e72;
}
